Merge pull request #881 from akai/re-order-rules

[eslint config] [base] [breaking] Rearrange rules/rule files.
This commit is contained in:
Jordan Harband
2016-05-16 22:40:38 -05:00
10 changed files with 206 additions and 208 deletions

View File

@@ -2,6 +2,7 @@ module.exports = {
extends: [
'./legacy',
'./rules/es6',
'./rules/imports',
].map(require.resolve),
parserOptions: {
ecmaVersion: 7,

View File

@@ -2,7 +2,6 @@ module.exports = {
extends: [
'./rules/best-practices',
'./rules/errors',
'./rules/legacy',
'./rules/node',
'./rules/style',
'./rules/variables'

View File

@@ -35,10 +35,6 @@ module.exports = {
// make sure for-in loops have an if statement
'guard-for-in': 2,
// Blacklist certain identifiers to prevent them being used
// http://eslint.org/docs/rules/id-blacklist
'id-blacklist': 0,
// disallow the use of alert, confirm, and prompt
'no-alert': 1,
@@ -69,10 +65,6 @@ module.exports = {
// http://eslint.org/docs/rules/no-empty-pattern
'no-empty-pattern': 2,
// disallow Unnecessary Labels
// http://eslint.org/docs/rules/no-extra-label
'no-extra-label': 2,
// disallow comparisons to null without a type-checking operator
'no-eq-null': 0,
@@ -85,6 +77,10 @@ module.exports = {
// disallow unnecessary function binding
'no-extra-bind': 2,
// disallow Unnecessary Labels
// http://eslint.org/docs/rules/no-extra-label
'no-extra-label': 2,
// disallow fallthrough of case statements
'no-fallthrough': 2,
@@ -94,6 +90,10 @@ module.exports = {
// disallow the type conversions with shorter notations
'no-implicit-coercion': 0,
// disallow var and named functions in global scope
// http://eslint.org/docs/rules/no-implicit-globals
'no-implicit-globals': 0,
// disallow use of eval()-like methods
'no-implied-eval': 2,
@@ -151,31 +151,22 @@ module.exports = {
// rule: http://eslint.org/docs/rules/no-param-reassign.html
'no-param-reassign': [2, { 'props': true }],
// disallow use of process.env
'no-process-env': 0,
// disallow usage of __proto__ property
'no-proto': 2,
// disallow declaring the same variable more then once
'no-redeclare': 2,
// disallow certain syntax forms
// http://eslint.org/docs/rules/no-restricted-syntax
'no-restricted-syntax': [
2,
'DebuggerStatement',
'ForInStatement',
'LabeledStatement',
'WithStatement',
],
// disallow use of assignment in return statement
'no-return-assign': 2,
// disallow use of `javascript:` urls.
'no-script-url': 2,
// disallow self assignment
// http://eslint.org/docs/rules/no-self-assign
'no-self-assign': 2,
// disallow comparisons where both sides are exactly the same
'no-self-compare': 2,
@@ -189,10 +180,6 @@ module.exports = {
// http://eslint.org/docs/rules/no-unmodified-loop-condition
'no-unmodified-loop-condition': 0,
// disallow return/throw/break/continue inside finally blocks
// http://eslint.org/docs/rules/no-unsafe-finally
'no-unsafe-finally': 2,
// disallow usage of expressions in statement position
'no-unused-expressions': 2,

View File

@@ -1,5 +1,8 @@
module.exports = {
'rules': {
// require trailing commas in multiline object literals
'comma-dangle': [2, 'always-multiline'],
// disallow assignment in conditional expressions
'no-cond-assign': [2, 'always'],
@@ -24,12 +27,12 @@ module.exports = {
// disallow a duplicate case label.
'no-duplicate-case': 2,
// disallow the use of empty character classes in regular expressions
'no-empty-character-class': 2,
// disallow empty statements
'no-empty': 2,
// disallow the use of empty character classes in regular expressions
'no-empty-character-class': 2,
// disallow assigning to the exception in a catch block
'no-ex-assign': 2,
@@ -71,9 +74,16 @@ module.exports = {
// disallow sparse arrays
'no-sparse-arrays': 2,
// Avoid code that looks like two expressions but is actually one
'no-unexpected-multiline': 0,
// disallow unreachable statements after a return, throw, continue, or break statement
'no-unreachable': 2,
// disallow return/throw/break/continue inside finally blocks
// http://eslint.org/docs/rules/no-unsafe-finally
'no-unsafe-finally': 2,
// disallow comparisons with the value NaN
'use-isnan': 2,
@@ -82,9 +92,6 @@ module.exports = {
'valid-jsdoc': 0,
// ensure that the results of typeof are compared against a valid string
'valid-typeof': 2,
// Avoid code that looks like two expressions but is actually one
'no-unexpected-multiline': 0
'valid-typeof': 2
}
};

View File

@@ -10,9 +10,6 @@ module.exports = {
'objectLiteralDuplicateProperties': false
}
},
'plugins': [
'import'
],
'rules': {
// enforces no braces where they can be omitted
@@ -26,9 +23,6 @@ module.exports = {
// http://eslint.org/docs/rules/arrow-spacing
'arrow-spacing': [2, { 'before': true, 'after': true }],
// require trailing commas in multiline object literals
'comma-dangle': [2, 'always-multiline'],
// verify super() callings in constructors
'constructor-super': 0,
@@ -60,9 +54,6 @@ module.exports = {
// http://eslint.org/docs/rules/no-new-symbol
'no-new-symbol': 2,
// disallow specific globals
'no-restricted-globals': 0,
// disallow specific imports
// http://eslint.org/docs/rules/no-restricted-imports
'no-restricted-imports': 0,
@@ -70,9 +61,6 @@ module.exports = {
// disallow to use this/super before super() calling in constructors.
'no-this-before-super': 0,
// require let or const instead of var
'no-var': 2,
// disallow useless computed property keys
// http://eslint.org/docs/rules/no-useless-computed-key
'no-useless-computed-key': 2,
@@ -81,6 +69,9 @@ module.exports = {
// http://eslint.org/docs/rules/no-useless-constructor
'no-useless-constructor': 2,
// require let or const instead of var
'no-var': 2,
// require method and property shorthand syntax for object literals
// http://eslint.org/docs/rules/object-shorthand
'object-shorthand': [2, 'always', {
@@ -100,9 +91,6 @@ module.exports = {
'ignoreReadBeforeAssign': true,
}],
// suggest using the spread operator instead of .apply()
'prefer-spread': 0,
// suggest using Reflect methods where applicable
'prefer-reflect': 0,
@@ -110,6 +98,9 @@ module.exports = {
// http://eslint.org/docs/rules/prefer-rest-params
'prefer-rest-params': 2,
// suggest using the spread operator instead of .apply()
'prefer-spread': 0,
// suggest using template literals instead of string concatenation
// http://eslint.org/docs/rules/prefer-template
'prefer-template': 2,
@@ -127,108 +118,6 @@ module.exports = {
// enforce spacing around the * in yield* expressions
// http://eslint.org/docs/rules/yield-star-spacing
'yield-star-spacing': [2, 'after'],
// disallow invalid exports, e.g. multiple defaults
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md
'import/export': 2,
// ensure default import coupled with default export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
'import/default': 0,
// Ensure consistent use of file extension within the import path
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
// TODO: enable
'import/extensions': [0, 'never'],
// ensure named imports coupled with named exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
'import/named': 0,
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md
'import/namespace': 0,
// Forbid the use of extraneous packages
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
// TODO: enable
'import/no-extraneous-dependencies': [0, {
'devDependencies': false,
'optionalDependencies': false,
}],
// ensure imports point to files/modules that can be resolved
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
'import/no-unresolved': [2, { 'commonjs': true }],
// do not allow a default import name to match a named export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
// TODO: enable
'import/no-named-as-default': 0,
// disallow require()
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
'import/no-commonjs': 0,
// disallow AMD require/define
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md
'import/no-amd': 2,
// disallow non-import statements appearing before import statements
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
// TODO: enable?
'import/imports-first': [0, 'absolute-first'],
// disallow duplicate imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
'import/no-duplicates': 2,
// disallow use of jsdoc-marked-deprecated imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
'import/no-deprecated': 0,
// disallow namespace imports
// TODO: enable?
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
'import/no-namespace': 0,
// warn on accessing default export property names that are also named exports
// TODO: enable?
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
'import/no-named-as-default-member': 0,
// No Node.js builtin modules
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
'import/no-nodejs-modules': 0,
// Enforce a convention in module import order
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
// TODO: enable?
'import/order': [0, {
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'never',
}],
// Require modules with a single export to use a default export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
// TODO: enable
'import/prefer-default-export': 0,
// Require a newline after the last import/require in a group
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
// TODO: enable
'import/newline-after-import': 0,
// Forbid mutable exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
'import/no-mutable-exports': 2,
},
'settings': {
'import/resolver': {
'node': {
'extensions': ['.js', '.json']
}
}
'yield-star-spacing': [2, 'after']
}
};

View File

@@ -0,0 +1,124 @@
module.exports = {
'env': {
'es6': true
},
'parserOptions': {
'ecmaVersion': 6,
'sourceType': 'module'
},
'plugins': [
'import'
],
'settings': {
'import/resolver': {
'node': {
'extensions': ['.js', '.json']
}
}
},
'rules': {
// Static analysis:
// ensure imports point to files/modules that can be resolved
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
'import/no-unresolved': [2, { 'commonjs': true }],
// ensure named imports coupled with named exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
'import/named': 0,
// ensure default import coupled with default export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
'import/default': 0,
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md
'import/namespace': 0,
// Helpful warnings:
// disallow invalid exports, e.g. multiple defaults
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md
'import/export': 2,
// do not allow a default import name to match a named export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
// TODO: enable
'import/no-named-as-default': 0,
// warn on accessing default export property names that are also named exports
// TODO: enable?
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
'import/no-named-as-default-member': 0,
// disallow use of jsdoc-marked-deprecated imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
'import/no-deprecated': 0,
// Forbid the use of extraneous packages
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
// TODO: enable
'import/no-extraneous-dependencies': [0, {
'devDependencies': false,
'optionalDependencies': false,
}],
// Forbid mutable exports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
'import/no-mutable-exports': 2,
// Module systems:
// disallow require()
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
'import/no-commonjs': 0,
// disallow AMD require/define
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md
'import/no-amd': 2,
// No Node.js builtin modules
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
'import/no-nodejs-modules': 0,
// Style guide:
// disallow non-import statements appearing before import statements
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
// TODO: enable?
'import/imports-first': [0, 'absolute-first'],
// disallow duplicate imports
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
'import/no-duplicates': 2,
// disallow namespace imports
// TODO: enable?
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
'import/no-namespace': 0,
// Ensure consistent use of file extension within the import path
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
// TODO: enable
'import/extensions': [0, 'never'],
// Enforce a convention in module import order
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
// TODO: enable?
'import/order': [0, {
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'never',
}],
// Require a newline after the last import/require in a group
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
// TODO: enable
'import/newline-after-import': 0,
// Require modules with a single export to use a default export
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
// TODO: enable
'import/prefer-default-export': 0
}
};

View File

@@ -1,21 +0,0 @@
module.exports = {
'rules': {
// disallow trailing commas in object literals
'comma-dangle': [2, 'never'],
// specify the maximum depth that blocks can be nested
'max-depth': [0, 4],
// limits the number of parameters that can be used in the function declaration.
'max-params': [0, 3],
// specify the maximum number of statement allowed in a function
'max-statements': [0, 10],
// disallow use of bitwise operators
'no-bitwise': 0,
// disallow use of unary operators, ++ and --
'no-plusplus': 0
}
};

View File

@@ -2,9 +2,6 @@ module.exports = {
'env': {
'node': true
},
'plugins': [
'import'
],
'rules': {
// enforce return after a callback
@@ -26,6 +23,9 @@ module.exports = {
// disallow string concatenation with __dirname and __filename
'no-path-concat': 0,
// disallow use of process.env
'no-process-env': 0,
// disallow process.exit()
'no-process-exit': 0,
@@ -33,18 +33,6 @@ module.exports = {
'no-restricted-modules': 0,
// disallow use of synchronous methods (off by default)
'no-sync': 0,
// ensure imports point to files/modules that can be resolved
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
'import/no-unresolved': [2, { 'commonjs': true }]
},
'settings': {
'import/resolver': {
'node': {
'extensions': ['.js', '.json']
}
}
'no-sync': 0
}
};

View File

@@ -34,10 +34,17 @@ module.exports = {
// enforces use of function declarations or expressions
'func-style': 0,
// Blacklist certain identifiers to prevent them being used
// http://eslint.org/docs/rules/id-blacklist
'id-blacklist': 0,
// this option enforces minimum and maximum identifier lengths
// (variable names, property names etc.)
'id-length': 0,
// require identifiers to match the provided regular expression
'id-match': 0,
// this option sets a specific tab width for your code
// http://eslint.org/docs/rules/indent
'indent': [2, 2, { 'SwitchCase': 1, 'VariableDeclarator': 1 }],
@@ -60,11 +67,14 @@ module.exports = {
}
}],
// disallow mixed 'LF' and 'CRLF' as linebreaks
'linebreak-style': 0,
// enforces empty lines around comments
'lines-around-comment': 0,
// disallow mixed 'LF' and 'CRLF' as linebreaks
'linebreak-style': 0,
// specify the maximum depth that blocks can be nested
'max-depth': [0, 4],
// specify the maximum length of a line in your program
// http://eslint.org/docs/rules/max-len
@@ -76,6 +86,12 @@ module.exports = {
// specify the maximum depth callbacks can be nested
'max-nested-callbacks': 0,
// limits the number of parameters that can be used in the function declaration.
'max-params': [0, 3],
// specify the maximum number of statement allowed in a function
'max-statements': [0, 10],
// restrict the number of statements per line
// http://eslint.org/docs/rules/max-statements-per-line
'max-statements-per-line': [0, { 'max': 1 }],
@@ -100,6 +116,9 @@ module.exports = {
// disallow use of the Array constructor
'no-array-constructor': 2,
// disallow use of bitwise operators
'no-bitwise': 0,
// disallow use of the continue statement
'no-continue': 0,
@@ -125,6 +144,19 @@ module.exports = {
// disallow use of the Object constructor
'no-new-object': 2,
// disallow use of unary operators, ++ and --
'no-plusplus': 0,
// disallow certain syntax forms
// http://eslint.org/docs/rules/no-restricted-syntax
'no-restricted-syntax': [
2,
'DebuggerStatement',
'ForInStatement',
'LabeledStatement',
'WithStatement',
],
// disallow space between function identifier and application
'no-spaced-func': 2,
@@ -179,19 +211,16 @@ module.exports = {
// specify whether double or single quotes should be used
'quotes': [2, 'single', 'avoid-escape'],
// require identifiers to match the provided regular expression
'id-match': 0,
// do not require jsdoc
// http://eslint.org/docs/rules/require-jsdoc
'require-jsdoc': 0,
// enforce spacing before and after semicolons
'semi-spacing': [2, { 'before': false, 'after': true }],
// require or disallow use of semicolons instead of ASI
'semi': [2, 'always'],
// enforce spacing before and after semicolons
'semi-spacing': [2, { 'before': false, 'after': true }],
// sort variables within the same declaration block
'sort-vars': 0,

View File

@@ -9,29 +9,24 @@ module.exports = {
// disallow deletion of variables
'no-delete-var': 2,
// disallow var and named functions in global scope
// http://eslint.org/docs/rules/no-implicit-globals
'no-implicit-globals': 0,
// disallow labels that share a name with a variable
'no-label-var': 0,
// disallow self assignment
// http://eslint.org/docs/rules/no-self-assign
'no-self-assign': 2,
// disallow shadowing of names such as arguments
'no-shadow-restricted-names': 2,
// disallow specific globals
'no-restricted-globals': 0,
// disallow declaration of variables already declared in the outer scope
'no-shadow': 2,
// disallow use of undefined when initializing variables
'no-undef-init': 0,
// disallow shadowing of names such as arguments
'no-shadow-restricted-names': 2,
// disallow use of undeclared variables unless mentioned in a /*global */ block
'no-undef': 2,
// disallow use of undefined when initializing variables
'no-undef-init': 0,
// disallow use of undefined variable
'no-undefined': 0,