-
Notifications
You must be signed in to change notification settings - Fork 35
/
.eslintrc.js
152 lines (152 loc) · 4.78 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
module.exports = {
plugins: ['prettier', 'security', 'no-only-tests', 'you-dont-need-lodash-underscore', 'ato'],
extends: [
'react-app',
'airbnb',
'prettier',
'prettier/prettier',
'plugin:security/recommended',
'plugin:you-dont-need-lodash-underscore/compatible',
'plugin:jsx-a11y/recommended',
],
root: true,
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./playwright/tests/tsconfig.json'],
},
rules: {
'prettier/prettier': 'error',
'no-only-tests/no-only-tests': 'error',
'ato/no-explicit-eslint-disable': 'error',
'ato/no-unapproved-annotation': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': 'warn',
'no-console': 'warn',
'jsx-a11y/anchor-is-valid': ['warn', { aspects: ['noHref', 'preferButton'] }],
'jsx-a11y/label-has-associated-control': [
'error',
{
labelAttributes: ['htmlFor'],
assert: 'either',
depth: 2,
},
],
'react/button-has-type': 'error',
'react/function-component-definition': [
'error',
{
namedComponents: ['function-declaration', 'function-expression', 'arrow-function'],
unnamedComponents: ['function-expression', 'arrow-function'],
},
],
'react/jsx-no-target-blank': 'error',
'react/jsx-curly-brace-presence': 'error',
'react/require-default-props': 'warn',
// TODO: The following rules were introduced in the dependency update to
// `eslint-plugin-react` and require some additiona refactor of things in
// our app to enable. They're disabled for now, but we should address these
// in future changes to the affected files. {
'react/prop-types': 'off',
'react/no-array-index-key': 'off',
'react/forbid-prop-types': 'off',
// }
'no-unused-vars': 'warn',
'import/order': [
'error',
{
'newlines-between': 'always',
},
],
'import/named': 'error',
// TODO: The folowing rules were introduced from exisiting eslint preset libraries we use.
// Disabling them for now until we have a conversation to see which rules we would like to keep from
// the import library.
'import/no-named-as-default-member': 'off',
'import/no-named-as-default': 'off',
//
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/*.stories.js*',
// '**/*.stories.js',
'**/*.test.js*',
// '**/*.test.jsx',
'**/setupTests.js',
'**/testUtils.jsx',
'**/test/factories/**',
// playwright
'**/playwright.config.js',
'**/playwright/**/*.js',
],
},
],
'you-dont-need-lodash-underscore/capitalize': 'off',
'you-dont-need-lodash-underscore/clone': 'off',
'you-dont-need-lodash-underscore/cloneDeep': 'off',
'you-dont-need-lodash-underscore/findKey': 'off',
'you-dont-need-lodash-underscore/findLast': 'off',
'you-dont-need-lodash-underscore/mapValues': 'off',
'you-dont-need-lodash-underscore/memoize': 'off',
'you-dont-need-lodash-underscore/snakeCase': 'off',
'you-dont-need-lodash-underscore/startCase': 'off',
'you-dont-need-lodash-underscore/sum': 'off',
'you-dont-need-lodash-underscore/union': 'off',
'you-dont-need-lodash-underscore/uniqueId': 'off',
'you-dont-need-lodash-underscore/get': 'off',
},
overrides: [
{
files: ['*.stories.js', '*.stories.jsx', 'setupTests.js'],
rules: {
'react/jsx-props-no-spreading': 'off',
'react/destructuring-assignment': 'off',
},
},
{
files: ['*.test.jsx', 'testUtils.jsx'],
rules: {
'react/jsx-props-no-spreading': 'off',
},
},
{
files: ['src/utils/test/factories/**'],
rules: {
'no-param-reassign': ['error', { props: false }],
},
},
{
files: ['playwright/**/*.js*'],
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/eslint-recommended', // removes redundant warnings between TS & ESLint
'plugin:@typescript-eslint/recommended', // rules specific to typescript, e.g., writing interfaces
],
rules: {
'@typescript-eslint/no-floating-promises': 'error',
'no-restricted-syntax': 'off',
'no-await-in-loop': 'off',
'no-shadow': 'off',
},
},
],
settings: {
'import/resolver': {
node: {
moduleDirectory: ['src', 'node_modules'],
extensions: ['.js', '.jsx'],
},
},
'import/ignore': ['.coffee$'],
linkComponents: [
// Components used as alternatives to <a> for linking, eg. <Link to={ url } />
{
name: 'Link',
linkAttribute: 'href',
},
{
name: 'Link',
linkAttribute: 'to',
},
],
},
};