Kev*_*Ham 5 javascript eslintrc
我想指定要在 eslintrc.js 中检查哪些文件,因此我添加了文件:...
module.exports = {
extends: [
'react-app',
'react-app/jest',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
files: ['*.ts', '*.jsx', '*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
'testing-library/no-node-access': 'off',
},
};
Run Code Online (Sandbox Code Playgroud)
但是当我的预提交运行时出现以下错误:
precommit: BABEL_ENV=development eslint src --ext .js,.jsx,.ts,.tsx --fix'*.ts', '*.tsx'
Error: ESLint configuration in .eslintrc.js is invalid:
- Unexpected top-level property "files".
Run Code Online (Sandbox Code Playgroud)
--ext
根据您的命令行选项(等),顶级规则和配置适用于所有匹配的文件
仅当您想要指定覆盖适用于哪些文件时,才可以使用"files"
内部嵌套块。"overrides"
请参阅https://eslint.org/docs/latest/user-guide/configuring/configuration-files#how-do-overrides-work
归档时间: |
|
查看次数: |
7983 次 |
最近记录: |