我正在尝试通过overrides在配置中设置来指定 ESLint 应检查的文件扩展名,而不是需要使用--ext命令行标志。该文件说:
\n\n默认情况下,ESLint 会检查文件以及与配置条目
\n*.js匹配的文件。overrides
的文档overrides说glob 模式files可以沿着 "src/*.js"or的行"**/*.js",并且这些与 ESLint 配置文件的基本目录相关。这些选项都不能让我使 ESLint 进程文件超出默认值*.js(在我的例子中*.jsx)。
这是我运行 ESLint 时的输出--ext:
scott@dev /home/scott/project (main)\n$ npx eslint --ext .js,.jsx ./src\n\n/home/scott/project/src/file.jsx\n 1:1 warning Unexpected console statement no-console\n\n\xe2\x9c\x96 1 problem (0 errors, 1 warning)\nRun Code Online (Sandbox Code Playgroud)\n正如预期的那样,它会产生警告。但如果没有--ext,ESLint 不会产生任何输出。
目录结构:
\n/home/scott/project/\n .eslintrc.js\n src/\n file.jsx\nRun Code Online (Sandbox Code Playgroud)\n.eslintrc.js:
scott@dev /home/scott/project (main)\n$ npx eslint --ext .js,.jsx ./src\n\n/home/scott/project/src/file.jsx\n 1:1 warning Unexpected console statement no-console\n\n\xe2\x9c\x96 1 problem (0 errors, 1 warning)\nRun Code Online (Sandbox Code Playgroud)\n我需要做什么?
\n| 归档时间: |
|
| 查看次数: |
4817 次 |
| 最近记录: |