简体   繁体   English

Eslint: --fix 未根据 .eslintrc 规则解决警告

[英]Eslint: --fix not resolving warnings according to .eslintrc rules

I am trying to auto-fix issues in my js file using我正在尝试使用自动修复我的 js 文件中的问题

eslint --fix -c "/path/to/.eslintrc" <file-name.js>

but with no success.但没有成功。 Went through Eslint Rules .经历了Eslint 规则 I have to fix "no-undef" & "no-unused-vars" using the command, but it still not works.我必须使用命令修复“no-undef”和“no-unused-vars”,但它仍然不起作用。

ESLint --fix will fix everything that it can fix, but in many cases won't be able to automatically follow every rule. ESLint --fix将修复它可以修复的所有内容,但在许多情况下无法自动遵循每条规则。

Rules that can be taken care of with --fix can be found in the rules documentation - they'll have a wrench icon next to the rule name.可以使用--fix规则可以在规则文档中找到 - 它们将在规则名称旁边有一个扳手图标。

Looks like the no-undef and no-unused-vars rules don't, so you'll have to manually comb through the warnings and manually modify the code.看起来no-undefno-unused-vars规则没有,所以你必须手动梳理警告并手动修改代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM