Skip to content

Commit

Permalink
tools: alphabetize ESLint rules
Browse files Browse the repository at this point in the history
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 <cjihrig@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Trott committed Mar 5, 2018
1 parent bd0a7a4 commit c221355
Showing 1 changed file with 87 additions and 105 deletions.
192 changes: 87 additions & 105 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,43 +42,80 @@ module.exports = {
},
],
rules: {
// Possible Errors
// http://eslint.org/docs/rules/#possible-errors
// ESLint built-in rules
// http://eslint.org/docs/rules
'accessor-pairs': 'error',
'array-callback-return': 'error',
'arrow-parens': ['error', 'always'],
'arrow-spacing': ['error', { before: true, after: true }],
'block-spacing': 'error',
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'comma-dangle': ['error', 'only-multiline'],
'comma-spacing': 'error',
'comma-style': 'error',
'computed-property-spacing': 'error',
'constructor-super': 'error',
'dot-location': ['error', 'property'],
'dot-notation': 'error',
'eol-last': 'error',
eqeqeq: ['error', 'smart'],
'for-direction': 'error',
'func-call-spacing': 'error',
'func-name-matching': 'error',
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
indent: ['error', 2, {
ArrayExpression: 'first',
CallExpression: { arguments: 'first' },
FunctionDeclaration: { parameters: 'first' },
FunctionExpression: { parameters: 'first' },
MemberExpression: 'off',
ObjectExpression: 'first',
SwitchCase: 1,
}],
'key-spacing': ['error', { mode: 'strict' }],
'keyword-spacing': 'error',
'linebreak-style': ['error', 'unix'],
'max-len': ['error', {
code: 80,
ignorePattern: '^// Flags:',
ignoreRegExpLiterals: true,
ignoreUrls: true,
tabWidth: 2,
}],
'new-parens': 'error',
'no-class-assign': 'error',
'no-confusing-arrow': 'error',
'no-const-assign': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-delete-var': 'error',
'no-dupe-args': 'error',
'no-dupe-class-members': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty-character-class': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-extra-parens': ['error', 'functions'],
'no-extra-semi': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-global-assign': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-obj-calls': 'error',
'no-template-curly-in-string': 'error',
'no-unexpected-multiline': 'error',
'no-unreachable': 'error',
'no-unsafe-negation': 'error',
'use-isnan': 'error',
'valid-typeof': 'error',

// Best Practices
// http://eslint.org/docs/rules/#best-practices
'accessor-pairs': 'error',
'array-callback-return': 'error',
'dot-location': ['error', 'property'],
'dot-notation': 'error',
eqeqeq: ['error', 'smart'],
'no-fallthrough': 'error',
'no-global-assign': 'error',
'no-lonely-if': 'error',
'no-mixed-requires': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }],
'no-new-require': 'error',
'no-new-symbol': 'error',
'no-obj-calls': 'error',
'no-octal': 'error',
'no-path-concat': 'error',
'no-proto': 'error',
'no-redeclare': 'error',
'no-restricted-modules': ['error', 'sys'],
'no-restricted-properties': [
'error',
{
Expand Down Expand Up @@ -110,76 +147,6 @@ module.exports = {
message: '__defineSetter__ is deprecated.',
}
],
'no-return-await': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-throw-literal': 'error',
'no-unused-labels': 'error',
'no-useless-call': 'error',
'no-useless-concat': 'error',
'no-useless-escape': 'error',
'no-useless-return': 'error',
'no-void': 'error',
'no-with': 'error',

// Strict Mode
// http://eslint.org/docs/rules/#strict-mode
strict: ['error', 'global'],

// Variables
// http://eslint.org/docs/rules/#variables
'no-delete-var': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-unused-vars': ['error', { args: 'none' }],
'no-use-before-define': ['error', {
classes: true,
functions: false,
variables: false,
}],

// Node.js and CommonJS
// http://eslint.org/docs/rules/#nodejs-and-commonjs
'no-mixed-requires': 'error',
'no-new-require': 'error',
'no-path-concat': 'error',
'no-restricted-modules': ['error', 'sys'],

// Stylistic Issues
// http://eslint.org/docs/rules/#stylistic-issues'
'block-spacing': 'error',
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'comma-dangle': ['error', 'only-multiline'],
'comma-spacing': 'error',
'comma-style': 'error',
'computed-property-spacing': 'error',
'eol-last': 'error',
'func-call-spacing': 'error',
'func-name-matching': 'error',
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
indent: ['error', 2, {
ArrayExpression: 'first',
CallExpression: { arguments: 'first' },
FunctionDeclaration: { parameters: 'first' },
FunctionExpression: { parameters: 'first' },
MemberExpression: 'off',
ObjectExpression: 'first',
SwitchCase: 1,
}],
'key-spacing': ['error', { mode: 'strict' }],
'keyword-spacing': 'error',
'linebreak-style': ['error', 'unix'],
'max-len': ['error', {
code: 80,
ignorePattern: '^// Flags:',
ignoreRegExpLiterals: true,
ignoreUrls: true,
tabWidth: 2,
}],
'new-parens': 'error',
'no-lonely-if': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }],
/* eslint-disable max-len, quotes */
'no-restricted-syntax': [
'error',
Expand Down Expand Up @@ -209,15 +176,41 @@ module.exports = {
}
],
/* eslint-enable max-len, quotes */
'no-return-await': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-tabs': 'error',
'no-template-curly-in-string': 'error',
'no-this-before-super': 'error',
'no-throw-literal': 'error',
'no-trailing-spaces': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-unexpected-multiline': 'error',
'no-unreachable': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-unused-labels': 'error',
'no-unused-vars': ['error', { args: 'none' }],
'no-use-before-define': ['error', {
classes: true,
functions: false,
variables: false,
}],
'no-useless-call': 'error',
'no-useless-concat': 'error',
'no-useless-escape': 'error',
'no-useless-return': 'error',
'no-void': 'error',
'no-whitespace-before-property': 'error',
'no-with': 'error',
'object-curly-spacing': ['error', 'always'],
'one-var': ['error', { initialized: 'never' }],
'one-var-declaration-per-line': 'error',
'operator-linebreak': ['error', 'after'],
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
quotes: ['error', 'single', { avoidEscape: true }],
'rest-spread-spacing': 'error',
semi: 'error',
'semi-spacing': 'error',
'space-before-blocks': ['error', 'always'],
Expand All @@ -229,25 +222,14 @@ module.exports = {
'space-in-parens': ['error', 'never'],
'space-infix-ops': 'error',
'space-unary-ops': 'error',
'unicode-bom': 'error',

// ECMAScript 6
// http://eslint.org/docs/rules/#ecmascript-6
'arrow-parens': ['error', 'always'],
'arrow-spacing': ['error', { before: true, after: true }],
'constructor-super': 'error',
'no-class-assign': 'error',
'no-confusing-arrow': 'error',
'no-const-assign': 'error',
'no-dupe-class-members': 'error',
'no-new-symbol': 'error',
'no-this-before-super': 'error',
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
'rest-spread-spacing': 'error',
strict: ['error', 'global'],
'symbol-description': 'error',
'template-curly-spacing': 'error',
'unicode-bom': 'error',
'use-isnan': 'error',
'valid-typeof': 'error',

// Custom rules in from eslint-plugin-node-core
// Custom rules from eslint-plugin-node-core
'node-core/no-unescaped-regexp-dot': 'error',
},
globals: {
Expand Down

0 comments on commit c221355

Please sign in to comment.