-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
61 lines (61 loc) · 1.92 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* eslint-disable no-undef */
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jest/recommended',
'plugin:jest/style',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2021,
sourceType: 'module',
},
settings: {
react: {
version: 'detect',
},
},
plugins: ['@typescript-eslint', 'import', 'jest', 'react', 'react-hooks'],
rules: {
'no-unused-vars': 'off', // Needs to be disabled: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md#how-to-use
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'arrow-body-style': ['warn', 'as-needed'],
'import/order': [
'warn',
{
groups: [['builtin', 'external'], ['internal'], ['parent', 'sibling', 'index'], ['object', 'type']],
'newlines-between': 'always',
alphabetize: { order: 'asc' },
// Put 'react' & 'react-dom' in a separate group above the rest:
pathGroups: [
{
pattern: '?(react|react-dom)',
group: 'builtin',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['react', 'react-dom'],
},
],
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'warn',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'warn',
'react/display-name': 'off', // Triggers incorrectly, and is about obsolete createReactClass anyway.
'sort-imports': ['warn', { ignoreDeclarationSort: true }], // `import {B, A} from ..` ~> `import {A, B} from ..`
},
}