-
-
Notifications
You must be signed in to change notification settings - Fork 82
New: Allow plugins to define rule replacements #77
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| - Repo: eslint/eslint, eslint/eslintrc | ||
| - Start Date: 2021-01-23 | ||
| - RFC PR: (to be filled in) | ||
| - Authors: mykhalov | ||
|
|
||
| # Allow plugins to define rule replacements | ||
|
|
||
| ## Summary | ||
|
|
||
| Provide better error message for removed rules by allowing plugins to define rule replacements. | ||
|
|
||
| ## Motivation | ||
|
|
||
| ESLint provides great developer experience around removed rules: | ||
|
|
||
| ``` | ||
| 1:1 error Rule 'generator-star' was removed and replaced by: generator-star-spacing generator-star | ||
| ``` | ||
|
|
||
| Until now this hasn't been the case with plugins: | ||
|
|
||
| ``` | ||
| 1:1 error Definition for rule '@typescript-eslint/camelcase' was not found @typescript-eslint/camelcase | ||
| ``` | ||
|
|
||
| Although `@typescript-eslint/camelcase` [has been removed in favour of another rule](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/camelcase.md), there is no way for the plugin to explain this. | ||
|
|
||
| ## Detailed Design | ||
|
|
||
| When reading plugin definition, look for `"replacements"` property next to `"rules"`: | ||
|
|
||
| ``` | ||
| module.exports = { | ||
| rules, | ||
| replacements: { | ||
| rules: { | ||
| foo: ['bar'] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| If exists, propagate this property to error reporting. When constructing error message, look into plugin replacements before looking into to ESLint replacements. | ||
|
|
||
| ## Documentation | ||
|
|
||
| This should be documented in [Developer Guide](https://eslint.org/docs/developer-guide/working-with-plugins). | ||
|
|
||
| ## Drawbacks | ||
|
|
||
| None at the moment. | ||
|
|
||
| ## Backwards Compatibility Analysis | ||
|
|
||
| No effect on backwards compatibility. | ||
|
|
||
| ## Alternatives | ||
|
|
||
| None at the moment. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There’s really no other alternatives? What about plug-ins themselves continuing to ship a rule that always reports that the rule is replaced by another rule? |
||
|
|
||
| ## Open Questions | ||
|
|
||
| None at the moment. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. None? |
||
|
|
||
| ## Help Needed | ||
|
|
||
| None at the moment. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean you already know how to implement this change? |
||
|
|
||
| ## Frequently Asked Questions | ||
|
|
||
| None at the moment. | ||
|
|
||
| ## Related Discussions | ||
|
|
||
| Adding deprecation message to ESLint itself ([#1549](https://github.com/eslint/eslint/issues/1549)). | ||
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.
This section should explain how you plan to implement this. Please look at the ESLint code and figure out which files would need to change. There are plenty of examples of already-merged RFCs in this repo to see what is expected.