Skip to content

Commit 4018072

Browse files
committed
refactor(style issues): Update rules for Prettier integration
BREAKING CHANGE: Requires min eslint version of 4.x. BREAKING CHANGE: Multiple rules disabled and handled by Prettier, this will change code style for defaults based projects. Upgrade: After upgrading with defaults, any editor Prettier plugin can be used to update style. The pre-commit hook will also fix & write the prettier changes.
1 parent c95baae commit 4018072

File tree

1 file changed

+77
-93
lines changed

1 file changed

+77
-93
lines changed

rules/stylistic-issues.js

Lines changed: 77 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ module.exports = {
22
rules: {
33
// enforce consistent spacing inside array brackets
44
// http://eslint.org/docs/rules/array-bracket-spacing
5-
'array-bracket-spacing': ['error', 'never'],
5+
// This is handled by Prettier in Defaults 2.0
6+
'array-bracket-spacing': 'off',
67

78
// enforce consistent spacing inside single-line blocks
89
// http://eslint.org/docs/rules/block-spacing
9-
'block-spacing': ['error', 'always'],
10+
// This is handled by Prettier in Defaults 2.0
11+
'block-spacing': 'off',
1012

1113
// enforce consistent brace style for blocks
1214
// http://eslint.org/docs/rules/brace-style
13-
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
15+
// This is handled by Prettier in Defaults 2.0
16+
'brace-style': 'off',
1417

1518
// enforce camelcase naming convention
1619
// http://eslint.org/docs/rules/camelcase
@@ -33,37 +36,37 @@ module.exports = {
3336

3437
// require trailing commas in multiline object literals
3538
// http://eslint.org/docs/rules/comma-dangle
36-
'comma-dangle': ['error', {
37-
arrays: 'always-multiline',
38-
objects: 'always-multiline',
39-
imports: 'always-multiline',
40-
exports: 'always-multiline',
41-
functions: 'always-multiline',
42-
}],
39+
// This is handled by Prettier in Defaults 2.0
40+
'comma-dangle': 'off',
4341

4442
// enforce consistent spacing before and after commas
4543
// http://eslint.org/docs/rules/comma-spacing
46-
'comma-spacing': ['error', { before: false, after: true }],
44+
// This is handled by Prettier in Defaults 2.0
45+
'comma-spacing': 'off',
4746

4847
// enforce consistent comma style
4948
// http://eslint.org/docs/rules/comma-style
50-
'comma-style': ['error', 'last'],
49+
// This is handled by Prettier in Defaults 2.0
50+
'comma-style': 'off',
5151

5252
// enforce consistent spacing inside computed property brackets
5353
// http://eslint.org/docs/rules/computed-property-spacing
54-
'computed-property-spacing': ['error', 'never'],
54+
// This is handled by Prettier in Defaults 2.0
55+
'computed-property-spacing': 'off',
5556

5657
// enforce consistent naming when capturing the current execution context
5758
// http://eslint.org/docs/rules/consistent-this
5859
'consistent-this': 'off',
5960

6061
// require or disallow newline at the end of files
6162
// http://eslint.org/docs/rules/eol-last
62-
'eol-last': ['error', 'always'],
63+
// This is handled by Prettier in Defaults 2.0
64+
'eol-last': 'off',
6365

6466
// require or disallow spacing between function identifiers and their invocations
6567
// http://eslint.org/docs/rules/func-call-spacing
66-
'func-call-spacing': ['error', 'never'],
68+
// This is handled by Prettier in Defaults 2.0
69+
'func-call-spacing': 'off',
6770

6871
// require function names to match the name of the variable or property to which they are assigned
6972
// http://eslint.org/docs/rules/func-name-matching
@@ -93,39 +96,22 @@ module.exports = {
9396

9497
// enforce consistent indentation
9598
// http://eslint.org/docs/rules/indent
96-
indent: ['error', 2, {
97-
SwitchCase: 1,
98-
VariableDeclarator: 1,
99-
outerIIFEBody: 1,
100-
FunctionDeclaration: {
101-
parameters: 1,
102-
body: 1,
103-
},
104-
FunctionExpression: {
105-
parameters: 1,
106-
body: 1,
107-
},
108-
}],
99+
// This is handled by Prettier in Defaults 2.0
100+
indent: 'off',
109101

110102
// enforce the consistent use of either double or single quotes in JSX attributes
111103
// http://eslint.org/docs/rules/jsx-quotes
112-
'jsx-quotes': ['off', 'prefer-double'],
104+
'jsx-quotes': 'off',
113105

114106
// enforce consistent spacing between keys and values in object literal properties
115107
// http://eslint.org/docs/rules/key-spacing
116-
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
108+
// This is handled by Prettier in Defaults 2.0
109+
'key-spacing': 'off',
117110

118111
// enforce consistent spacing before and after keywords
119112
// http://eslint.org/docs/rules/keyword-spacing
120-
'keyword-spacing': ['error', {
121-
before: true,
122-
after: true,
123-
overrides: {
124-
return: { after: true },
125-
throw: { after: true },
126-
case: { after: true },
127-
},
128-
}],
113+
// This is handled by Prettier in Defaults 2.0
114+
'keyword-spacing': 'off',
129115

130116
// enforce position of line comments
131117
// http://eslint.org/docs/rules/line-comment-position
@@ -156,13 +142,8 @@ module.exports = {
156142

157143
// enforce a maximum line length
158144
// http://eslint.org/docs/rules/max-len
159-
'max-len': ['error', 140, 2, {
160-
ignoreUrls: true,
161-
ignoreComments: false,
162-
ignoreRegExpLiterals: true,
163-
ignoreStrings: true,
164-
ignoreTemplateLiterals: true,
165-
}],
145+
// This is handled by Prettier in Defaults 2.0
146+
'max-len': 'off',
166147

167148
// enforce a maximum number of lines per file
168149
// http://eslint.org/docs/rules/max-lines
@@ -190,7 +171,8 @@ module.exports = {
190171

191172
// enforce newlines between operands of ternary expressions
192173
// http://eslint.org/docs/rules/multiline-ternary
193-
'multiline-ternary': ['off', 'always'],
174+
// This is handled by Prettier in Defaults 2.0
175+
'multiline-ternary': 'off',
194176

195177
// require constructor names to begin with a capital letter
196178
// http://eslint.org/docs/rules/new-cap
@@ -203,7 +185,8 @@ module.exports = {
203185

204186
// require parentheses when invoking a constructor with no arguments
205187
// http://eslint.org/docs/rules/new-parens
206-
'new-parens': 'error',
188+
// This is handled by Prettier in Defaults 2.0
189+
'new-parens': 'pff',
207190

208191
// require or disallow an empty line after variable declarations
209192
// http://eslint.org/docs/rules/newline-after-var
@@ -215,7 +198,8 @@ module.exports = {
215198

216199
// require a newline after each call in a method chain
217200
// http://eslint.org/docs/rules/newline-per-chained-call
218-
'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
201+
// This is handled by Prettier in Defaults 2.0
202+
'newline-per-chained-call': 'off',
219203

220204
// disallow Array constructors
221205
// http://eslint.org/docs/rules/no-array-constructor
@@ -239,28 +223,22 @@ module.exports = {
239223

240224
// disallow mixed binary operators
241225
// http://eslint.org/docs/rules/no-mixed-operators
242-
'no-mixed-operators': ['error', {
243-
groups: [
244-
['+', '-', '*', '/', '%', '**'],
245-
['&', '|', '^', '~', '<<', '>>', '>>>'],
246-
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
247-
['&&', '||'],
248-
['in', 'instanceof'],
249-
],
250-
allowSamePrecedence: false,
251-
}],
226+
// This is handled by Prettier in Defaults 2.0
227+
'no-mixed-operators': 'off',
252228

253229
// disallow mixed spaces and tabs for indentation
254230
// http://eslint.org/docs/rules/no-mixed-spaces-and-tabs
255-
'no-mixed-spaces-and-tabs': 'error',
231+
// This is handled by Prettier in Defaults 2.0
232+
'no-mixed-spaces-and-tabs': 'off',
256233

257234
// disallow use of chained assignment expressions
258235
// http://eslint.org/docs/rules/no-multi-assign
259236
'no-multi-assign': ['error'],
260237

261238
// disallow multiple empty lines
262239
// http://eslint.org/docs/rules/no-multiple-empty-lines
263-
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
240+
// This is handled by Prettier in Defaults 2.0
241+
'no-multiple-empty-lines': 'off',
264242

265243
// disallow negated conditions
266244
// http://eslint.org/docs/rules/no-negated-condition
@@ -288,15 +266,17 @@ module.exports = {
288266

289267
// disallow tab characters entirely
290268
// http://eslint.org/docs/rules/no-tabs
291-
'no-tabs': 'error',
269+
// This is handled by Prettier in Defaults 2.0
270+
'no-tabs': 'off',
292271

293272
// disallow ternary operators
294273
// http://eslint.org/docs/rules/no-ternary
295274
'no-ternary': 'off',
296275

297276
// disallow trailing whitespace at the end of lines
298277
// http://eslint.org/docs/rules/no-trailing-spaces
299-
'no-trailing-spaces': 'error',
278+
// This is handled by Prettier in Defaults 2.0
279+
'no-trailing-spaces': 'off',
300280

301281
// disallow dangling underscores in identifiers
302282
// http://eslint.org/docs/rules/no-underscore-dangle
@@ -308,28 +288,28 @@ module.exports = {
308288

309289
// disallow whitespace before properties
310290
// http://eslint.org/docs/rules/no-whitespace-before-property
311-
'no-whitespace-before-property': 'error',
291+
// This is handled by Prettier in Defaults 2.0
292+
'no-whitespace-before-property': 'off',
312293

313294
// enforce consistent line breaks inside braces
314295
// http://eslint.org/docs/rules/object-curly-newline
315-
'object-curly-newline': ['off', {
316-
ObjectExpression: { minProperties: 0, multiline: true },
317-
ObjectPattern: { minProperties: 0, multiline: true },
318-
}],
296+
// This is handled by Prettier in Defaults 2.0
297+
'object-curly-newline': 'off',
319298

320299
// require padding inside curly braces
321300
// http://eslint.org/docs/rules/object-curly-spacing
322-
'object-curly-spacing': ['error', 'always'],
301+
// This is handled by Prettier in Defaults 2.0
302+
'object-curly-spacing': 'off',
323303

324304
// enforce placing object properties on separate lines
325305
// http://eslint.org/docs/rules/object-property-newline
326-
'object-property-newline': ['error', {
327-
allowMultiplePropertiesPerLine: true,
328-
}],
306+
// This is handled by Prettier in Defaults 2.0
307+
'object-property-newline': 'off',
329308

330309
// require or disallow newlines around variable declarations
331310
// http://eslint.org/docs/rules/one-var-declaration-per-line
332-
'one-var-declaration-per-line': ['error', 'always'],
311+
// This is handled by Prettier in Defaults 2.0
312+
'one-var-declaration-per-line': 'off',
333313

334314
// enforce variables to be declared either together or separately in functions
335315
// http://eslint.org/docs/rules/one-var
@@ -341,31 +321,37 @@ module.exports = {
341321

342322
// enforce consistent linebreak style for operators
343323
// http://eslint.org/docs/rules/operator-linebreak
324+
// This is handled by Prettier in Defaults 2.0
344325
'operator-linebreak': 'off',
345326

346327
// require or disallow padding within blocks
347328
// http://eslint.org/docs/rules/padded-blocks
348-
'padded-blocks': ['error', 'never'],
329+
// This is handled by Prettier in Defaults 2.0
330+
'padded-blocks': 'off',
349331

350332
// require quotes around object literal property names
351333
// http://eslint.org/docs/rules/quote-props.html
352-
'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
334+
// This is handled by Prettier in Defaults 2.0
335+
'quote-props': 'off',
353336

354337
// enforce the consistent use of either backticks, double, or single quotes
355338
// http://eslint.org/docs/rules/quotes
356-
quotes: ['error', 'single', { avoidEscape: true }],
339+
// This is handled by Prettier in Defaults 2.0
340+
quotes: 'off',
357341

358342
// require JSDoc comments
359343
// http://eslint.org/docs/rules/require-jsdoc
360344
'require-jsdoc': 'off',
361345

362346
// enforce consistent spacing before and after semicolons
363347
// http://eslint.org/docs/rules/semi-spacing
364-
'semi-spacing': ['error', { before: false, after: true }],
348+
// This is handled by Prettier in Defaults 2.0
349+
'semi-spacing': 'off',
365350

366351
// require or disallow semicolons instead of ASI
367352
// http://eslint.org/docs/rules/semi
368-
semi: ['error', 'always'],
353+
// This is handled by Prettier in Defaults 2.0
354+
semi: 'off',
369355

370356
// require object keys to be sorted
371357
// http://eslint.org/docs/rules/sort-keys
@@ -377,32 +363,28 @@ module.exports = {
377363

378364
// enforce consistent spacing before blocks
379365
// http://eslint.org/docs/rules/space-before-blocks
380-
'space-before-blocks': 'error',
366+
// This is handled by Prettier in Defaults 2.0
367+
'space-before-blocks': 'off',
381368

382369
// enforce consistent spacing before function definition opening parenthesis
383370
// http://eslint.org/docs/rules/space-before-function-paren
384-
'space-before-function-paren': ['error', {
385-
anonymous: 'always',
386-
named: 'never',
387-
asyncArrow: 'always',
388-
}],
371+
// This is handled by Prettier in Defaults 2.0
372+
'space-before-function-paren': 'off',
389373

390374
// enforce consistent spacing inside parentheses
391375
// http://eslint.org/docs/rules/space-in-parens
392-
'space-in-parens': ['error', 'never'],
376+
// This is handled by Prettier in Defaults 2.0
377+
'space-in-parens': 'off',
393378

394379
// require spacing around infix operators
395380
// http://eslint.org/docs/rules/space-infix-ops
396-
'space-infix-ops': 'error',
381+
// This is handled by Prettier in Defaults 2.0
382+
'space-infix-ops': 'off',
397383

398384
// enforce consistent spacing before or after unary operators
399385
// http://eslint.org/docs/rules/space-unary-ops
400-
'space-unary-ops': ['error', {
401-
words: true,
402-
nonwords: false,
403-
overrides: {
404-
},
405-
}],
386+
// This is handled by Prettier in Defaults 2.0
387+
'space-unary-ops': 'off',
406388

407389
// enforce consistent spacing after the // or /* in a comment
408390
// http://eslint.org/docs/rules/spaced-comment
@@ -420,10 +402,12 @@ module.exports = {
420402

421403
// require or disallow Unicode byte order mark (BOM)
422404
// http://eslint.org/docs/rules/unicode-bom
423-
'unicode-bom': ['error', 'never'],
405+
// This is handled by Prettier in Defaults 2.0
406+
'unicode-bom': 'off',
424407

425408
// require parenthesis around regex literals
426409
// http://eslint.org/docs/rules/wrap-regex
410+
// This is handled by Prettier in Defaults 2.0
427411
'wrap-regex': 'off',
428412
},
429413
};

0 commit comments

Comments
 (0)