Stack Overflow Asked by chevybow on November 27, 2021
I want to be able to disable the rules that –fix fixes when running eslint in a console for a repo. The reason for this is because –fix leads to undesirable behavior for our jsdoc eslint rules. It creates invalid or sometimes empty jsdoc in our project- which typically leads to even more eslint rules (due to our configuration) and leads to tons of manual fixing or removal.
I want to just run –fix without it touching any jsdoc rules so that I can complete jsdoc manually- while eslint fixes all the rest of the rules.
I came across this SO question- but package mentioned in the answer does not support non-core plugins.
Is there anything I can do short of modifying my eslintrc file every time I run the linter or using vscode for linting and modifying the config for the web editor instead? Its not a big deal for newer files- but linting legacy files is a chore when there’s hundreds of spacing errors that I can’t automatically fix easily.
Ok here’s another idea. Convert you .eslinrc
file into .eslintrc.js
. This will allow you to programmatically set eslint config.
Then you could use the commander library to detect the —fix
flag and set a Boolean to determine which eslint rules you would like to disable.
Answered by David Bradshaw on November 27, 2021
Technically, that already exists, right? If a user wants to avoid auto-fixing a particular rule, they can use:
eslint somedir --fix --rule "somerule: 0"
Or, if they want to whitelist a set of rules, they can use &nbps --no-eslintrc
and specify rules directly or use --config
and point to a particular config that they want to use for fixes.
Answered by Tharindu Vindula on November 27, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP