Muh*_*mer 8 visual-studio-code vscode-eslint
尽管在 esignore 中明确指出我想忽略 lib 目录中的所有内容,但 vscode 说在该最小化文件中发现了 9 个问题。
如果我在命令行中的foldera内运行eslint一切都很好
使用此扩展
我的目录结构:
foldera/
.eslintrc
.eslintignore
src/
file.js
lib/
wantoignore.min.js
folderb/
morefiles.js
.eslintrc
.eslintignore
Run Code Online (Sandbox Code Playgroud)
.eslintrc 文件
{
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2017,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
},
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"no-console": "off"
}
}
Run Code Online (Sandbox Code Playgroud)
.eslintignore
lib/*
Run Code Online (Sandbox Code Playgroud)
工作区设置:
"eslint.workingDirectories": [
"./client", "./server"
]
Run Code Online (Sandbox Code Playgroud)
小智 7
我按照这里的官方文档解决了这个问题。
基本上,您需要将以下内容添加到 vscode 工作区设置(通常位于项目的root/.vscode/settings.json)中,以便 vscode 知道在您处理特定脚本文件时要遵循哪些配置:
{
"eslint.workingDirectories": [ "./reactApp" ],
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6985 次 |
| 最近记录: |