diff --git a/.eslintrc.js b/.eslintrc.js index f7dbd14b8..d0d542708 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -41,167 +41,165 @@ module.exports = { "RegisterPopup": false, "ReplayUploadedPopup": false, "RulesPopup": false, "TabListPopup": false, "TournamentBox": false, "CustomBackgroundPopup": false }, + "extends": "eslint:recommended", "rules": { - "comma-dangle": [2, "never"], - "no-cond-assign": [2, "except-parens"], - "no-console": 0, - "no-constant-condition": 0, - "no-control-regex": 0, - "no-debugger": 2, - "no-dupe-args": 2, - "no-dupe-keys": 2, - "no-duplicate-case": 2, - "no-empty-character-class": 2, - "no-empty": 0, - "no-ex-assign": 2, - "no-extra-boolean-cast": 2, - "no-extra-parens": 0, - "no-extra-semi": 2, - "no-func-assign": 2, - "no-inner-declarations": [2, "functions"], - "no-invalid-regexp": 2, - "no-irregular-whitespace": 2, - "no-negated-in-lhs": 2, - "no-obj-calls": 2, - "no-regex-spaces": 2, - "no-sparse-arrays": 2, - "no-unexpected-multiline": 2, - "no-unreachable": 2, - "use-isnan": 2, - "valid-jsdoc": 0, - "valid-typeof": 2, + "no-cond-assign": ["error", "except-parens"], + "no-console": "off", + "no-constant-condition": "off", + "no-control-regex": "off", + "no-empty": ["error", {"allowEmptyCatch": true}], + "no-inner-declarations": ["error", "functions"], + "no-redeclare": "off", + "valid-jsdoc": "off", - "array-callback-return": 2, - "block-scoped-var": 0, - "complexity": 0, - "consistent-return": 0, - "default-case": 0, - "dot-location": [2, "property"], - "dot-notation": 0, - "eqeqeq": 0, - "guard-for-in": 0, - "no-caller": 2, - "no-case-declarations": 0, - "no-div-regex": 2, - "no-else-return": 0, - "no-labels": [2, {"allowLoop": true, "allowSwitch": true}], - "no-empty-pattern": 1, - "no-eval": 0, - "no-implied-eval": 2, - "no-extend-native": 2, - "no-extra-bind": 1, - "no-extra-label": 2, - "no-fallthrough": 2, - "no-implicit-coercion": 0, - "no-invalid-this": 0, - "no-lone-blocks": 0, - "no-loop-func": 0, - "no-magic-numbers": 0, - "no-multi-spaces": 1, - "no-multi-str": 2, - "no-native-reassign": 2, - "no-new-func": 2, - "no-new-wrappers": 2, - "no-octal-escape": 2, - "no-octal": 2, - "no-param-reassign": 0, - "no-proto": 2, - "no-return-assign": [2, "except-parens"], - "no-self-assign": 2, - "no-self-compare": 2, - "no-sequences": 2, - "no-throw-literal": 2, - "no-unmodified-loop-condition": 2, - "no-unused-expressions": 2, - "no-unused-labels": 2, - "no-useless-call": 2, - "no-useless-concat": 0, - "no-void": 0, - "no-warning-comments": 0, - "no-with": 2, - "radix": 1, - "vars-on-top": 0, - "wrap-iife": [2, "inside"], - "yoda": 0, - "strict": 0, - "init-declarations": 0, - "no-catch-shadow": 0, - "no-delete-var": 2, - "no-label-var": 2, - "no-shadow-restricted-names": 2, - "no-shadow": 0, - "no-undef-init": 1, - "no-undef": [2, {"typeof": true}], - "no-undefined": 0, - "no-unused-vars": 0, - "no-new-require": 2, + "array-callback-return": "error", + "complexity": "off", + "consistent-return": "off", + "default-case": "off", + "dot-location": ["error", "property"], + "dot-notation": "off", + "eqeqeq": "off", + "guard-for-in": "off", + "no-caller": "error", + "no-case-declarations": "off", + "no-div-regex": "error", + "no-else-return": "off", + "no-labels": ["error", {"allowLoop": true, "allowSwitch": true}], + "no-eval": "off", + "no-implied-eval": "error", + "no-extend-native": "error", + "no-extra-bind": "warn", + "no-extra-label": "error", + "no-extra-parens": "off", + "no-implicit-coercion": "off", + "no-invalid-this": "off", + "no-iterator": "error", + "no-lone-blocks": "off", + "no-loop-func": "off", + "no-magic-numbers": "off", + "no-multi-spaces": "warn", + "no-multi-str": "error", + "no-new-func": "error", + "no-new-wrappers": "error", + "no-octal-escape": "error", + "no-param-reassign": "off", + "no-proto": "error", + "no-prototype-builtins": "error", + "no-return-assign": ["error", "except-parens"], + "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": "off", + "no-void": "off", + "no-warning-comments": "off", + "no-with": "error", + "radix": ["error", "always"], + "vars-on-top": "off", + "wrap-iife": ["error", "inside"], + "yoda": "off", - "array-bracket-spacing": [2, "never"], - "block-spacing": 0, - "brace-style": [2, "1tbs", {"allowSingleLine": true}], - "camelcase": 0, - "comma-spacing": [2, {"before": false, "after": true}], - "comma-style": [2, "last"], - "computed-property-spacing": [2, "never"], - "consistent-this": 0, - "eol-last": os.EOL === '\n' ? [2, "unix"] : 0, - "func-names": 0, - "func-style": 0, - "id-length": 0, - "id-match": 0, - "indent": [2, "tab"], - "key-spacing": 0, - "linebreak-style": os.EOL === '\n' ? [2, "unix"] : 0, - "lines-around-comment": 0, - "max-nested-callbacks": 0, - "max-statements-per-line": 0, - "new-parens": 2, - "newline-after-var": 0, - "newline-before-return": 0, - "no-array-constructor": 2, - "no-continue": 0, - "no-inline-comments": 0, - "no-lonely-if": 0, - "no-mixed-spaces-and-tabs": [2, "smart-tabs"], - "no-multiple-empty-lines": [2, {"max": 2, "maxEOF": 1}], - "no-negated-condition": 0, - "no-nested-ternary": 0, - "no-new-object": 2, - "no-spaced-func": 2, - "no-ternary": 0, - "no-trailing-spaces": 2, - "no-underscore-dangle": 0, - "no-unneeded-ternary": 2, - "object-curly-spacing": [2, "never"], - "one-var": 0, - "operator-assignment": 0, - "operator-linebreak": [2, "after"], - "quote-props": 0, - "quotes": 0, - "require-jsdoc": 0, - "semi-spacing": [2, {"before": false, "after": true}], - "semi": [2, "always"], - "sort-vars": 0, - "keyword-spacing": [2, {"before": true, "after": true}], - "space-before-blocks": [2, "always"], - "space-before-function-paren": [2, {"anonymous": "always", "named": "never"}], - "space-in-parens": [2, "never"], - "space-infix-ops": 2, - "space-unary-ops": [2, {"words": true, "nonwords": false}], - "spaced-comment": 0, - "wrap-regex": 0 + "init-declarations": "off", + "no-catch-shadow": "off", + "no-label-var": "error", + "no-restricted-globals": ["error", "Proxy", "Reflect", "Symbol", "WeakSet"], + "no-shadow-restricted-names": "error", + "no-shadow": "off", + "no-undef-init": "warn", + "no-undef": ["error", {"typeof": true}], + "no-undefined": "off", + "no-unused-vars": "off", + + "no-mixed-requires": "error", + "no-new-require": "error", + "no-path-concat": "off", + "no-process-env": "off", + "no-process-exit": "off", + "no-restricted-modules": ["error", "moment", "request", "sugar"], + "no-sync": "off", + + "array-bracket-spacing": ["error", "never"], + "block-spacing": "off", + "brace-style": ["error", "1tbs", {"allowSingleLine": true}], + "camelcase": "off", + "comma-spacing": ["error", {"before": false, "after": true}], + "comma-style": ["error", "last"], + "computed-property-spacing": ["error", "never"], + "consistent-this": "off", + "func-names": "off", + "func-style": "off", + "id-length": "off", + "id-match": "off", + "indent": ["error", "tab"], + "key-spacing": "off", + "lines-around-comment": "off", + "max-nested-callbacks": "off", + "max-statements-per-line": "off", + "new-parens": "error", + "newline-after-var": "off", + "newline-before-return": "off", + "no-array-constructor": "error", + "no-continue": "off", + "no-inline-comments": "off", + "no-lonely-if": "off", + "no-mixed-spaces-and-tabs": ["error", "smart-tabs"], + "no-multiple-empty-lines": ["error", {"max": 2, "maxEOF": 1}], + "no-negated-condition": "off", + "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", + "object-curly-spacing": ["error", "never"], + "one-var": "off", + "operator-assignment": "off", + "operator-linebreak": ["error", "after"], + "quote-props": "off", + "quotes": "off", + "require-jsdoc": "off", + "semi-spacing": ["error", {"before": false, "after": true}], + "semi": ["error", "always"], + "sort-vars": "off", + "keyword-spacing": ["error", {"before": true, "after": true}], + "space-before-blocks": ["error", "always"], + "space-before-function-paren": ["error", {"anonymous": "always", "named": "never"}], + "space-in-parens": ["error", "never"], + "space-infix-ops": "error", + "space-unary-ops": ["error", {"words": true, "nonwords": false}], + "wrap-regex": "off", + + "arrow-parens": ["error", "as-needed"], + "arrow-spacing": ["error", {"before": true, "after": true}], + "no-confusing-arrow": "off", + "no-useless-computed-key": "error", + "no-useless-rename": "error", + "prefer-arrow-callback": "off", + "rest-spread-spacing": ["error", "never"], + "template-curly-spacing": ["error", "never"], + "no-restricted-syntax": ["error", "TaggedTemplateExpression", "ObjectPattern", "ArrayPattern"], // Rules enabled in the server code, but disabled here /* - "curly": [2, "multi-line", "consistent"], - "no-floating-decimal": 2, - "no-new": 2, - "no-redeclare": 2, - "no-unused-vars": [1, {"args": "none"}], - "no-use-before-define": [2, {"functions": false, "classes": false}], - "new-cap": [2, {"newIsCap": true, "capIsNew: false}], - "padded-blocks": [2, "never"], - "validate-conditionals": 2 + "block-scoped-var": "error", + "callback-return": [2, ["callback", "cb", "done"]], + "comma-dangle": ["error", "always-multiline"], + "curly": ["error", "multi-line", "consistent"], + "eqeqeq": "error", + "no-constant-condition": "error", + "no-floating-decimal": "error", + "no-new": "error", + "no-redeclare": "error", + "no-unused-vars": ["warn", {"args": "none"}], + "no-use-before-define": ["error", {"functions": false, "classes": false}], + "no-var": "error", + "new-cap": ["error", {"newIsCap": true, "capIsNew: false}], + "padded-blocks": ["error", "never"], + "strict": ["error", "global"], + "validate-conditionals": "error" */ } }; diff --git a/js/client-battle.js b/js/client-battle.js index 5df570c10..29cd0f7cd 100644 --- a/js/client-battle.js +++ b/js/client-battle.js @@ -174,7 +174,7 @@ this.battle.activityQueue.push('|' + args.join('|')); break; } - } else if (logLine.substr(0, 7) === '|title|') { + } else if (logLine.substr(0, 7) === '|title|') { // eslint-disable-line no-empty } else if (logLine.substr(0, 5) === '|win|') { this.battleEnded = true; this.battle.activityQueue.push(logLine); diff --git a/package.json b/package.json index 356324e28..16c440b83 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "dependencies": {}, "devDependencies": { - "eslint": "~2.12.0" + "eslint": "^3.2.2" }, "private": true }