gpt4 book ai didi

visual-studio-code - 在通过 Yarn 管理的 VSCode 中使用自定义 eslint 配置文件

转载 作者:行者123 更新时间:2023-12-04 15:30:00 25 4
gpt4 key购买 nike

我在 VSCode 中安装并运行了 eslint,但它没有使用我们的配置文件。

我改变的设置是

{
"eslint.nodePath": "C:\\Users\\PARAGON\\Documents\\AllCode\\ParagonCore\\clients\\utilities\\paragon-scripts\\node_modules",
"eslint.options": {
"configFile": "C:\\Users\\PARAGON\\Documents\\AllCode\\ParagonCore\\clients\\utilities\\paragon-scripts\\configuration\\.eslintrc.js",
},
"eslint.packageManager": "yarn",
}

更新:

修改 nodePath 和修复文件路径错误
[Info  - 12:30:26 PM] ESLint library loaded from: 
C:\Users\PARAGON\AppData\Local\Yarn\config\global\node_modules\eslint\lib\api.js
[Error - 12:30:26 PM] Cannot read config file: C:\Users\PARAGON\Documents\AllCode\Paragon\ParagonCore\clients\utilities\paragon-scripts\configuration\.eslintrc.js Error: Cannot find module 'C:\Users\PARAGON\Documents\AllCode\Paragon\ParagonCore\clients\utilities\paragon-scripts\configuration\.eslintrc.js'
[Error - 12:32:56 PM]
Failed to load plugin react: Cannot find module 'eslint-plugin-react'
Happened while validating C:\Users\PARAGON\Documents\AllCode\ParagonCore\clients\job-grid\source\scripts\components\AssignToUser.jsx
This can happen for a couple of reasons:
1. The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc).
2. If ESLint is installed globally, then make sure 'eslint-plugin-react' is installed globally as well.
3. If ESLint is installed locally, then 'eslint-plugin-react' isn't installed correctly.

Consider running eslint --debug C:\Users\PARAGON\Documents\AllCode\ParagonCore\clients\job-grid\source\scripts\components\AssignToUser.jsx from a terminal to obtain a
trace about the configuration files used.
Failed to load plugin react: Cannot find module 'eslint-plugin-react'
Happened while validating C:\Users\PARAGON\Documents\AllCode\ParagonCore\clients\job-grid\source\scripts\components\controls\CreateJob.jsx
This can happen for a couple of reasons:
1. The plugin name is spelled incorrectly in an ESLint configuration file
(e.g. .eslintrc).
2. If ESLint is installed globally, then make sure 'eslint-plugin-react' is
installed globally as well.
3. If ESLint is installed locally, then 'eslint-plugin-react' isn't installed correctly.

Consider running eslint --debug
C:\Users\PARAGON\Documents\AllCode\ParagonCore\clients\job-
grid\source\scripts\components\controls\CreateJob.jsx from a terminal to
obtain a trace about the configuration files used.

最佳答案

首先,请确保您没有全局安装该软件包。然后,设置 "eslint.nodePath"到您的位置 node_modules与配置目录平行的目录。

  • yarn global remove eslint
  • "eslint.nodePath": "C:/.../node_modules"
  • 打开一些文件并在输出窗口中查找“ESLint 库加载自:”
  • 关于visual-studio-code - 在通过 Yarn 管理的 VSCode 中使用自定义 eslint 配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49243971/

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