|
1 | 1 | module.exports = { |
2 | | - parser: '@typescript-eslint/parser', |
3 | | - plugins: ['@typescript-eslint'], |
4 | | - extends: ['airbnb', 'eslint:recommended', 'plugin:@typescript-eslint/recommended'], |
5 | | - env: { |
6 | | - browser: true, |
7 | | - jasmine: true, |
8 | | - jquery: true, |
9 | | - jest: true, |
10 | | - }, |
11 | | - globals: { |
12 | | - analytics: true, |
13 | | - }, |
14 | | - rules: { |
15 | | - // This block has rules that we either had before, or that I (personal opinion) either didn't |
16 | | - // consider to be important, or not controversial. |
17 | | - 'no-console': 'off', |
18 | | - 'no-script-url': 'off', |
19 | | - 'max-len': 'off', |
20 | | - 'no-param-reassign': 'off', |
21 | | - 'no-underscore-dangle': 'off', |
22 | | - camelcase: 'off', |
23 | | - 'react/jsx-no-target-blank': 'error', |
24 | | - 'react/jsx-uses-react': 'error', |
25 | | - 'react/jsx-uses-vars': 'error', |
26 | | - 'spaced-comment': 'off', |
27 | | - 'import/extensions': 'off', |
28 | | - 'import/order': 'off', |
29 | | - 'import/newline-after-import': 'warn', |
30 | | - 'import/prefer-default-export': 'off', |
31 | | - 'import/no-extraneous-dependencies': 'off', |
32 | | - 'no-restricted-syntax': 'off', |
33 | | - 'no-plusplus': 'warn', |
34 | | - 'jsx-quotes': 'off', |
35 | | - 'react/jsx-curly-brace-presence': 'warn', |
36 | | - 'react/destructuring-assignment': 'off', |
37 | | - 'react/sort-comp': 'off', |
38 | | - 'max-classes-per-file': 'off', |
39 | | - 'react/jsx-boolean-value': 'off', |
40 | | - 'react/forbid-prop-types': 'off', |
41 | | - 'react/jsx-fragments': 'warn', |
42 | | - '@typescript-eslint/ban-ts-comment': 'warn', |
43 | | - 'no-nested-ternary': 'warn', |
44 | | - 'jsx-a11y/label-has-associated-control': 'warn', |
45 | | - 'jsx-a11y/control-has-associated-label': 'warn', |
46 | | - 'jsx-a11y/tabindex-no-positive': 'warn', |
47 | | - 'operator-assignment': 'off', |
48 | | - 'no-restricted-properties': 'warn', |
49 | | - 'react/jsx-props-no-spreading': 'off', |
50 | | - 'react/jsx-filename-extension': [1, { extensions: ['.tsx', '.jsx'] }], |
51 | | - 'react/jsx-curly-newline': 'off', |
52 | | - '@typescript-eslint/no-inferrable-types': 'off', |
53 | | - '@typescript-eslint/no-extra-semi': 'off', |
54 | | - // the base rule is buggy and must be disabled |
55 | | - 'no-use-before-define': 'off', |
56 | | - 'react/function-component-definition': 'off', |
57 | | - |
58 | | - // Formatting where prettier has a different opinion. These should remain off, |
59 | | - // or we'll have two pre-commit hooks that contradict each other. |
60 | | - 'object-curly-newline': 'off', |
61 | | - 'operator-linebreak': 'off', |
62 | | - 'lines-between-class-members': 'off', |
63 | | - 'function-paren-newline': 'off', |
64 | | - 'implicit-arrow-linebreak': 'off', |
65 | | - 'newline-per-chained-call': 'off', |
66 | | - 'no-multiple-empty-lines': 'off', |
67 | | - 'no-trailing-spaces': 'off', |
68 | | - 'react/jsx-wrap-multilines': 'off', |
69 | | - 'react/display-name': 'off', |
70 | | - indent: 'off', |
71 | | - 'react/jsx-one-expression-per-line': 'off', |
72 | | - 'react/jsx-indent': 'off', |
73 | | - |
74 | | - // More "modern" JS styles. Some of these would be a lot of work to enabel. |
75 | | - 'comma-dangle': 'off', |
76 | | - 'arrow-body-style': 'off', |
77 | | - 'prefer-object-spread': 'warn', |
78 | | - 'prefer-rest-params': 'warn', |
79 | | - 'prefer-destructuring': 'off', |
80 | | - 'prefer-template': 'warn', |
81 | | - 'prefer-arrow-callback': 'off', |
82 | | - |
83 | | - // Not sure about this one. We can't easily enable it because we violate it all over the backend |
84 | | - 'import/no-import-module-exports': 'off', |
85 | | - |
86 | | - // Anything below here I think should really be errors. Turning them into warnings now |
87 | | - // because I can't fix them all at once. In no particular order. |
88 | | - 'no-confusing-arrow': 'warn', |
89 | | - 'no-useless-constructor': 'warn', |
90 | | - 'no-extra-boolean-cast': 'warn', |
91 | | - 'no-sequences': 'warn', |
92 | | - quotes: 'warn', |
93 | | - 'no-shadow-restricted-names': 'warn', |
94 | | - eqeqeq: 'warn', |
95 | | - 'no-prototype-builtins': 'warn', |
96 | | - 'no-var': 'warn', |
97 | | - // For typescript, it is recommended to turn this off as it is checked by typescript |
98 | | - 'no-undef': 'off', |
99 | | - 'array-callback-return': 'warn', |
100 | | - 'no-unneeded-ternary': 'warn', |
101 | | - 'no-path-concat': 'warn', |
102 | | - 'no-case-declarations': 'warn', |
103 | | - 'no-useless-return': 'warn', |
104 | | - 'no-continue': 'warn', |
105 | | - 'no-lonely-if': 'warn', |
106 | | - 'default-case': 'warn', |
107 | | - 'no-multi-assign': 'warn', |
108 | | - 'prefer-const': 'warn', |
109 | | - 'no-async-promise-executor': 'warn', |
110 | | - // this gives false positives for typescript enums; enable the corresponding typescript rule instead |
111 | | - 'no-shadow': 'off', |
112 | | - 'no-useless-escape': 'warn', |
113 | | - 'no-else-return': 'off', |
114 | | - 'import/no-useless-path-segments': 'off', |
115 | | - 'import/no-duplicates': 'warn', |
116 | | - 'import/no-mutable-exports': 'warn', |
117 | | - 'import/no-dynamic-require': 'warn', |
118 | | - 'import/no-self-import': 'off', |
119 | | - 'global-require': 'warn', |
120 | | - 'object-shorthand': 'warn', |
121 | | - 'no-unused-expressions': 'warn', |
122 | | - 'dot-notation': 'warn', |
123 | | - 'no-await-in-loop': 'warn', |
124 | | - 'prefer-promise-reject-errors': 'warn', |
125 | | - 'no-restricted-globals': 'warn', |
126 | | - 'class-methods-use-this': 'off', |
127 | | - '@typescript-eslint/no-use-before-define': ['off'], |
128 | | - '@typescript-eslint/no-empty-interface': 'warn', |
129 | | - '@typescript-eslint/no-var-requires': 'off', |
130 | | - '@typescript-eslint/no-this-alias': 'warn', |
131 | | - '@typescript-eslint/no-namespace': 'off', |
132 | | - '@typescript-eslint/ban-types': 'warn', |
133 | | - '@typescript-eslint/no-shadow': 'error', |
134 | | - 'react/prop-types': 'off', |
135 | | - 'react/no-access-state-in-setstate': 'warn', |
136 | | - 'react/require-default-props': 'off', |
137 | | - 'react/no-unused-prop-types': 'warn', |
138 | | - 'react/jsx-no-bind': 'warn', |
139 | | - 'react/no-did-update-set-state': 'warn', |
140 | | - 'react/no-unused-state': 'warn', |
141 | | - 'react/static-property-placement': 'warn', |
142 | | - 'react/no-unescaped-entities': 'warn', |
143 | | - 'react/no-children-prop': 'warn', |
144 | | - 'react/no-direct-mutation-state': 'warn', |
145 | | - 'react/default-props-match-prop-types': 'warn', |
146 | | - 'react/prefer-stateless-function': 'warn', |
147 | | - 'react/jsx-key': 'warn', |
148 | | - 'jsx-a11y/no-static-element-interactions': 'warn', |
149 | | - 'jsx-a11y/click-events-have-key-events': 'warn', |
150 | | - 'jsx-a11y/aria-props': 'warn', |
151 | | - 'jsx-a11y/anchor-is-valid': 'warn', |
152 | | - 'no-return-assign': 'warn', |
153 | | - 'consistent-return': 'warn', |
154 | | - 'import/first': 'warn', |
155 | | - 'default-param-last': 'warn', |
156 | | - // The following rules seem sensible, but we violate them in so many places that I disable them for now |
157 | | - 'import/no-named-as-default': 'warn', |
158 | | - 'import/no-cycle': 'warn', |
159 | | - 'import/no-named-as-default-member': 'warn', |
160 | | - 'import/no-unresolved': 'off', |
161 | | - 'padded-blocks': 'off', |
162 | | - 'quote-props': 'off' |
163 | | - }, |
164 | | - settings: { |
165 | | - 'import/parsers': { |
166 | | - '@typescript-eslint/parser': ['.ts', '.tsx'], |
167 | | - }, |
168 | | - 'import/resolver': { |
169 | | - // "node": { |
170 | | - // "paths": [path.resolve(__dirname, './src')] |
171 | | - // }, |
172 | | - typescript: { |
173 | | - project: './tsconfig.json', |
| 2 | + 'root': true, |
| 3 | + 'overrides': [ |
| 4 | + { |
| 5 | + 'env': { |
| 6 | + 'node': true, |
| 7 | + }, |
| 8 | + 'files': ['**/*.js', '**/*.jsx'], |
| 9 | + 'plugins': ['node', 'jest', 'prettier'], |
| 10 | + 'extends': ['airbnb-base', 'plugin:jest/recommended', 'plugin:jest/style', 'prettier'], |
| 11 | + 'rules': { |
| 12 | + 'camelcase': 'off', |
| 13 | + 'import/extensions': 'off', |
| 14 | + 'no-template-curly-in-string': 'off', |
| 15 | + 'no-underscore-dangle': 'off', |
| 16 | + 'prefer-const': 'error', |
| 17 | + 'prettier/prettier': 'error', |
174 | 18 | }, |
175 | 19 | }, |
176 | | - react: { |
177 | | - createClass: 'createReactClass', // Regex for Component Factory to use, |
178 | | - // default to "createReactClass" |
179 | | - pragma: 'React', // Pragma to use, default to "React" |
180 | | - version: 'detect', // React version. "detect" automatically picks the version you have installed. |
181 | | - // You can also use `16.0`, `16.3`, etc, if you want to override the detected value. |
182 | | - // default to latest and warns if missing |
183 | | - // It will default to "detect" in the future |
| 20 | + { |
| 21 | + 'files': ['*.test.js', '*.test.jsx'], |
| 22 | + 'rules': { |
| 23 | + 'jest/expect-expect': 'off', |
| 24 | + 'jest/no-conditional-expect': 'off', |
| 25 | + 'jest/no-done-callback': 'off', |
| 26 | + 'jest/no-standalone-expect': 'off', |
| 27 | + 'jest/no-try-expect': 'off', |
| 28 | + 'no-unused-vars': 'off', |
| 29 | + }, |
184 | 30 | }, |
185 | | - }, |
186 | | - parserOptions: { |
187 | | - ecmaFeatures: { |
188 | | - jsx: true, |
| 31 | + { |
| 32 | + 'files': ['**/*.ts', '**/*.tsx'], |
| 33 | + 'env': { |
| 34 | + 'node': true, |
| 35 | + }, |
| 36 | + 'extends': ['airbnb-typescript/base', 'prettier'], |
| 37 | + 'parser': '@typescript-eslint/parser', |
| 38 | + 'parserOptions': { |
| 39 | + 'project': 'tsconfig.json', |
| 40 | + 'sourceType': 'module', |
| 41 | + }, |
| 42 | + 'plugins': ['eslint-plugin-jsdoc', 'eslint-plugin-import', '@typescript-eslint', 'prettier'], |
| 43 | + 'rules': { |
| 44 | + '@typescript-eslint/naming-convention': 'off', |
| 45 | + '@typescript-eslint/no-unused-vars': 'off', |
| 46 | + 'max-len': 'off', |
| 47 | + 'no-param-reassign': 'off', |
| 48 | + 'no-underscore-dangle': 'off', |
| 49 | + 'prettier/prettier': 'error', |
| 50 | + 'spaced-comment': ['error', 'always', { 'exceptions': ['*'] }], |
| 51 | + }, |
189 | 52 | }, |
190 | | - }, |
| 53 | + ], |
191 | 54 | }; |
0 commit comments