|
| 1 | +module.exports = { |
| 2 | + root: true, |
| 3 | + env: { |
| 4 | + browser: true, |
| 5 | + node: true, |
| 6 | + es6: true, |
| 7 | + jest: true, |
| 8 | + }, |
| 9 | + parser: '@typescript-eslint/parser', |
| 10 | + parserOptions: { |
| 11 | + ecmaFeatures: { |
| 12 | + jsx: true, |
| 13 | + impliedStrict: true, |
| 14 | + }, |
| 15 | + ecmaVersion: 2020, |
| 16 | + sourceType: 'module', |
| 17 | + }, |
| 18 | + settings: { |
| 19 | + react: { |
| 20 | + version: 'detect', |
| 21 | + }, |
| 22 | + }, |
| 23 | + globals: { |
| 24 | + Atomics: 'readonly', |
| 25 | + SharedArrayBuffer: 'readonly', |
| 26 | + }, |
| 27 | + plugins: ['react', 'react-hooks', '@typescript-eslint'], |
| 28 | + // ESLint extends configurations recursively |
| 29 | + extends: [ |
| 30 | + 'plugin:react/recommended', |
| 31 | + 'plugin:react-hooks/recommended', |
| 32 | + 'plugin:@typescript-eslint/recommended', |
| 33 | + ], |
| 34 | + // 自定义规则,可以覆盖掉extends的配置,0-off,1-warn,2-error |
| 35 | + rules: { |
| 36 | + 'no-param-reassign': 1, |
| 37 | + 'no-invalid-this': 0, |
| 38 | + 'no-unused-vars': 0, |
| 39 | + 'no-empty': 1, |
| 40 | + 'no-var': 1, |
| 41 | + 'no-return-assign': 1, |
| 42 | + 'no-inner-declarations': 1, |
| 43 | + 'no-promise-executor-return': 1, |
| 44 | + 'no-eq-null': 1, |
| 45 | + eqeqeq: 1, |
| 46 | + 'one-var': 0, |
| 47 | + 'guard-for-in': 1, |
| 48 | + complexity: 1, |
| 49 | + 'prefer-const': 1, |
| 50 | + 'prefer-spread': 1, |
| 51 | + 'prefer-rest-params': 1, |
| 52 | + 'prefer-object-spread': 1, |
| 53 | + 'prefer-arrow-callback': 0, |
| 54 | + 'prefer-promise-reject-errors': 1, |
| 55 | + 'prefer-regex-literals': 0, |
| 56 | + radix: 1, |
| 57 | + 'max-nested-callbacks': 1, |
| 58 | + 'max-params': 1, |
| 59 | + 'accessor-pairs': 0, |
| 60 | + 'import/order': 0, |
| 61 | + 'react/no-find-dom-node': 1, |
| 62 | + 'react/no-deprecated': 1, |
| 63 | + 'react/no-did-update-set-state': 1, |
| 64 | + 'react/no-unescaped-entities': 1, |
| 65 | + 'react/jsx-no-constructed-context-values': 1, |
| 66 | + 'react/prop-types': 0, |
| 67 | + 'react/display-name': 0, |
| 68 | + 'react/prefer-es6-class': 0, |
| 69 | + 'react/sort-comp': 0, |
| 70 | + 'react/react-in-jsx-scope': 0, |
| 71 | + 'react/jsx-no-useless-fragment': 1, |
| 72 | + 'react/jsx-key': 1, |
| 73 | + 'react/jsx-uses-react': 0, |
| 74 | + 'react/jsx-fragments': 0, |
| 75 | + 'react/jsx-curly-brace-presence': 1, |
| 76 | + 'react-hooks/rules-of-hooks': 2, |
| 77 | + 'react-hooks/exhaustive-deps': 1, |
| 78 | + 'react/self-closing-comp': 1, |
| 79 | + '@typescript-eslint/no-explicit-any': 0, |
| 80 | + '@typescript-eslint/no-unused-vars': 0, |
| 81 | + '@typescript-eslint/no-empty-interface': 0, |
| 82 | + '@typescript-eslint/no-empty-function': 0, |
| 83 | + '@typescript-eslint/no-non-null-assertion': 0, |
| 84 | + '@typescript-eslint/no-invalid-this': 0, |
| 85 | + '@typescript-eslint/no-var-requires': 1, |
| 86 | + '@typescript-eslint/no-require-imports': 1, |
| 87 | + '@typescript-eslint/no-invalid-void-type': 1, |
| 88 | + '@typescript-eslint/no-inferrable-types': 0, |
| 89 | + '@typescript-eslint/ban-types': 1, |
| 90 | + '@typescript-eslint/prefer-for-of': 0, |
| 91 | + '@typescript-eslint/prefer-optional-chain': 0, |
| 92 | + '@typescript-eslint/prefer-function-type': 0, |
| 93 | + '@typescript-eslint/consistent-type-assertions': 0, |
| 94 | + '@typescript-eslint/method-signature-style': 0, |
| 95 | + '@typescript-eslint/explicit-function-return-type': 0, |
| 96 | + '@typescript-eslint/explicit-member-accessibility': 0, |
| 97 | + '@typescript-eslint/member-ordering': 0, |
| 98 | + '@typescript-eslint/consistent-type-definitions': 0, |
| 99 | + '@typescript-eslint/class-literal-property-style': 0, |
| 100 | + '@typescript-eslint/explicit-module-boundary-types': 0, |
| 101 | + }, |
| 102 | +}; |
0 commit comments