-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
179 lines (174 loc) · 5.29 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'airbnb',
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:@typescript-eslint/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'prettier',
'plugin:cypress/recommended',
// Allow Cypress using an assertion such as expect(value).to.be.true
'plugin:chai-friendly/recommended',
],
env: {
browser: true,
es2021: true,
jest: true,
'cypress/globals': true,
},
plugins: [
'react',
// Ensures accessibility is checked
'jsx-a11y',
'react-hooks',
'cypress',
'chai-friendly',
'@typescript-eslint',
'@emotion',
'simple-import-sort',
],
parserOptions: {
typescript: true,
ecmaVersion: 12,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
overrides: [{ files: ['*.ts', '*.tsx', '*.js', '*.jsx'] }],
// We don't want to lint generated files nor node_modules,
// but we want to lint .prettierrc.js (ignored by default by eslint)
ignorePatterns: ['node_modules/*', '.build/*', '.dist/*', '!.prettierrc.js'],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': [
'warn',
{
/* Variables named _ or __ or ___... won"t be checked as unused
* Useful to exclude a property from an object
* Example:
* const { dontWantThis: _, ...wantTheRest } = myObj; */
varsIgnorePattern: '^_*$',
},
],
'react-hooks/rules-of-hooks': 'warn',
'react-hooks/exhaustive-deps': 'warn',
'prefer-destructuring': [
1,
{
VariableDeclarator: { array: false, object: true },
AssignmentExpression: { array: true, object: false },
},
{ enforceForRenamedProperties: false },
],
'class-methods-use-this': 0,
'import/imports-first': 1,
'import/no-unresolved': 2,
'import/no-webpack-loader-syntax': 0,
'import/prefer-default-export': 0,
'no-restricted-imports': [
'warn',
{
name: '@emotion/styled',
message:
'Please use @emotion/styled/macro instead. See https://emotion.sh/docs/babel-macros',
},
{
name: '@emotion/react',
message:
'Please use @emotion/react/macro instead. See https://emotion.sh/docs/babel-macros',
},
{
name: 'typed-redux-saga',
message:
'Please use @typed-redux-saga/macro instead. ' +
'See https://github.com/agiledigital/typed-redux-saga#babel-macro',
},
],
'jsx-a11y/aria-props': 2,
'jsx-a11y/heading-has-content': 0,
'jsx-a11y/anchor-is-valid': 0,
'jsx-a11y/label-has-for': 0,
'jsx-a11y/mouse-events-have-key-events': 2,
'jsx-a11y/role-has-required-aria-props': 2,
'jsx-a11y/role-supports-aria-props': 2,
'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/no-static-element-interactions': 0,
'no-console': ['warn', { allow: ['warn', 'error'] }],
'prefer-template': 2,
'react/forbid-prop-types': 0,
'react/jsx-first-prop-new-line': [2, 'multiline'],
'react/jsx-closing-bracket-location': 2,
'react/jsx-no-target-blank': 0,
'react/require-default-props': 0,
'react/require-extension': 0,
'react/self-closing-comp': 0,
'react/jsx-wrap-multilines': 0,
'react/destructuring-assignment': 0,
'react/function-component-definition': 0,
'react/jsx-filename-extension': 0,
'require-yield': 0,
'react/jsx-props-no-spreading': 0,
'react/state-in-constructor': 0,
'import/extensions': 0,
'import/no-extraneous-dependencies': 0,
'no-empty': [2, { allowEmptyCatch: true }],
'react/prop-types': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/ban-ts-comment': 0,
// There is a bug with typescript-eslint...
// It"s safe anyway to remove this rule since typescript will do checks anyway
'no-use-before-define': 0,
// We want to be able to throw error objects
'no-throw-literal': 0,
// Maximum line length of 100 characters
'max-len': ['warn', { code: 100 }],
// Define imports sort and grouping rules
'simple-import-sort/exports': 'warn',
'simple-import-sort/imports': [
'warn',
{
groups: [
// Side effect imports.
['^\\u0000'],
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
['^@?\\w'],
// Absolute imports and other imports such as Vue-style `@/foo`.
// Anything not matched in another group.
['^', '^src'],
// Relative imports.
// Anything that starts with a dot.
['^\\.'],
// Style imports.
['^.+\\.s?css$', 'styles$'],
],
},
],
'import/no-anonymous-default-export': [
'error',
{
allowArrowFunction: true,
allowAnonymousFunction: true,
},
],
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
alias: {
map: [
['typings', './typings'],
['src', './src'],
],
extensions: ['.d.ts', '.ts', '.tsx', '.js', '.jsx', '.json'],
},
},
},
}