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: add jsdoc type annotation to rules #15291
Conversation
b47d925
to
a39a99e
Compare
It seems like we should be using our own type definition: |
That should work too, updated. The internal |
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
FYI: I have added a test to ensure this jsdoc comment is present in each rule file. Otherwise, it would be easily forgotten when adding new rules. |
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
[X] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Adds jsdoc
type
annotation to core rules.Supported by VSCode/Webstorm/other code editors. Uses TypeScript declaration to give JavaScript hints so code editors can provide information/autocomplete about various rule fields.
https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#type
Idea from: eslint/generator-eslint#113
We also have this suggested in our "Working with Rules" guide: https://eslint.org/docs/developer-guide/working-with-rules
Uses single-line version of this comment since there's no need for it to take up additional space.
Is there anything you'd like reviewers to focus on?
No.