-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.js
138 lines (138 loc) · 2.64 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
module.exports = {
env: {
browser: true,
commonjs: true,
es2021: true,
jest: true,
},
parser: '@babel/eslint-parser',
extends: [
'plugin:react/recommended',
'airbnb',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
plugins: [
'@babel',
'react',
],
globals: {
shallow: true,
render: true,
mount: true,
},
rules: {
'react/jsx-props-no-spreading': 'off',
'react/static-property-placement': [
'error',
'static public field',
],
'react/state-in-constructor': [
2,
'never',
],
// reducing code complexity by capping the amount
// of cyclomatic complexity allowed in a program.
complexity: [
'error',
10,
],
// enforces a maximum depth that blocks can be nested to reduce code complexity.
'max-depth': [
'error',
3,
],
// enforces a maximum number of lines per file,
// in order to aid in maintainability and reduce complexity.
'max-lines': [
'error',
{
max: 1000,
skipBlankLines: true,
skipComments: true,
},
],
// enforces a maximum number of lines per function,
// in order to aid in maintainability and reduce complexity.
'max-lines-per-function': [
'error',
{
max: 200,
skipBlankLines: true,
skipComments: true,
IIFEs: true,
},
],
// enforces a maximum number of parameters in function definitions
'max-params': [
'error',
3,
],
// enforces a maximum number of statements allowed in function blocks.
'max-statements': [
'error',
20,
],
// enforces a maximum depth that callbacks can be nested
'max-nested-callbacks': [
'error',
2,
],
// max line length
'max-len': [
1,
120,
2,
{
ignoreComments: true,
},
],
'react/jsx-max-props-per-line': [
1,
{
maximum: 1,
when: 'always',
},
],
indent: [
2,
2,
{
SwitchCase: 1,
},
],
'linebreak-style': [
'error',
'unix',
],
quotes: [
'error',
'single',
],
'no-console': 'error',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/**-test.js?(x)',
],
optionalDependencies: false,
},
],
'comma-dangle': [
'error',
{
arrays: 'always',
objects: 'always',
imports: 'always',
exports: 'always',
functions: 'never',
},
],
},
};