Skip to content

Commit c221355

Browse files
committed
tools: alphabetize ESLint rules
I have never found it useful that the ESLint rules (in the configuration file) are organized by the categorization the rules are given in the ESLint documentation. It has only been a source of annoyance as one has to look up where the rule is in the docs to figure out where it should go in the configuration file. This change re-orders the rules so they are in alphabetical order. Simple! PR-URL: #19100 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Teddy Katz <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: Shingo Inoue <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent bd0a7a4 commit c221355

File tree

1 file changed

+87
-105
lines changed

1 file changed

+87
-105
lines changed

.eslintrc.js

Lines changed: 87 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -42,43 +42,80 @@ module.exports = {
4242
},
4343
],
4444
rules: {
45-
// Possible Errors
46-
// http://eslint.org/docs/rules/#possible-errors
45+
// ESLint built-in rules
46+
// http://eslint.org/docs/rules
47+
'accessor-pairs': 'error',
48+
'array-callback-return': 'error',
49+
'arrow-parens': ['error', 'always'],
50+
'arrow-spacing': ['error', { before: true, after: true }],
51+
'block-spacing': 'error',
52+
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
53+
'comma-dangle': ['error', 'only-multiline'],
54+
'comma-spacing': 'error',
55+
'comma-style': 'error',
56+
'computed-property-spacing': 'error',
57+
'constructor-super': 'error',
58+
'dot-location': ['error', 'property'],
59+
'dot-notation': 'error',
60+
'eol-last': 'error',
61+
eqeqeq: ['error', 'smart'],
4762
'for-direction': 'error',
63+
'func-call-spacing': 'error',
64+
'func-name-matching': 'error',
65+
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
66+
indent: ['error', 2, {
67+
ArrayExpression: 'first',
68+
CallExpression: { arguments: 'first' },
69+
FunctionDeclaration: { parameters: 'first' },
70+
FunctionExpression: { parameters: 'first' },
71+
MemberExpression: 'off',
72+
ObjectExpression: 'first',
73+
SwitchCase: 1,
74+
}],
75+
'key-spacing': ['error', { mode: 'strict' }],
76+
'keyword-spacing': 'error',
77+
'linebreak-style': ['error', 'unix'],
78+
'max-len': ['error', {
79+
code: 80,
80+
ignorePattern: '^// Flags:',
81+
ignoreRegExpLiterals: true,
82+
ignoreUrls: true,
83+
tabWidth: 2,
84+
}],
85+
'new-parens': 'error',
86+
'no-class-assign': 'error',
87+
'no-confusing-arrow': 'error',
88+
'no-const-assign': 'error',
4889
'no-control-regex': 'error',
4990
'no-debugger': 'error',
91+
'no-delete-var': 'error',
5092
'no-dupe-args': 'error',
93+
'no-dupe-class-members': 'error',
5194
'no-dupe-keys': 'error',
5295
'no-duplicate-case': 'error',
5396
'no-empty-character-class': 'error',
5497
'no-ex-assign': 'error',
5598
'no-extra-boolean-cast': 'error',
5699
'no-extra-parens': ['error', 'functions'],
57100
'no-extra-semi': 'error',
101+
'no-fallthrough': 'error',
58102
'no-func-assign': 'error',
103+
'no-global-assign': 'error',
59104
'no-invalid-regexp': 'error',
60105
'no-irregular-whitespace': 'error',
61-
'no-obj-calls': 'error',
62-
'no-template-curly-in-string': 'error',
63-
'no-unexpected-multiline': 'error',
64-
'no-unreachable': 'error',
65-
'no-unsafe-negation': 'error',
66-
'use-isnan': 'error',
67-
'valid-typeof': 'error',
68-
69-
// Best Practices
70-
// http://eslint.org/docs/rules/#best-practices
71-
'accessor-pairs': 'error',
72-
'array-callback-return': 'error',
73-
'dot-location': ['error', 'property'],
74-
'dot-notation': 'error',
75-
eqeqeq: ['error', 'smart'],
76-
'no-fallthrough': 'error',
77-
'no-global-assign': 'error',
106+
'no-lonely-if': 'error',
107+
'no-mixed-requires': 'error',
108+
'no-mixed-spaces-and-tabs': 'error',
78109
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
110+
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }],
111+
'no-new-require': 'error',
112+
'no-new-symbol': 'error',
113+
'no-obj-calls': 'error',
79114
'no-octal': 'error',
115+
'no-path-concat': 'error',
80116
'no-proto': 'error',
81117
'no-redeclare': 'error',
118+
'no-restricted-modules': ['error', 'sys'],
82119
'no-restricted-properties': [
83120
'error',
84121
{
@@ -110,76 +147,6 @@ module.exports = {
110147
message: '__defineSetter__ is deprecated.',
111148
}
112149
],
113-
'no-return-await': 'error',
114-
'no-self-assign': 'error',
115-
'no-self-compare': 'error',
116-
'no-throw-literal': 'error',
117-
'no-unused-labels': 'error',
118-
'no-useless-call': 'error',
119-
'no-useless-concat': 'error',
120-
'no-useless-escape': 'error',
121-
'no-useless-return': 'error',
122-
'no-void': 'error',
123-
'no-with': 'error',
124-
125-
// Strict Mode
126-
// http://eslint.org/docs/rules/#strict-mode
127-
strict: ['error', 'global'],
128-
129-
// Variables
130-
// http://eslint.org/docs/rules/#variables
131-
'no-delete-var': 'error',
132-
'no-undef': 'error',
133-
'no-undef-init': 'error',
134-
'no-unused-vars': ['error', { args: 'none' }],
135-
'no-use-before-define': ['error', {
136-
classes: true,
137-
functions: false,
138-
variables: false,
139-
}],
140-
141-
// Node.js and CommonJS
142-
// http://eslint.org/docs/rules/#nodejs-and-commonjs
143-
'no-mixed-requires': 'error',
144-
'no-new-require': 'error',
145-
'no-path-concat': 'error',
146-
'no-restricted-modules': ['error', 'sys'],
147-
148-
// Stylistic Issues
149-
// http://eslint.org/docs/rules/#stylistic-issues'
150-
'block-spacing': 'error',
151-
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
152-
'comma-dangle': ['error', 'only-multiline'],
153-
'comma-spacing': 'error',
154-
'comma-style': 'error',
155-
'computed-property-spacing': 'error',
156-
'eol-last': 'error',
157-
'func-call-spacing': 'error',
158-
'func-name-matching': 'error',
159-
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
160-
indent: ['error', 2, {
161-
ArrayExpression: 'first',
162-
CallExpression: { arguments: 'first' },
163-
FunctionDeclaration: { parameters: 'first' },
164-
FunctionExpression: { parameters: 'first' },
165-
MemberExpression: 'off',
166-
ObjectExpression: 'first',
167-
SwitchCase: 1,
168-
}],
169-
'key-spacing': ['error', { mode: 'strict' }],
170-
'keyword-spacing': 'error',
171-
'linebreak-style': ['error', 'unix'],
172-
'max-len': ['error', {
173-
code: 80,
174-
ignorePattern: '^// Flags:',
175-
ignoreRegExpLiterals: true,
176-
ignoreUrls: true,
177-
tabWidth: 2,
178-
}],
179-
'new-parens': 'error',
180-
'no-lonely-if': 'error',
181-
'no-mixed-spaces-and-tabs': 'error',
182-
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }],
183150
/* eslint-disable max-len, quotes */
184151
'no-restricted-syntax': [
185152
'error',
@@ -209,15 +176,41 @@ module.exports = {
209176
}
210177
],
211178
/* eslint-enable max-len, quotes */
179+
'no-return-await': 'error',
180+
'no-self-assign': 'error',
181+
'no-self-compare': 'error',
212182
'no-tabs': 'error',
183+
'no-template-curly-in-string': 'error',
184+
'no-this-before-super': 'error',
185+
'no-throw-literal': 'error',
213186
'no-trailing-spaces': 'error',
187+
'no-undef': 'error',
188+
'no-undef-init': 'error',
189+
'no-unexpected-multiline': 'error',
190+
'no-unreachable': 'error',
214191
'no-unsafe-finally': 'error',
192+
'no-unsafe-negation': 'error',
193+
'no-unused-labels': 'error',
194+
'no-unused-vars': ['error', { args: 'none' }],
195+
'no-use-before-define': ['error', {
196+
classes: true,
197+
functions: false,
198+
variables: false,
199+
}],
200+
'no-useless-call': 'error',
201+
'no-useless-concat': 'error',
202+
'no-useless-escape': 'error',
203+
'no-useless-return': 'error',
204+
'no-void': 'error',
215205
'no-whitespace-before-property': 'error',
206+
'no-with': 'error',
216207
'object-curly-spacing': ['error', 'always'],
217208
'one-var': ['error', { initialized: 'never' }],
218209
'one-var-declaration-per-line': 'error',
219210
'operator-linebreak': ['error', 'after'],
211+
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
220212
quotes: ['error', 'single', { avoidEscape: true }],
213+
'rest-spread-spacing': 'error',
221214
semi: 'error',
222215
'semi-spacing': 'error',
223216
'space-before-blocks': ['error', 'always'],
@@ -229,25 +222,14 @@ module.exports = {
229222
'space-in-parens': ['error', 'never'],
230223
'space-infix-ops': 'error',
231224
'space-unary-ops': 'error',
232-
'unicode-bom': 'error',
233-
234-
// ECMAScript 6
235-
// http://eslint.org/docs/rules/#ecmascript-6
236-
'arrow-parens': ['error', 'always'],
237-
'arrow-spacing': ['error', { before: true, after: true }],
238-
'constructor-super': 'error',
239-
'no-class-assign': 'error',
240-
'no-confusing-arrow': 'error',
241-
'no-const-assign': 'error',
242-
'no-dupe-class-members': 'error',
243-
'no-new-symbol': 'error',
244-
'no-this-before-super': 'error',
245-
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
246-
'rest-spread-spacing': 'error',
225+
strict: ['error', 'global'],
247226
'symbol-description': 'error',
248227
'template-curly-spacing': 'error',
228+
'unicode-bom': 'error',
229+
'use-isnan': 'error',
230+
'valid-typeof': 'error',
249231

250-
// Custom rules in from eslint-plugin-node-core
232+
// Custom rules from eslint-plugin-node-core
251233
'node-core/no-unescaped-regexp-dot': 'error',
252234
},
253235
globals: {

0 commit comments

Comments
 (0)