[英]Is it possible to show warnings instead of errors on ALL of eslint rules?
As the title says, would it be possible for eslint to show warnings instead of errors on ALL of the rules?正如标题所说,eslint 是否有可能在所有规则上显示警告而不是错误? I'm using Standard JS, if that information is relevant.
如果该信息相关,我正在使用标准 JS。
Thanks!谢谢!
I think there's no out-of-the-box option right now, but maybe you could use a plugin to achieve that: Eslint plugin only warn我认为现在没有开箱即用的选项,但也许你可以使用插件来实现: Eslint plugin only warn
Or set all the rules as warning instead of errors.或者将所有规则设置为警告而不是错误。
Following es-lint-plugin-prettier readme , edit your .eslintrc.json
and put a specific rule for prettier
:按照es-lint-plugin-prettier 自述文件,编辑您的
.eslintrc.json
并为prettier
设置特定规则:
"rules": {
// maybe your other rules...
"prettier/prettier": "warn"
}
Then, prettier
rules will be issued as warnings instead of errors.然后,
prettier
的规则将作为警告而不是错误发出。
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
.不确定所有的副作用,但它似乎适用于我的项目,我也使用
@typescript-eslint/eslint-plugin
、 @typescript-eslint/parser
、 eslint-config-prettier
prettier 和eslint-plugin-prettier
。
If it helps, my extends
config in .eslintrc.json
:如果有帮助,我在
.eslintrc.json
中extends
配置:
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
You can create an .eslintrc
file with all the rules set to "warn"
您可以创建一个
.eslintrc
文件,并将所有规则设置为"warn"
If you already have an eslintrc file you can use that, or extend from a rules file such as the one here .如果你已经有一个 eslintrc 文件,你可以使用它,或者从一个规则文件扩展,比如这里的文件。 In this one, all the rules are set to
0
(disabled).在这一项中,所有规则都设置为
0
(禁用)。 You can modify specific ones or all of them and set them to 1
(or "warn"
)您可以修改特定的或全部并将它们设置为
1
(或"warn"
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.