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: Update jsdoc plugin and tweak rules in effect #14814
Conversation
I see this PR might need to wait on |
The engine upgrade won’t happen until the next major version (which will hopefully be soon). |
Made a number of mostly small, misc. changes. A few items/questions.
This rule requires that a reason be given for disabling the linting--something very helpful both to understand why there was some laxening, and to prevent wasted time of other devs on seeing if the disable directive could be removed. Let me know if you wish to enable this.
/**
* My function.
*
* @param {string} lorem Description.
* @param {int} sit Description multi words.
*/ but would instead insist on: /**
* My function.
*
* @param {string} lorem Description.
* @param {int} sit Description multi words.
*/
I went ahead and enabled this one, fixing 42 errors. Let me know if you want me to revert that commit. It can, of course, only detect when there is a
One additional change I prefer in my own projects (and currently commented out in the ESLint config) is to prohibit use of a plain In rarer cases, such as with a very general purpose utility, there may truly be no limits on the specific type of array, object, or function that may be returned, but in such cases, one can insist on a few types you might create Making this change will require a large amount of work, however (36, 398, and 54 fixes, respectively, just in this repo). I could disable this rule for now on the |
I've also added a commit for Unicorn, also with a good number of changes. |
Our challenge here is that we have a large amount of outside contributors, and we don’t want to put in too many rules that enforce things that aren’t auto fixable. That’s too discouraging for new or infrequent contributors. So checking alignment will be particularly annoying if it can’t be autofixed. If it can be autofixed, then let’s do it, but if not, I’d prefer not enforcing any type of alignment. The others seem like good ideas and I’d suggest doing those each as a separate PR so we can deal with any issues that come up in a more focused way. I’d also prefer we allow Object, Array, etc. I don’t really want a lot of energy spent on figuring out the correct type. Getting people to include JSDoc at all was really hard, I don’t want to throw up any more barriers than necessary |
…scard dot object type
This has been rebased, and I think is ready again for review now that |
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an 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:
What changes did you make? (Give an overview)
eslint-plugin-jsdoc
peer dependenciy ineslint-config-eslint
(and update as dev. dep. ineslint
).eslintrc.js
to disable rules that files with@example
would otherwise be wrongly flaggedplugin:jsdoc/recommended
(but switched toerror
's), add other helpful jsdoc rulesIs there anything you'd like reviewers to focus on?
jsdoc-type-pratt-parser
and disabling linter around a few TypeScript constructs which the parser is also awaiting support forfunction() : string
syntax is not TypeScript-based, so switched to that indicated by TS-
Note that I commented out the following jsdoc rules as they would have entailed more diff noise, and I wasn't sure if you wanted them, or how, but I do think they'd be good to enable:
jsdoc/check-indentation
- This and the next rule might add noise, and not sure you were consistent, but might be nice to enforce consistencyjsdoc/check-line-alignment
jsdoc/require-file-overview
- You have these in use already, but would need to confine to a directoryjsdoc/require-throws
- Should be useful to require denoting the types thrown by the function when athrow
is foundjsdoc/check-values
- This rule can enforce SPDX license identifiers; if ok, I could add the other text currently there to a@copyright
tag