New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update: use doctrine range information in valid-jsdoc #9831
Conversation
Would it be possible to only report the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@j-f1 Unfortunately, that information is not provided by doctrine because it's a string property of the tag object, so it doesn't have its own |
@platinumazure @ilyavolodin @gyandeeps Thanks for reviewing. To clarify, are you also 👍 for adding this feature? If so, can you add a 👍 to the issue so that we can mark it as accepted? |
Definitely 👍 seems like a significant improvement over current situation. |
@eslint/eslint-team We need one more 👍 from a team member to accept this issue. |
This change does not seem to handle optional array types using When eslint rules has a preferType that maps
/**
* @param {number[]} [a=1]
* @param {string[]} [b=""]
*/
function foo(a=1, b="") {} The code above should be fixed to This is happening since eslint 4.16.0 till 4.18.2 |
@soruly If you've found a bug, please create a new issue and fill out the bug report template. Thanks! |
What is the purpose of this pull request? (put an "X" next to item)
[x] Changes an existing rule
[x] Add autofixing to a rule
What rule do you want to change?
valid-jsdoc
Does this change cause the rule to produce more or fewer warnings?
The same amount
How will the change be implemented? (New option, new default behavior, etc.)?
New default behavior
Please provide some example code that this change will affect:
What does the rule currently do for this code?
It reports the entire JSDoc comment to indicate that the second parameter name is wrong.
What will the rule do after it's changed?
It will report only the text
@param {number} notB
in the comment to indicate that the second parameter name is wrong.What changes did you make? (Give an overview)
Now that
doctrine
can provide range information in JSDoc tags, this makes a few improvements to thevalid-jsdoc
rule:prefer
andpreferType
options (for example, it can replaceobject
withObject
if the rule is configured to prefer the latter).Is there anything you'd like reviewers to focus on?
Nothing in particular