报错信息
解决方法
1. 在 plugins 添加相应规矩的检查插件
2. 在 rules 中添加 eslint 检查规则
3. off 表示关闭该项检查,warn 表示将报错调整为警告
module.exports = {
env: {
browser: true,
commonjs: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
},
settings: {
react: { version: 'detect' },
},
plugins: ['react', 'react-hooks', '@typescript-eslint'],
rules: {
'react/prop-types': 'off',
'no-unsafe-finally': 'off',
'no-plusplus': 'off',
'no-constant-condition': 'off',
'no-unsafe-optional-chaining': 'off',
'no-constant-condition': 'off',
'no-param-reassign': 'off',
'react/jsx-key': 'off',
'react/display-name': 'off',
'react-hooks/exhaustive-deps': 'warn',
'prefer-const': 'warn',
'no-var': 'warn',
'no-empty': 'warn',
'no-empty-pattern': 'warn',
},
};