Skip to content

Chore: enable eslint-plugin-jsdoc (refs #11146)#12332

Merged
mysticatea merged 17 commits intomasterfrom
eslint-plugin-jsdoc
Sep 29, 2019
Merged

Chore: enable eslint-plugin-jsdoc (refs #11146)#12332
mysticatea merged 17 commits intomasterfrom
eslint-plugin-jsdoc

Conversation

@kaicataldo
Copy link
Copy Markdown
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
* @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
Copy Markdown
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.

/**
* 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
Copy Markdown
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.

/**
* Creates a new instance of the core CLI engine.
* @param {CLIEngineOptions} providedOptions The options for this instance.
* @constructor
Copy link
Copy Markdown
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.

}

/* eslint-disable valid-jsdoc */
/* eslint-disable jsdoc/check-param-names, jsdoc/require-param */
Copy link
Copy Markdown
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!

Comment thread lib/init/config-rule.js
* configuration or options.
*
* @typedef {array|number} ruleConfig
* @typedef {Array|number} ruleConfig
Copy link
Copy Markdown
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.

Comment thread lib/init/config-rule.js
/**
* Stored valid rule configurations for this instance
* @type {array}
* @type {Array}
Copy link
Copy Markdown
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.


/**
* Returns the path inside of the fixture directory.
* @param {...string} args file path segments.
Copy link
Copy Markdown
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
Comment thread tests/lib/cli-engine/_utils.js
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

3 participants