【发布时间】:2021-10-20 19:23:17
【问题描述】:
我想在没有 node_modules 的情况下运行 lint 检查所有文件 *.js
这是我的命令:"lint": "eslint **/*.js",,我的文件夹结构看起来像:app > module_name > module.js,但在 app 文件夹中仍然有一些常见的文件,如 helpers.jsserver.js,我也想检查它们。
在 .eslint 配置中,我添加了 "ignorePatterns": "node_modules" 并尝试添加文件 .eslintignore 并添加 node_modules 但它不起作用。
当我运行npm run lint 时,它总是抛出错误:
Oops! Something went wrong! :(
ESLint: 7.32.0
You are linting "node_modules/bignumber.js", but all of the files matching the glob pattern "node_modules/bignumber.js" are ignored.
If you don't want to lint these files, remove the pattern "node_modules/bignumber.js" from the list of arguments passed to ESLint.
If you do want to lint these files, try the following solutions:
* Check your .eslintignore file, or the eslintIgnore property in package.json, to ensure that the files are not configured to be ignored.
* Explicitly list the files from this glob that you'd like to lint on the command-line, rather than providing a glob as an argument.
【问题讨论】: