Allow omitting specific rules from fix
See original GitHub issueI am aware #208 was already closed, however since then a specific API for filtering rules from being fixed was added to CLIEngine
https://eslint.org/docs/developer-guide/nodejs-api#cliengine .
One of the pain points with the solution in #208 is that the no-autofix
plugin requires adding it into every project specifically and only supports the builtin rules.
I’d like to propose again supporting an eslint.rulesToDisableWhileFixing
option that takes a list of options. The vscode-eslint
could then use this list like so:
newOptions.fix = function({ ruleId }) {
if (!pluginOptions.rulesToDisableWhileFixing) {
return true;
}
return !pluginOptions.rulesToDisableWhileFixing.includes(ruleId);
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Turning off eslint rule for a specific file - Stack Overflow
1) Disabling "All rules" · You can go with 1.2 and add /* eslint-disable */ on top of the files, one by one....
Read more >Listener rules for your Application Load Balancer
Each rule must include exactly one of the following actions: forward , redirect , or fixed-response , and it must be the last...
Read more >Rule 60. Relief from a Judgment or Order - Law.Cornell.Edu
Two types of procedure to obtain relief from judgments are specified in the rules as it is proposed to amend them. One procedure...
Read more >Ignoring code - Stylelint
stylelint-disable */ a {} /* stylelint-enable */. Or you can turn off individual rules: /* stylelint-disable selector-max-id, declaration-no-important */
Read more >Command Line Interface - ESLint - Pluggable JavaScript Linter
Options that accept multiple values can be specified by repeating the option or ... Deprecated: Use rules from plugins Fix problems: --fix Automatically...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Another idea for a possible implementation. Instead of specifying rules to disable for autofixing, how about specifying a path to a separate ESLint config? You get a lot more control over how you want your autofixes applied then (more than just disabling specific rules). Something like:
Alternatively as an even more flexible option it might be a possibility to treat
eslint.options.fix
as a function body if it happens to be a string e.g.:Then in
settings.json
one could do:Or maybe just
eval
the'fix'
option to get a function: