问题
As the title says, would it be possible for eslint to show warnings instead of errors on ALL of the rules? I'm using Standard JS, if that information is relevant.
Thanks!
回答1:
I think there's no out-of-the-box option right now, but maybe you could use a plugin to archieve that: Eslint plugin only warn
Or set all the rules ar warning instead of errors.
回答2:
Following es-lint-plugin-prettier readme, edit your .eslintrc.json
and put a specific rule for prettier
:
"rules": {
// maybe your other rules...
"prettier/prettier": "warn"
}
Then, prettier
rules will be issued as warnings instead of errors.
Not sure of all the side effects, but it seems to work ok for my project, where I also use @typescript-eslint/eslint-plugin
, @typescript-eslint/parser
, eslint-config-prettier
and eslint-plugin-prettier
.
If it helps, my extends
config in .eslintrc.json
:
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
回答3:
You can create an .eslintrc
file with all the rules set to "warn"
If you already have an eslintrc file you can use that, or extend from a rules file such as the one here. In this one, all the rules are set to 0
(disabled). You can modify specific ones or all of them and set them to 1
(or "warn"
)
来源:https://stackoverflow.com/questions/50705508/is-it-possible-to-show-warnings-instead-of-errors-on-all-of-eslint-rules