-
-
Notifications
You must be signed in to change notification settings - Fork 30
New: Add new rule require-meta-has-suggestions
#105
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
New: Add new rule require-meta-has-suggestions
#105
Conversation
ce40169
to
2913ed8
Compare
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.
just a suggestion, but otherwise lgtm, thanks!
contextIdentifiers = utils.getContextIdentifiers(context, node); | ||
}, | ||
CallExpression (node) { | ||
if ( |
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 could be simple to use selectors and the util: https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/a3017e253db08630da3f92428df6f4f2680ecf12/lib/utils.js#L257 . :)
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.
Will look into this.
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 if it's convenient to use selectors here since we have a variable contextIdentifiers
in the condition.
I have moved this PR to draft status pending the outcome of this issue eslint/eslint#14312 to discuss the future of the |
require-meta-docs-suggestion
require-meta-has-suggestions
Suggestable ESLint rules should have a `meta.hasSuggestions` property to indicate that they provide [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions). This new rule enforces that the `meta.hasSuggestions` property is correctly enabled when a rule provides suggestions, and not enabled when a rule does not provide suggestions. The change to require suggestable rules to have `meta.hasSuggestions` has been accepted and mentioned in the blog post for the upcoming ESLint 8 breaking changes. So we should adopt this change now to help plugin authors ensure they are compatible with ESLint 8 as soon as possible. The old property `meta.docs.suggestion` was unused anyway. https://eslint.org/blog/2021/06/whats-coming-in-eslint-8.0.0#rules-with-suggestions-now-require-the-metahassuggestions-property This is very similar to the existing [eslint-plugin/require-meta-fixable](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/require-meta-fixable.md) rule enforcing the correct presence of the `meta.fixable` property.
971aa26
to
54cf3d3
Compare
Now that the |
require-meta-has-suggestions
require-meta-has-suggestions
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! 💯
Suggestable ESLint rules should have a
meta.hasSuggestions
property to indicate that they provide suggestions. This new rule enforces that themeta.hasSuggestions
property is correctly enabled when a rule provides suggestions, and not enabled when a rule does not provide suggestions.The change to require suggestable rules to have
meta.hasSuggestions
has been accepted and mentioned in the blog post for the upcoming ESLint 8 breaking changes. So we should adopt this change now to help plugin authors ensure they are compatible with ESLint 8 as soon as possible. The old propertymeta.docs.suggestion
was unused anyway.https://eslint.org/blog/2021/06/whats-coming-in-eslint-8.0.0#rules-with-suggestions-now-require-the-metahassuggestions-property
We should make this a
recommended
rule in the next major release.This is very similar to the existing eslint-plugin/require-meta-fixable rule enforcing the correct presence of the
meta.fixable
property.