-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
141 lines (133 loc) · 3.08 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/**
* @type {import('eslint').Linter.Config}
*/
module.exports = {
root: true,
env: {
browser: true,
commonjs: true,
es2021: true,
node: true,
},
parser: '@babel/eslint-parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
babelOptions: {
presets: ['@babel/preset-react'],
},
requireConfigFile: false,
sourceType: 'module',
},
settings: {
react: {
version: 'detect',
},
'import/ignore': ['node_modules', '\\.(css|json|md|svg)$'],
'import/parsers': {
[require.resolve('@typescript-eslint/parser')]: ['.ts', '.tsx', '.d.ts'],
},
'import/resolver': {
[require.resolve('eslint-import-resolver-node')]: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
[require.resolve('eslint-import-resolver-typescript')]: {
alwaysTryTypes: true,
},
},
},
plugins: [
'security',
'sonarjs',
'import',
'react',
'react-hooks',
'jsx-a11y',
],
extends: [
'eslint:recommended',
'plugin:security/recommended',
'plugin:sonarjs/recommended',
'plugin:import/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'prettier',
],
rules: {
'arrow-body-style': 'off', // prettier conflict
'import/order': [
'warn',
{
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'type',
],
pathGroups: [
{
pattern: '~/**',
group: 'internal',
},
],
},
],
'import/prefer-default-export': 'error',
'prefer-arrow-callback': 'off', // prettier conflict
'react/react-in-jsx-scope': 'off',
},
overrides: [
{
files: ['**/*.ts?(x)'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
project: ['./tsconfig.eslint.json'],
sourceType: 'module',
warnOnUnsupportedTypeScriptVersion: true,
},
plugins: ['@typescript-eslint'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
},
{
files: ['**/*.stories.[jt]s?(x)'],
plugins: ['storybook'],
extends: ['plugin:storybook/recommended'],
},
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
env: {
jest: true,
'jest/globals': true,
},
settings: {
jest: {
version: 'detect',
},
},
plugins: ['jest', 'testing-library'],
extends: ['plugin:jest/recommended', 'plugin:testing-library/react'],
rules: {
'@typescript-eslint/no-unsafe-assignment': 'off',
'sonarjs/no-duplicate-string': 'off',
},
},
],
};