Refactor ESLint configuration.

This commit is contained in:
Bardi Harborow 2016-10-25 23:18:52 +11:00
parent 4332a5cc02
commit 26c16743fc
3 changed files with 263 additions and 199 deletions

View File

@ -1,206 +1,230 @@
{
"root": true,
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module"
},
"env": {
"browser": true,
"es6": true,
"jquery": true
},
"rules": {
"root": true,
"parser": "babel-eslint",
"env": {
"browser": true,
"es6": true,
"jquery": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
},
"rules": {
// Possible Errors
"no-extra-parens": "error",
"no-prototype-builtins": "off",
"no-template-curly-in-string": "error",
"no-unsafe-negation": "error",
"valid-jsdoc": "error",
// Possible Errors
"array-callback-return": "error",
"comma-dangle": ["error", "never"],
"handle-callback-err": "error",
"no-bitwise": "error",
"no-cond-assign": "error",
"no-console": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-dupe-args": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-function": "error",
"no-empty-pattern": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-extra-label": "error",
"no-extra-parens": "off",
"no-extra-semi": "error",
"no-func-assign": "error",
"no-inner-declarations": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-negated-in-lhs": "error",
"no-obj-calls": "error",
"no-regex-spaces": "error",
"no-restricted-globals": ["error", "event"],
"no-self-assign": "error",
"no-sparse-arrays": "error",
"no-unexpected-multiline": "error",
"no-unmodified-loop-condition": "error",
"no-unreachable": "error",
"no-unused-labels": "error",
"no-useless-escape": "error",
"no-useless-rename": "error",
"use-isnan": "error",
"valid-jsdoc": "off",
"valid-typeof": "error",
// Best Practices
"accessor-pairs": "error",
"array-callback-return": "error",
"block-scoped-var": "error",
"class-methods-use-this": "off",
"complexity": "error",
"consistent-return": "error",
"curly": "error",
"default-case": "error",
"dot-location": ["error", "property"],
"dot-notation": "error",
"eqeqeq": "error",
"guard-for-in": "error",
"no-alert": "error",
"no-caller": "error",
"no-div-regex": "error",
"no-else-return": "error",
"no-empty-function": "error",
"no-eq-null": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
"no-floating-decimal": "error",
"no-global-assign": "error",
"no-implicit-coercion": "error",
"no-implicit-globals": "error",
"no-implied-eval": "error",
"no-invalid-this": "off",
"no-iterator": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-magic-numbers": ["error", {
"ignore": [-1, 0, 1],
"ignoreArrayIndexes": true
}
],
"no-multi-spaces": ["error", {
"exceptions": {
"AssignmentExpression": true,
"ArrowFunctionExpression": true,
"CallExpression": true,
"VariableDeclarator": true
}
}
],
"no-multi-str": "error",
"no-new-func": "off",
"no-new-wrappers": "error",
"no-new": "error",
"no-octal-escape": "error",
"no-param-reassign": "off",
"no-proto": "error",
"no-restricted-properties": "error",
"no-return-assign": "off",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-unmodified-loop-condition": "error",
"no-unused-expressions": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-escape": "error",
"no-void": "error",
"no-warning-comments": "off",
"no-with": "error",
"radix": "error",
"vars-on-top": "error",
"wrap-iife": "error",
"yoda": "error",
//Best Practices
"accessor-pairs": "error",
"block-scoped-var": "error",
"consistent-return": "error",
"curly": "error",
"default-case": "error",
"dot-location": "off",
"dot-notation": "off",
"eqeqeq": "error",
"guard-for-in": "error",
"no-alert": "error",
"no-caller": "error",
"no-case-declarations": "error",
"no-div-regex": "error",
"no-else-return": "error",
"no-eq-null": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-fallthrough": "error",
"no-floating-decimal": "error",
"no-implicit-coercion": "error",
"no-implied-eval": "error",
"no-invalid-this": "off",
"no-iterator": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-magic-numbers": ["error", {"ignore": [-1, 0, 1]}],
"no-multi-spaces": "off",
"no-multi-str": "error",
"no-native-reassign": "error",
"no-new": "error",
"no-new-func": "off",
"no-new-wrappers": "error",
"no-octal": "error",
"no-octal-escape": "error",
"no-param-reassign": "off",
"no-process-env": "error",
"no-proto": "error",
"no-redeclare": "error",
"no-return-assign": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-unused-expressions": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-void": "error",
"no-warning-comments": "off",
"no-with": "error",
"radix": "error",
"unicode-bom": ["error", "never"],
"vars-on-top": "off",
"wrap-iife": "error",
"yoda": "error",
// Strict Mode
"strict": "error",
// Variables
"init-declarations": "off",
"no-catch-shadow": "error",
"no-delete-var": "error",
"no-label-var": "error",
"no-shadow": "off",
"no-shadow-restricted-names": "error",
"no-undef": "error",
"no-undefined": "off",
"no-undef-init": "error",
"no-unused-vars": "error",
"no-use-before-define": "off",
// Variables
"init-declarations": "off",
"no-catch-shadow": "error",
"no-label-var": "error",
"no-restricted-globals": "error",
"no-shadow-restricted-names": "error",
"no-shadow": "off",
"no-undef-init": "error",
"no-undefined": "off",
"no-use-before-define": "off",
// Stylistic
"array-bracket-spacing": "error",
"block-spacing": "error",
"brace-style": "error",
"camelcase": "error",
"comma-spacing": "error",
"comma-style": "error",
"computed-property-spacing": "error",
"consistent-this": "error",
"eol-last": "error",
"func-names": "off",
"func-style": "off",
"indent": ["error", 2, {"SwitchCase": 1}],
"key-spacing": "off",
"keyword-spacing": "error",
"linebreak-style": "error",
"lines-around-comment": "off",
"max-statements-per-line": ["error", { "max": 1 }],
"new-cap": "off",
"newline-after-var": "off",
"new-parens": "error",
"no-array-constructor": "error",
"no-continue": "off",
"no-inline-comments": "off",
"no-lonely-if": "error",
"no-mixed-spaces-and-tabs": "error",
"no-multiple-empty-lines": "error",
"no-nested-ternary": "off",
"no-new-object": "error",
"no-spaced-func": "error",
"no-ternary": "off",
"no-trailing-spaces": "error",
"no-underscore-dangle": "off",
"no-unneeded-ternary": "error",
"no-unsafe-finally": "error",
"no-useless-computed-key": "error",
"no-whitespace-before-property": "error",
"object-curly-spacing": ["warn", "always"],
"object-property-newline": "error",
"one-var": "off",
"operator-assignment": "error",
"operator-linebreak": "off",
"padded-blocks": "off",
"quote-props": ["error", "as-needed"],
"quotes": ["error", "single"],
"semi": ["error", "never"],
"semi-spacing": "error",
"sort-vars": "error",
"space-before-blocks": "error",
"space-before-function-paren": "off",
"spaced-comment": "error",
"space-infix-ops": "error",
"space-in-parens": "error",
"space-unary-ops": "error",
// Node.js and CommonJS
"callback-return": "off",
"global-require": "error",
"handle-callback-err": "error",
"no-mixed-requires": "error",
"no-new-require": "error",
"no-path-concat": "error",
"no-process-env": "error",
"no-process-exit": "error",
"no-restricted-modules": "error",
"no-sync": "error",
// es6
"arrow-parens": "error",
"arrow-spacing": "error",
"constructor-super": "error",
"generator-star-spacing": "error",
"no-class-assign": "error",
"no-const-assign": "error",
"no-dupe-class-members": "error",
"no-new-symbol": "error",
"no-this-before-super": "error",
"no-var": "error",
"object-shorthand": "error",
"prefer-arrow-callback": "error",
"prefer-const": "off",
"prefer-reflect": "off",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"require-yield": "error"
// Stylistic Issues
"array-bracket-spacing": "error",
"block-spacing": "error",
"brace-style": "error",
"camelcase": "error",
"comma-dangle": "error",
"comma-spacing": "error",
"comma-style": "error",
"computed-property-spacing": "error",
"consistent-this": "error",
"eol-last": "error",
"func-call-spacing": "error",
"func-names": "off",
"func-style": ["error", "declaration"],
"id-blacklist": "error",
"id-length": "off",
"id-match": "error",
"indent": ["error", 2, { "SwitchCase": 1 }],
"jsx-quotes": "error",
"key-spacing": "off",
"keyword-spacing": "error",
"line-comment-position": "off",
"linebreak-style": ["error", "unix"],
"lines-around-comment": "off",
"lines-around-directive": "error",
"max-depth": ["error", 10],
"max-len": "off",
"max-lines": "off",
"max-nested-callbacks": "error",
"max-params": "off",
"max-statements-per-line": "error",
"max-statements": "off",
"multiline-ternary": "off",
"new-cap": ["error", { "capIsNewExceptionPattern": "$.*" }],
"new-parens": "error",
"newline-after-var": "off",
"newline-before-return": "off",
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 5 }],
"no-array-constructor": "error",
"no-bitwise": "error",
"no-continue": "off",
"no-inline-comments": "off",
"no-lonely-if": "error",
"no-mixed-operators": "off",
"no-multiple-empty-lines": "error",
"no-negated-condition": "off",
"no-nested-ternary": "error",
"no-new-object": "error",
"no-plusplus": "off",
"no-restricted-syntax": "error",
"no-tabs": "error",
"no-ternary": "off",
"no-trailing-spaces": "error",
"no-underscore-dangle": "off",
"no-unneeded-ternary": "error",
"no-whitespace-before-property": "error",
"object-curly-newline": ["error", { "minProperties": 1 }],
"object-curly-spacing": ["error", "always"],
"object-property-newline": "error",
"one-var-declaration-per-line": "error",
"one-var": ["error", "never"],
"operator-assignment": "error",
"operator-linebreak": "off",
"padded-blocks": "off",
"quote-props": ["error", "as-needed"],
"quotes": ["error", "single"],
"require-jsdoc": "off",
"semi-spacing": "error",
"semi": ["error", "never"],
"sort-keys": "off",
"sort-vars": "error",
"space-before-blocks": "error",
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never"
}],
"space-in-parens": "error",
"space-infix-ops": "error",
"space-unary-ops": "error",
"spaced-comment": "error",
"unicode-bom": "error",
"wrap-regex": "off",
}
// ECMAScript 6
"arrow-body-style": "off",
"arrow-parens": "error",
"arrow-spacing": "error",
"generator-star-spacing": "error",
"no-confusing-arrow": "error",
"no-duplicate-imports": "error",
"no-restricted-imports": "error",
"no-useless-computed-key": "error",
"no-useless-constructor": "error",
"no-useless-rename": "error",
"no-var": "error",
"object-shorthand": "error",
"prefer-arrow-callback": "error",
"prefer-const": "error",
"prefer-numeric-literals": "error",
"prefer-reflect": "off",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"rest-spread-spacing": "error",
"sort-imports": "error",
"symbol-description": "error",
"template-curly-spacing": "error",
"yield-star-spacing": "error"
}
}

