我是 Eslint 的新手。
到目前为止,我已经在本地项目中安装了 Eslint 并进行了配置。 eslintrc.js 文件包含
module.exports = {
env: {
node: true,
commonjs: true,
es6: true,
mocha: true,
},
extends: [
'airbnb-base',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parserOptions: {
ecmaVersion: 2018,
},
rules: {
},
};
在 package.json 中我有
"scripts": {
"lint": "eslint .eslintrc.js --fix",
}
在终端我运行
npm run lint
输出是
> [email protected] /cdn-cgi/l/email-protection lint C:\nodeprojects\restapi
> eslint .eslintrc.js --fix
C:\nodeprojects\restapi\.eslintrc.js
0:0 warning File ignored by default. Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override
但如果我跑
eslint <foldername> --fix
然后就可以了。
我在 Windows 操作系统中使用 webstorm IDE。
非常感谢任何帮助。