-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstyle.js
308 lines (225 loc) · 8.91 KB
/
style.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
/**
* These rules relate to style guidelines, and are therefore quite subjective
*/
module.exports = {
rules: {
// enforce spacing inside array brackets
'array-bracket-spacing': 'off',
// enforce spacing inside single-line blocks
'block-spacing': 'error',
// require brace style
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
// require camelcase
'camelcase': ['error', { properties: 'never' }],
// enforce or disallow capitalization of the first letter of a comment
'capitalized-comments': 'off',
// enforce spacing before and after comma
'comma-dangle': ['error', {
'arrays': 'never',
'objects': 'only-multiline',
'imports': 'only-multiline',
'exports': 'only-multiline',
'functions': 'never'
}],
// enforces spacing around commas
'comma-spacing': ['error', { before: false, after: true }],
// comma style
'comma-style': ['error', 'last'],
// disallow or enforce spaces inside of computed properties
'computed-property-spacing': ['error', 'never'],
// require consistent this
'consistent-this': 'off',
// require newline at the end of files
'eol-last': 'error',
// require or disallow spacing between function identifiers and their invocations
'func-call-spacing': ['error', 'never'],
// require function names to match the name of the variable or property to which they are assigned
'func-name-matching': 'off',
// require named function expressions
'func-names': 'off',
// enforce the consistent use of either function declarations or expressions
'func-style': 'off',
// disallow specified identifiers
'id-blacklist': 'off',
// enforce minimum and maximum identifier lengths
'id-length': 'off',
// require identifiers to match a specified regular expression
'id-match': 'off',
// enforce consistent indentation
'indent': ['error', 2, { SwitchCase: 1 }],
// enforce the consistent use of either double or single quotes in JSX attributes
'jsx-quotes': 'off',
// enforce consistent spacing between keys and values in object literal properties
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
// enforce consistent spacing before and after keywords
'keyword-spacing': ['error', {
before: true,
after: true
}],
// enforce position of line comments
'line-comment-position': 'off',
// enforce consistent linebreak style
'linebreak-style': 'off',
// require empty lines around comments
'lines-around-comment': 'off',
// require or disallow newlines around directives
'lines-around-directive': 'off',
// enforce a maximum depth that blocks can be nested
'max-depth': 'off',
// enforce a maximum line length
'max-len': 'off',
// enforce a maximum file length
'max-lines': 'off',
// enforce a maximum depth that callbacks can be nested
'max-nested-callbacks': 'off',
// enforce a maximum number of parameters in function definitions
'max-params': 'off',
// enforce a maximum number of statements allowed in function blocks
'max-statements': 'off',
// enforce a maximum number of statements allowed per line
'max-statements-per-line': 'off',
// enforce or disallow newlines between operands of ternary expressions
'multiline-ternary': 'off',
// require constructor names to begin with a capital letter
'new-cap': ['error', { 'newIsCap': true, 'capIsNew': false }],
// require parentheses when invoking a constructor with no arguments
'new-parens': 'error',
// require or disallow an empty line after variable declarations
'newline-after-var': 'off',
// require an empty line before return statements
'newline-before-return': 'off',
// require a newline after each call in a method chain
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
// disallow Array constructors
'no-array-constructor': 'error',
// disallow bitwise operators
'no-bitwise': 'off',
// disallow continue statements
'no-continue': 'off',
// disallow inline comments after code
'no-inline-comments': 'off',
// disallow if statements as the only statement in else blocks
'no-lonely-if': 'error',
// Disallow mixes of different operators
'no-mixed-operators': ['error', {
groups: [
['+', '-', '*', '/', '%', '**'],
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof']
],
allowSamePrecedence: true
}],
// disallow mixed spaces and tabs for indentation
'no-mixed-spaces-and-tabs': 'error',
// disallow Use of Chained Assignment Expressions
'no-multi-assign': 'error',
// disallow multiple empty lines
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
// disallow negated conditions
'no-negated-condition': 'off',
// disallow nested ternary expressions
'no-nested-ternary': 'error',
// disallow Object constructors
'no-new-object': 'error',
// disallow the unary operators ++ and --
'no-plusplus': 'off',
// disallow specified syntax
'no-restricted-syntax': 'off',
// disallow all tabs
'no-tabs': 'error',
// disallow ternary operators
'no-ternary': 'off',
// disallow trailing whitespace at the end of lines
'no-trailing-spaces': 'error',
// disallow dangling underscores in identifiers
'no-underscore-dangle': 'off',
// disallow ternary operators when simpler alternatives exist
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
// disallow whitespace before properties
'no-whitespace-before-property': 'error',
// enforce the location of single-line statements
'nonblock-statement-body-position': 'off',
// enforce consistent line breaks inside braces
'object-curly-newline': 'off',
// enforce consistent line breaks inside braces
'object-curly-spacing': ['error', 'always'],
// enforce placing object properties on separate lines
'object-property-newline': ['error', {
allowMultiplePropertiesPerLine: true,
}],
// enforce variables to be declared either together or separately in functions
'one-var': ['error', { initialized: 'never' }],
// require or disallow newlines around variable declarations
'one-var-declaration-per-line': 'off',
// require or disallow assignment operator shorthand where possible
'operator-assignment': ['error', 'always'],
// enforce consistent linebreak style for operators
'operator-linebreak': 'off',
// require or disallow padding within blocks
'padded-blocks': ['error', {
'blocks': 'never',
'classes': 'never',
'switches': 'never'
}],
// require quotes around object literal property names
'quote-props': 'off',
// enforce the consistent use of either backticks, double, or single quotes
'quotes': ['error', 'single', {
avoidEscape: true,
allowTemplateLiterals: true
}],
// require JSDoc comments
'require-jsdoc': 'off',
// require or disallow semicolons instead of ASI
'semi': ['error', 'never'],
// enforce spacing before and after semicolons
'semi-spacing': ['error', { before: false, after: true }],
// require object keys to be sorted
'sort-keys': 'off',
// sort variables within the same declaration block
'sort-vars': 'off',
// require or disallow space before blocks
'space-before-blocks': 'error',
// require or disallow space before function opening parenthesis
'space-before-function-paren': ['error', 'always'],
// disallow or enforce spaces inside of parentheses
'space-in-parens': ['error', 'never'],
// require spacing around infix operators
'space-infix-ops': 'error',
// require or disallow spaces before/after unary operators
'space-unary-ops': ['error', {
words: true,
nonwords: false
}],
// requires or disallows a whitespace (space or tab) beginning a comment
'spaced-comment': ['error', 'always', {
line: {
exceptions: ['-', '+'],
markers: ['=', '!'], // space here to support sprockets directives
},
block: {
exceptions: ['-', '+'],
markers: ['=', '!'], // space here to support sprockets directives
balanced: false,
}
}],
'spaced-comment': ['error', 'always', {
'line': {
'markers': ['*package', '!', '/', ',']
},
'block': {
'balanced': true,
'markers': ['*package', '!', ',', ':', '::', 'flow-include'],
'exceptions': ['*']
}
}],
// require or disallow spacing between template tags and their literals
'template-tag-spacing': 'off',
// require or disallow the unicode Byte Order Mark (BOM)
'unicode-bom': ['error', 'never'],
// require regex literals to be wrapped
'wrap-regex': 'off'
}
}