40
js/tests/.eslintrc.json Normal file
View File

@ -0,0 +1,40 @@
{
"env": {
"qunit": true,
"es6": false
},
"globals": {
"Util": false
},
"parserOptions": {
"ecmaVersion": 5,
"sourceType": "script"
},
"rules": {
// Best Practices
"consistent-return": "off",
"no-alert": "off",
"no-console": "off",
"no-empty-function": "off",
"no-extend-native": "off",
"no-magic-numbers": "off",
"vars-on-top": "off",
// Strict Mode
"strict": "off",
// Stylistic Issues
"brace-style": "off",
"func-style": "off",
"max-statements-per-line": "off",
"object-curly-newline": "off",
"object-property-newline": "off",
// ECMAScript 6
"no-var": "off",
"object-shorthand": "off",
"prefer-arrow-callback": "off",
"prefer-template": "off",
"prefer-rest-params": "off"
}
}

View File

@ -18,7 +18,7 @@
],
"scripts": {
"change-version": "node grunt/change-version.js",
"eslint": "eslint --config js/.eslintrc.json js/src",
"eslint": "eslint --ignore-path .eslintignore js",
"jscs": "jscs --config=js/.jscsrc js/src js/tests/unit docs/assets/js/src grunt Gruntfile.js docs/assets/js/ie-emulation-modes-warning.js docs/assets/js/ie10-viewport-bug-workaround.js",
"htmlhint": "htmlhint --config docs/.htmlhintrc _gh_pages/",
"postcss": "postcss --config grunt/postcss.js --replace dist/css/*.css",