Skip to content
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

Merged
merged 17 commits into from Sep 29, 2019
Merged

Conversation

kaicataldo
Copy link
Member

@kaicataldo kaicataldo commented Sep 28, 2019

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 in eslint-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 and require-jsdoc core rules in favor of a series of (mostly) corresponding rules in eslint-plugin-jsdoc. This should probably be a major release of eslint-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.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Sep 28, 2019
@kaicataldo kaicataldo changed the title Eslint plugin jsdoc Chore: enable eslint-plugin-jsdoc Sep 28, 2019
@@ -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.
Copy link
Member Author

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).
Copy link
Member Author

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
Copy link
Member Author

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 */
Copy link
Member Author

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
Copy link
Member Author

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}
Copy link
Member Author

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.
Copy link
Member Author

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.

@kaicataldo kaicataldo added chore This change is not user-facing and removed triage An ESLint team member will look at this issue soon labels Sep 28, 2019
Copy link
Member

@platinumazure platinumazure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@kaicataldo kaicataldo changed the title Chore: enable eslint-plugin-jsdoc Chore: enable eslint-plugin-jsdoc (refs #11146) Sep 29, 2019
@kaicataldo
Copy link
Member Author

I'm not sure why the commit-message check is failing - it looks like it should accept refs.

@platinumazure platinumazure changed the title Chore: enable eslint-plugin-jsdoc (refs #11146) Chore: enable eslint-plugin-jsdoc (refs #11146) Sep 29, 2019
@platinumazure platinumazure changed the title Chore: enable eslint-plugin-jsdoc (refs #11146) Chore: enable eslint-plugin-jsdoc (refs #11146) Sep 29, 2019
Copy link
Member

@mysticatea mysticatea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@mysticatea mysticatea changed the title Chore: enable eslint-plugin-jsdoc (refs #11146) Chore: enable eslint-plugin-jsdoc (refs #11146) Sep 29, 2019
@mysticatea mysticatea merged commit 04b6adb into master Sep 29, 2019
@mysticatea mysticatea deleted the eslint-plugin-jsdoc branch September 29, 2019 03:19
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Mar 29, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants