|
1 |
| -module.exports = { |
2 |
| - env: { |
3 |
| - es6: true, |
4 |
| - jest: true, |
5 |
| - node: true, |
6 |
| - }, |
7 |
| - extends: [ |
8 |
| - "airbnb", |
9 |
| - "prettier", |
10 |
| - "prettier/@typescript-eslint", |
11 |
| - "prettier/react", |
12 |
| - ], |
13 |
| - globals: { |
14 |
| - Atomics: "readonly", |
15 |
| - SharedArrayBuffer: "readonly", |
16 |
| - }, |
17 |
| - parser: "babel-eslint", |
18 |
| - |
19 |
| - parserOptions: { |
20 |
| - ecmaVersion: 2020, |
21 |
| - ecmaFeatures: { |
22 |
| - jsx: true, |
23 |
| - classes: true, |
24 |
| - }, |
25 |
| - }, |
26 |
| - plugins: ["react", "jsx-a11y", "import", "jest", "react-hooks"], |
27 |
| - rules: { |
28 |
| - "arrow-body-style": 0, |
29 |
| - "class-methods-use-this": 0, |
30 |
| - "consistent-return": 0, |
31 |
| - "comma-dangle": 0, |
32 |
| - "dot-notation": 0, |
33 |
| - "func-names": 0, |
34 |
| - "guard-for-in": 0, |
35 |
| - "import/extensions": 0, |
36 |
| - "import/no-extraneous-dependencies": 0, |
37 |
| - "import/no-unresolved": 0, |
38 |
| - "import/prefer-default-export": 0, |
39 |
| - "max-len": 0, |
40 |
| - "no-alert": 0, |
41 |
| - "no-console": 0, |
42 |
| - "no-param-reassign": 0, |
43 |
| - "no-plusplus": 0, |
44 |
| - "no-restricted-globals": 1, |
45 |
| - "no-restricted-syntax": 0, |
46 |
| - "no-shadow": 0, |
47 |
| - "no-undef": 0, |
48 |
| - "no-unused-vars": 0, |
49 |
| - "no-use-before-define": 0, |
50 |
| - "no-useless-constructor": 0, |
51 |
| - "no-underscore-dangle": 0, |
52 |
| - "no-unused-expressions": 0, |
53 |
| - "no-return-assign": 0, |
54 |
| - "prefer-const": 1, |
55 |
| - "prefer-destructuring": 0, |
56 |
| - "prefer-template": 0, |
57 |
| - "react/button-has-type": 0, |
58 |
| - "react/destructuring-assignment": 0, |
59 |
| - "react/forbid-prop-types": 0, |
60 |
| - "react/jsx-filename-extension": 0, |
61 |
| - "react/jsx-no-duplicate-props": 0, |
62 |
| - "react/no-access-state-in-setstate": 0, |
63 |
| - "react/no-array-index-key": 0, |
64 |
| - "react/no-did-update-set-state": 0, |
65 |
| - "react/no-unused-state": 0, |
66 |
| - "react/prefer-stateless-function": 0, |
67 |
| - "react/sort-comp": [ |
68 |
| - 2, |
69 |
| - { |
70 |
| - order: ["lifecycle", "everything-else", "rendering"], |
71 |
| - }, |
72 |
| - ], |
73 |
| - "react/prop-types": 0, |
74 |
| - "spaced-comment": 0, |
75 |
| - strict: 0, |
76 |
| - }, |
77 |
| -}; |
| 1 | +module.exports = { |
| 2 | + // Global ESLint Settings |
| 3 | + // ================================= |
| 4 | + root: true, |
| 5 | + env: { |
| 6 | + browser: true, |
| 7 | + es6: true, |
| 8 | + node: true, |
| 9 | + jest: true, |
| 10 | + }, |
| 11 | + globals: { |
| 12 | + Atomics: 'readonly', |
| 13 | + SharedArrayBuffer: 'readonly', |
| 14 | + }, |
| 15 | + ignorePatterns: ['cypress/*'], |
| 16 | + settings: { |
| 17 | + react: { |
| 18 | + version: 'detect', |
| 19 | + }, |
| 20 | + 'import/resolver': { |
| 21 | + typescript: {}, |
| 22 | + 'babel-module': { |
| 23 | + root: ['.'], |
| 24 | + alias: { |
| 25 | + '~/static': './public/static/', |
| 26 | + '~': './', |
| 27 | + }, |
| 28 | + }, |
| 29 | + }, |
| 30 | + }, |
| 31 | + |
| 32 | + // =========================================== |
| 33 | + // Set up ESLint for .js / .jsx files |
| 34 | + // =========================================== |
| 35 | + // .js / .jsx uses babel-eslint |
| 36 | + parser: 'babel-eslint', |
| 37 | + parserOptions: { |
| 38 | + ecmaVersion: 2020, |
| 39 | + sourceType: 'module', |
| 40 | + ecmaFeatures: { |
| 41 | + jsx: true, |
| 42 | + }, |
| 43 | + }, |
| 44 | + |
| 45 | + // Plugins |
| 46 | + // ================================= |
| 47 | + plugins: ['react', 'jsx-a11y', 'import', 'jest', 'react-hooks', 'prettier'], |
| 48 | + |
| 49 | + // Extend Other Configs |
| 50 | + // ================================= |
| 51 | + extends: [ |
| 52 | + 'airbnb', |
| 53 | + 'eslint:recommended', |
| 54 | + 'plugin:import/errors', |
| 55 | + 'plugin:import/warnings', |
| 56 | + 'plugin:react/recommended', |
| 57 | + // Disable rules that conflict with Prettier |
| 58 | + // Prettier must be last to override other configs |
| 59 | + 'prettier', |
| 60 | + ], |
| 61 | + rules: { |
| 62 | + 'react/function-component-definition': 0, |
| 63 | + 'react/boolean-prop-naming': 0, |
| 64 | + 'react/prop-types': 0, |
| 65 | + 'react-hooks/exhaustive-deps': 1, |
| 66 | + 'react/react-in-jsx-scope': 0, |
| 67 | + 'react/display-name': [0], |
| 68 | + // from old |
| 69 | + 'arrow-body-style': 0, |
| 70 | + 'class-methods-use-this': 0, |
| 71 | + 'consistent-return': 0, |
| 72 | + 'comma-dangle': 0, |
| 73 | + 'dot-notation': 0, |
| 74 | + 'func-names': 0, |
| 75 | + 'guard-for-in': 0, |
| 76 | + 'import/extensions': 0, |
| 77 | + 'import/no-extraneous-dependencies': 0, |
| 78 | + 'import/no-unresolved': 0, |
| 79 | + 'import/prefer-default-export': 0, |
| 80 | + 'max-len': 0, |
| 81 | + 'no-alert': 0, |
| 82 | + 'no-console': 0, |
| 83 | + 'no-param-reassign': 0, |
| 84 | + 'no-plusplus': 0, |
| 85 | + 'no-restricted-globals': 1, |
| 86 | + 'no-restricted-syntax': 0, |
| 87 | + 'no-shadow': 0, |
| 88 | + 'no-undef': 0, |
| 89 | + 'no-unused-vars': 0, |
| 90 | + 'no-use-before-define': 0, |
| 91 | + 'no-useless-constructor': 0, |
| 92 | + 'no-underscore-dangle': 0, |
| 93 | + 'no-unused-expressions': 0, |
| 94 | + 'no-return-assign': 0, |
| 95 | + 'prefer-const': 1, |
| 96 | + 'prefer-destructuring': 0, |
| 97 | + 'prefer-template': 0, |
| 98 | + 'react/button-has-type': 0, |
| 99 | + 'react/destructuring-assignment': 0, |
| 100 | + 'react/forbid-prop-types': 0, |
| 101 | + 'react/jsx-filename-extension': 0, |
| 102 | + 'react/jsx-no-duplicate-props': 0, |
| 103 | + 'react/no-access-state-in-setstate': 0, |
| 104 | + 'react/no-array-index-key': 0, |
| 105 | + 'react/no-did-update-set-state': 0, |
| 106 | + 'react/no-unused-state': 0, |
| 107 | + 'react/prefer-stateless-function': 0, |
| 108 | + 'react/sort-comp': [ |
| 109 | + 2, |
| 110 | + { |
| 111 | + order: ['lifecycle', 'everything-else', 'rendering'], |
| 112 | + }, |
| 113 | + ], |
| 114 | + 'spaced-comment': 0, |
| 115 | + strict: 0, |
| 116 | + }, |
| 117 | + |
| 118 | + // ================================= |
| 119 | + // Overrides for Specific Files |
| 120 | + // ================================= |
| 121 | + overrides: [ |
| 122 | + // Match TypeScript Files |
| 123 | + // ================================= |
| 124 | + { |
| 125 | + files: ['**/*.{ts,tsx}'], |
| 126 | + |
| 127 | + // Global ESLint Settings |
| 128 | + // ================================= |
| 129 | + env: { |
| 130 | + jest: true, |
| 131 | + }, |
| 132 | + globals: { |
| 133 | + React: 'writable', |
| 134 | + }, |
| 135 | + settings: { |
| 136 | + 'import/parsers': { |
| 137 | + '@typescript-eslint/parser': ['.ts', '.tsx'], |
| 138 | + }, |
| 139 | + 'import/resolver': { |
| 140 | + typescript: { |
| 141 | + project: './tsconfig.json', |
| 142 | + }, |
| 143 | + }, |
| 144 | + }, |
| 145 | + |
| 146 | + // Parser Settings |
| 147 | + // ================================= |
| 148 | + // allow ESLint to understand TypeScript syntax |
| 149 | + // https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/lib/shared.js#L10 |
| 150 | + parser: '@typescript-eslint/parser', |
| 151 | + parserOptions: { |
| 152 | + // Lint with Type Information |
| 153 | + // https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/TYPED_LINTING.md |
| 154 | + tsconfigRootDir: __dirname, |
| 155 | + project: './tsconfig.json', |
| 156 | + }, |
| 157 | + |
| 158 | + // Plugins |
| 159 | + // ================================= |
| 160 | + plugins: ['jsx-a11y'], |
| 161 | + |
| 162 | + // Extend Other Configs |
| 163 | + // ================================= |
| 164 | + extends: [ |
| 165 | + 'eslint:recommended', |
| 166 | + 'plugin:@typescript-eslint/eslint-recommended', |
| 167 | + 'plugin:@typescript-eslint/recommended', |
| 168 | + 'plugin:@typescript-eslint/recommended-requiring-type-checking', |
| 169 | + 'plugin:react/recommended', |
| 170 | + 'plugin:import/errors', |
| 171 | + 'plugin:import/warnings', |
| 172 | + 'plugin:import/typescript', |
| 173 | + 'prettier', |
| 174 | + ], |
| 175 | + rules: { |
| 176 | + 'react/react-in-jsx-scope': 'off', |
| 177 | + 'react/prop-types': [0], |
| 178 | + // temp allowing during TS migration |
| 179 | + '@typescript-eslint/ban-ts-comment': [ |
| 180 | + 'error', |
| 181 | + { |
| 182 | + 'ts-ignore': 'allow-with-description', |
| 183 | + minimumDescriptionLength: 4, |
| 184 | + }, |
| 185 | + ], |
| 186 | + }, |
| 187 | + }, |
| 188 | + ], |
| 189 | +}; |
0 commit comments