[eslint config] [base] [breaking] re-order rules

This commit is contained in:
akai
2016-05-16 23:28:20 +08:00
parent 10f4dd88aa
commit 3948eb66d6
8 changed files with 79 additions and 86 deletions

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

@@ -26,9 +26,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 +57,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 +64,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 +72,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 +94,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 +101,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,

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

@@ -26,6 +26,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,

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,