Node.js eslint src/**--修复程序找不到任何匹配项
我使用Node.js eslint src/**--修复程序找不到任何匹配项,node.js,eslint,Node.js,Eslint,我使用npm I-g ESLint 在另一个SO线程中,我发现需要向CLI传递一个path参数,以便使用--fix(它本身无法工作) src肯定在那里,有趣的是,文件夹classes是src的子文件夹,尽管我没有明确提到它 owner@G700:~/cp/foreignSentenceRepeater$ ls audioCourse node_modules sentences.txt compiled package.json
npm I-g ESLint
在另一个SO线程中,我发现需要向CLI传递一个path参数,以便使用--fix
(它本身无法工作)
src
肯定在那里,有趣的是,文件夹classes
是src
的子文件夹,尽管我没有明确提到它
owner@G700:~/cp/foreignSentenceRepeater$ ls
audioCourse node_modules sentences.txt
compiled package.json silences
configuration.json package-lock.json src
googleCredentials.json readme.md tsconfig.json
有人知道错误是什么吗
更新1
有评论建议尝试本地安装:
owner@G700:~/cp/foreignSentenceRepeater$ npm i -D eslint
npm WARN foreign_sentence_repeater@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ eslint@7.4.0
updated 1 package and audited 919 packages in 14.824s
40 packages are looking for funding
run `npm fund` for details
found 4695 vulnerabilities (4693 low, 2 high)
run `npm audit fix` to fix them, or `npm audit` for details
owner@G700:~/cp/foreignSentenceRepeater$ node_modules/eslint/bin/eslint.js src/** --fix
Oops! Something went wrong! :(
ESLint: 7.4.0
No files matching the pattern "src/classes" were found.
Please check for typing mistakes in the pattern.
正如在前面的评论中所提到的,我被教导最好将软件包作为开发依赖项安装,以防您打算进行校准。根据您的命令,您可以尝试:
npm run -- --fix
但最好将其作为脚本运行,例如:
"scripts": {
"fixer":"eslint --fix --ext .ts ."
}
"scripts": {
"fixer":"eslint --fix --ext .ts ."
}