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
Chore: enable eslint-plugin-jsdoc (refs #11146) #12332
Conversation
24e99fc
to
f1b974f
Compare
@@ -85,8 +85,8 @@ const validFixTypes = new Set(["problem", "suggestion", "layout"]); | |||
* @property {number} warningCount Number of warnings for the result. | |||
* @property {number} fixableErrorCount Number of fixable errors for the result. | |||
* @property {number} fixableWarningCount Number of fixable warnings for the result. | |||
* @property {string=} [source] The source code of the file that was linted. | |||
* @property {string=} [output] The source code of the file that was linted, with as many fixes applied as possible. | |||
* @property {string} [source] The source code of the file that was linted. |
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.
jsdoc/check-syntax
enforces this syntax for optional parameters.
@@ -329,7 +329,6 @@ function getRule(ruleId, configArrays) { | |||
/** | |||
* Collect used deprecated rules. | |||
* @param {ConfigArray[]} usedConfigArrays The config arrays which were used. | |||
* @param {Map<string, Object>} ruleMap The rule definitions which were used (built-ins). |
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.
This parameter no longer exists.
@@ -530,7 +529,6 @@ class CLIEngine { | |||
/** | |||
* Creates a new instance of the core CLI engine. | |||
* @param {CLIEngineOptions} providedOptions The options for this instance. | |||
* @constructor |
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.
ES2015 classes no longer need to be documented as @class
or @constructor
- the parser can now identify this case.
@@ -78,7 +78,7 @@ function mergeDefaultOptions(options) { | |||
return Object.assign({}, DEFAULT_OPTIONS, options); | |||
} | |||
|
|||
/* eslint-disable valid-jsdoc */ | |||
/* eslint-disable jsdoc/check-param-names, jsdoc/require-param */ |
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.
A really nice thing about the separate checks is that we can disable specific checks and still enforce other things we care about!
@@ -99,7 +99,7 @@ function groupByProperty(objects) { | |||
* Configs may also have one or more additional elements to specify rule | |||
* configuration or options. | |||
* | |||
* @typedef {array|number} ruleConfig | |||
* @typedef {Array|number} ruleConfig |
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.
I'm not sure why valid-jsdoc
didn't catch this.
@@ -185,7 +185,7 @@ class RuleConfigSet { | |||
|
|||
/** | |||
* Stored valid rule configurations for this instance | |||
* @type {array} | |||
* @type {Array} |
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.
I'm not sure why valid-jsdoc
didn't catch this.
@@ -85,6 +85,7 @@ describe("CascadingConfigArrayFactory", () => { | |||
|
|||
/** | |||
* Returns the path inside of the fixture directory. | |||
* @param {...string} args file path segments. |
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.
It doesn't seem like valid-jsdoc
enforced documenting rest parameters.
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!
5b1d393
to
60486d1
Compare
I'm not sure why the commit-message check is failing - it looks like it should accept |
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, thank you!
What is the purpose of this pull request? (put an "X" next to item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:
refs #11146
Finally have the time to switch to
eslint-plugin-jsdoc
ineslint-config-eslint
now that our core JSDoc rules are deprecated!What changes did you make? (Give an overview)
This PR disables the deprecated
valid-jsdoc
andrequire-jsdoc
core rules in favor of a series of (mostly) corresponding rules ineslint-plugin-jsdoc
. This should probably be a major release ofeslint-config-eslint
, as the behavior isn't entirely the same and I've added a few extra rules (please let me know if this isn't desired).New warnings:
It seems like these rules catch some
valid-jsdoc
false negatives and it's actually really nice that we can disable individual rules when we need to. I think it would also be nice to add the following rules in a future PR:Is there anything you'd like reviewers to focus on?
I'd appreciate some eyes on the changes that I've made in the comments themselves. Will try to preemptively leave comments for the rationale for these changes.