-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
116 lines (107 loc) · 2.89 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
module.exports = {
env: {
browser: true,
es6: true
},
extends: [
'standard',
'plugin:jest/recommended',
'plugin:jest/style',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:import/errors',
/*
* These prettier configs turn off any conflicting eslint configs
* This way prettier controls all formatting, eslint controls
* non-formatting linting
*
* Note: All prettier extends configs need to come at the end of the
* list, so they can override previous rules.
*/
'prettier'
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
cy: 'readonly',
Cypress: 'readonly'
},
parser: '@babel/eslint-parser',
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2020,
sourceType: 'module',
babelOptions: {
// look for babel.config.js in current dir, move up a level if not found
rootMode: 'upward'
}
},
plugins: [
'@babel',
'jest',
'react',
// This adds prettier formatting rules to eslint
'prettier'
],
rules: {
'prettier/prettier': ['error'],
'jest/no-disabled-tests': 'error',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
// only allow the first letter to be uppercase in 'describe' block descriptions,
// 'test' and 'it' block descriptions must start with lowercase
'jest/prefer-lowercase-title': [
'error',
{
ignore: ['describe']
}
],
// Ensure you're actually asserting something when calling expect
'jest/valid-expect': 'error',
// Ensure we don't cause infinite state update loops with useEffect hooks.
'react-hooks/exhaustive-deps': 'error',
// Don't always require expects, some of our frontend integration tests
// should pass as long as they don't timeout
'jest/expect-expect': 'off',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal'],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before'
}
],
pathGroupsExcludedImportTypes: ['react'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true
}
}
],
'import/extensions': 'error',
'react/prop-types': 'off',
'react/display-name': 'off',
'react/state-in-constructor': 0,
'react/self-closing-comp': 'error',
// eventually I'd like to turn the camelcase rule on for properties,
// but for now there is enough snake case in our app that this will be a pain.
camelcase: 'off'
},
settings: {
react: {
// Must be updated when package.json react version is bumped
version: '18.2.0'
},
'import/resolver': {
node: {
moduleDirectory: ['node_modules', 'app/javascript']
}
}
}
}