Visual Studio Code:无法将 ESLint 修复应用到文档

Evg*_*sov 2 javascript eslint visual-studio-code linter

我使用的是 Visual Studio Code 1.6.1,安装并启用了最新版本的 ESLint 扩展。我有

"eslint.options": {
  "rules": {
    ...
  }
}
Run Code Online (Sandbox Code Playgroud)

在我的 vs-code 用户设置中。我能够使用自动命令“eslint.executeAutofix”自动修复我的 js 文件,但是从我上次更新 vs-code 开始,我收到以下错误:

Failed to apply ESLint fixes to the document. Please consider opening an issue with steps to reproduce.
Run Code Online (Sandbox Code Playgroud)

有人可以帮助我或指出我可以解决此问题的方向吗?

Pav*_*vel 7

对于遇到相同问题的任何人。要进行故障排除,请尝试运行npx eslint path/to/your/file以查看实际的 eslint 输出。

就我而言,它缺少 Prettier 插件:

Failed to load plugin 'prettier' declared in '.eslintrc.js » @react-native-community/eslint-config': Cannot find module 'eslint-plugin-prettier'


Evg*_*sov 0

不知何故 npm install eslint --save-dev 解决了这个问题。现在,即使在 npm uninstall eslint --save-dev 之后它仍然可以工作。奇怪的...