Eslint 在终端上工作,但在编辑器 UI (VSCode) 中没有显示错误

Kar*_*ren 10 javascript eslint visual-studio-code eslint-config-airbnb eslintrc

我已经按照以下步骤安装了 ESlint:https ://travishorn.com/setting-up-eslint-on-vs-code-with-airbnb-javascript-style-guide-6eb78a535ba6

现在,我的 ESlint 正在终端工作,但代码窗口中没有显示错误/警告,这是我的项目结构及其外观:

终端

和我的eslintrc配置:

module.exports = {
  env: {
    browser: true,
    commonjs: true,
    es6: true,
    node: true,
  },
  extends: [
    'airbnb-base',
  ],
  globals: {
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly',
  },
  parserOptions: {
    ecmaVersion: 2018,
  },
  rules: {
  },
};
Run Code Online (Sandbox Code Playgroud)

为什么它不能在编辑器中显示错误?

rad*_*and 13

我最近遇到了这个问题,并通过将我的.eslintrc.js文件更改为.eslintrc(仅 JSON 对象,无注释,所有内容都引用正确,无扩展名)来修复它。重新启动 VSCode 后,它正确地获取了该文件,并在 VSCode 中给出了 linter 错误。


小智 6

对我来说这是工作!

设置.json添加这个

"eslint.validate": [
    "vue",
    "html",
    "javascript",
    "typescript",
    "javascriptreact",
    "typescriptreact"
]
Run Code Online (Sandbox Code Playgroud)

https://linuxpip.org/eslint-not-working-in-vscode/