-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
195 lines (162 loc) · 5.6 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
extends: 'eslint:recommended',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
// References
'prefer-const': [
'error',
{
destructuring: 'any',
ignoreReadBeforeAssign: false,
},
],
// Objects
'no-new-object': ['error'],
/* expects that the shorthand will be used whenever possible */
'object-shorthand': ['error', 'always'],
/* disallows quotes around object literal property names that are not strictly required */
'quote-props': ['error', 'as-needed'],
/* disallow use of Object.prototypes builtins directly */
'no-prototype-builtins': ['error'],
// Arrays
'no-array-constructor': ['error'],
// String
quotes: ['error', 'single'],
/* suggest using template literals instead of string concatenation */
'prefer-template': ['error'],
// Functions
'prefer-rest-params': ['error'],
'prefer-spread': ['error'],
'no-new-func': ['error'],
/* require or disallow named function expressions */
'func-names': ['error', 'always'],
/* require a space before function parenthesis */
'space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'always',
asyncArrow: 'always',
},
],
/* require Space Before Blocks */
'space-before-blocks': ['error', 'always'],
/* disallow Reassignment of Function Parameters */
'no-param-reassign': ['error'],
// Arrow Functions
'prefer-arrow-callback': ['error'],
/* require space before/after arrow function’s arrow */
'arrow-spacing': ['error', { before: true, after: true }],
'arrow-parens': ['error', 'always'],
'arrow-body-style': ['error', 'as-needed'],
// Modules
'no-duplicate-imports': ['error', { includeExports: true }],
// Iterators and Generators
'generator-star-spacing': ['error', { before: false, after: true }],
// Variables
'no-multi-assign': ['error'],
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
/* require Variable Declarations to be at the top of their scope */
'vars-on-top': ['error'],
/* require initialization in variable declarations */
'init-declarations': ['error', 'always'],
// Comparison Operators & Equality
/* use shortcuts for booleans, but explicit comparisons for strings and numbers */
eqeqeq: ['error', 'always'],
'no-nested-ternary': ['error'],
'no-unneeded-ternary': ['error'],
/* enclosing complex expressions by parentheses clarifies the developer’s intention, which makes the code more readable */
'no-mixed-operators': [
'error',
{
groups: [
['+', '-', '*', '/', '%', '**'],
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
],
allowSamePrecedence: true,
},
],
// Blocks
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'no-else-return': ['error', { allowElseIf: false }],
// Control Statements
/* require Default Case in Switch Statements */
'default-case': ['error'],
// Comments
/* enforce capitalization of the first letter of a comment */
'capitalized-comments': [
'error',
'always',
{
ignorePattern: 'pragma|ignored',
ignoreInlineComments: true,
},
],
/* requires a whitespace (space or tab) beginning a comment */
'spaced-comment': ['error', 'always'],
/* enforce position of line comments */
'line-comment-position': ['error', { position: 'above' }],
/* enforce position of line comments */
'multiline-comment-style': ['error', 'starred-block'],
/* disallow inline comments after code */
'no-inline-comments': ['error'],
// Whitespace
indent: ['error', 2],
'space-before-blocks': ['error', 'always'],
/* enforce consistent spacing before and after keywords */
'keyword-spacing': ['error'],
'space-infix-ops': ['error', { int32Hint: true }],
'eol-last': ['error'],
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 2 }],
/* disallow whitespace before properties */
'no-whitespace-before-property': ['error'],
'space-in-parens': ['error', 'never'],
'array-bracket-spacing': ['error', 'never'],
'object-curly-spacing': ['error', 'always'],
/* enforce a maximum line length */
'max-len': [
'error',
{
code: 80,
comments: 80,
ignoreTrailingComments: false,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
},
],
/* disallow spaces inside of blocks after opening block and before closing block */
'block-spacing': ['error', 'never'],
/* enforces spacing around commas */
'comma-spacing': ['error', { before: false, after: true }],
'computed-property-spacing': ['error', 'never'],
'func-call-spacing': ['error', 'never'],
'key-spacing': ['error', { beforeColon: false }],
'no-trailing-spaces': ['error'],
'no-multiple-empty-lines': ['error', { max: 2 }],
'rest-spread-spacing': ['error', 'never'],
// Commas
'comma-style': ['error', 'last'],
/* disallows trailing commas */
'comma-dangle': ['error', 'never'],
// Semi
semi: ['error', 'always'],
// Naming Conventions
camelcase: ['error'],
/* require constructor names to begin with a capital letter */
'new-cap': ['error'],
'no-console': ['off'],
},
};