gpt4 book ai didi

javascript - eslint 没有根据 .eslintrc 文件中的规则在 VSCode 中给出错误

转载 作者:行者123 更新时间:2023-12-01 15:10:09 33 4
gpt4 key购买 nike

我已经使用 npm 全局安装了 eslint,并添加了自己的 .eslintrc 文件,其中包含以下代码:

{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}

我添加了以下开发依赖项:
"eslint": "3.19.0",
"eslint-config-standard": "10.2.1",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-markdown": "1.0.0-beta.6",
"eslint-plugin-node": "5.1.1",
"eslint-plugin-promise": "3.5.0",
"eslint-plugin-standard": "3.0.1"

并且还安装了 eslint-plugin-react在我的 react 原生项目中。
尽管显示了解析错误,但仍然没有显示缩进、分号、双引号错误。
附: eslint 插件在 VScode 中启用。

最佳答案

完全相同的事情发生在我身上。我通过查看 Eslint 日志发现了这个问题的原因:

  • 通过 Ctrl + Shift + P 打开命令面板
  • 选择 Eslint: Show Output Channel

  • 就我而言,输出 channel 显示如下: Failed to load config "airbnb-base" to extend from. Referenced from: ...eslintrc.js
    我只是忘了做 npm install添加开发依赖项后!

    关于javascript - eslint 没有根据 .eslintrc 文件中的规则在 VSCode 中给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53557830/

    33 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com