diff --git a/.eslintrc.js b/.eslintrc.js index d78014fe9..2080e7b77 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,6 +4,10 @@ const os = require('os'); module.exports = { "root": true, + "parserOptions": { + "ecmaVersion": 3, + "sourceType": "script" + }, "env": { "node": true, "browser": true @@ -50,11 +54,11 @@ module.exports = { "no-empty-character-class": 2, "no-empty": 0, "no-ex-assign": 2, - "disallow-extra-boolean-casts": 0, + "no-extra-boolean-cast": 2, "no-extra-parens": 0, "no-extra-semi": 2, "no-func-assign": 2, - "no-inner-declarations": 2, + "no-inner-declarations": [2, "functions"], "no-invalid-regexp": 2, "no-irregular-whitespace": 2, "no-negated-in-lhs": 2, @@ -67,6 +71,7 @@ module.exports = { "valid-jsdoc": 0, "valid-typeof": 2, + "array-callback-return": 2, "block-scoped-var": 0, "complexity": 0, "consistent-return": 0, @@ -74,37 +79,41 @@ module.exports = { "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-empty-label": 2, + "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": 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": 1, + "no-octal": 2, "no-param-reassign": 0, - "no-process-env": 0, "no-proto": 2, "no-return-assign": [2, "except-parens"], + "no-self-assign": 2, "no-self-compare": 2, - "no-sequences": 1, + "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, @@ -116,11 +125,12 @@ module.exports = { "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": 0, + "no-undef-init": 1, "no-undef": [2, {"typeof": true}], "no-undefined": 0, "no-unused-vars": 0, @@ -144,8 +154,10 @@ module.exports = { "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, @@ -170,13 +182,11 @@ module.exports = { "semi-spacing": [2, {"before": false, "after": true}], "semi": [2, "always"], "sort-vars": 0, - "space-after-keywords": [2, "always"], + "keyword-spacing": [2, {"before": true, "after": true}], "space-before-blocks": [2, "always"], "space-before-function-paren": [2, {"anonymous": "always", "named": "never"}], - "space-before-keywords": [2, "always"], "space-in-parens": [2, "never"], "space-infix-ops": 2, - "space-return-throw-case": 2, "space-unary-ops": [2, {"words": true, "nonwords": false}], "spaced-comment": 0, "wrap-regex": 0 @@ -188,7 +198,7 @@ module.exports = { "no-new": 2, "no-redeclare": 2, "no-unused-vars": [1, {"args": "none"}], - "no-use-before-define": [2, "nofunc"], + "no-use-before-define": [2, {"functions": false, "classes": false}], "new-cap": [2, {"newIsCap": true, "capIsNew: false}], "padded-blocks": [2, "never"], "validate-conditionals": 2 diff --git a/githooks/.eslintrc.js b/githooks/.eslintrc.js index 086f974b9..c76c719d0 100644 --- a/githooks/.eslintrc.js +++ b/githooks/.eslintrc.js @@ -4,8 +4,16 @@ const baseRules = Object.assign({}, require('./../.eslintrc.js').rules); module.exports = { "root": true, + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "script", + "ecmaFeatures": { + "globalReturn": true + } + }, "env": { - "node": true, + "es6": true, + "node": true }, "rules": Object.assign(baseRules, { "comma-dangle": [2, "always-multiline"], @@ -16,19 +24,20 @@ module.exports = { "radix": [1, "as-needed"], "strict": [2, "global"], "no-unused-vars": [1, {"args": "none"}], - "no-use-before-define": [2, "nofunc"], + "no-use-before-define": [2, {"functions": false, "classes": false}], + "new-cap": [2, {"newIsCap": true, "capIsNew": false}], + "padded-blocks": [2, "never"], + "arrow-parens": [2, "as-needed"], "arrow-spacing": [2, {"before": true, "after": true}], - "new-cap": [2, {"newIsCap": true, "capIsNew": false}], + "constructor-super": 2, + "no-class-assign": 2, + "no-confusing-arrow": 0, + "no-const-assign": 2, + "no-dupe-class-members": 2, + "no-this-before-super": 2, "no-var": 2, - "padded-blocks": [2, "never"], + "require-yield": 2, + "template-curly-spacing": [2, "never"], }), - "ecmaFeatures": { - "arrowFunctions": true, - "blockBindings": true, - "classes": true, - "forOf": true, - "octalLiterals": true, - "spread": true, - }, }; diff --git a/githooks/build-indexes b/githooks/build-indexes index db4cc5381..19152c283 100755 --- a/githooks/build-indexes +++ b/githooks/build-indexes @@ -359,6 +359,7 @@ process.stdout.write("Building `data/teambuilder-tables.js`... "); case 'redorb': case 'souldew': // Other + // fallsthrough case 'stick': case 'thickclub': case 'lightball': @@ -415,6 +416,7 @@ process.stdout.write("Building `data/teambuilder-tables.js`... "); case 'rowapberry': case 'wikiberry': // gen 2 + // fallsthrough case 'psncureberry': case 'przcureberry': case 'burntberry': diff --git a/js/client-battle-tooltips.js b/js/client-battle-tooltips.js index 357c785ce..1157d2085 100644 --- a/js/client-battle-tooltips.js +++ b/js/client-battle-tooltips.js @@ -434,7 +434,7 @@ var BattleTooltips = (function () { if (pokemon.ability === pokemon.baseAbility) { text += '
Ability: ' + Tools.getAbility(pokemon.ability).name + '
'; } else { - text += 'Ability: ' + Tools.getAbility(pokemon.ability).name + ' (base: ' + Tools.getAbility(pokemon.baseAbility).name + ')' + '
'; + text += 'Ability: ' + Tools.getAbility(pokemon.ability).name + ' (base: ' + Tools.getAbility(pokemon.baseAbility).name + ')' + '
'; } } else if (pokemon.baseAbility) { text += 'Ability: ' + Tools.getAbility(pokemon.baseAbility).name + '
'; diff --git a/js/client-chat-tournament.js b/js/client-chat-tournament.js index 05ca4659a..59a3a2fbb 100644 --- a/js/client-chat-tournament.js +++ b/js/client-chat-tournament.js @@ -208,10 +208,10 @@ return; } - var teamIndex = undefined; + var teamIndex = -1; if (!forceFormatChange && this.$teamSelect.children().val()) { teamIndex = parseInt(this.$teamSelect.children().val(), 10); - if (isNaN(teamIndex)) teamIndex = undefined; + if (isNaN(teamIndex)) teamIndex = -1; } this.$teamSelect.html(app.rooms[''].renderTeams.call(this, this.info.format, teamIndex)); diff --git a/js/client-mainmenu.js b/js/client-mainmenu.js index ab289bfe7..8b46f681e 100644 --- a/js/client-mainmenu.js +++ b/js/client-mainmenu.js @@ -800,7 +800,8 @@ if (!teams.length) { return ''; } - if (teamIndex === undefined) { + if (teamIndex === undefined) teamIndex = -1; + if (teamIndex < 0) { if (this.curTeamIndex >= 0) { teamIndex = this.curTeamIndex; } @@ -815,7 +816,7 @@ } else { teamIndex = +teamIndex; } - return ''; + return ''; }, // buttons diff --git a/js/client-teambuilder.js b/js/client-teambuilder.js index f5d887ca2..08b1347a2 100644 --- a/js/client-teambuilder.js +++ b/js/client-teambuilder.js @@ -305,7 +305,7 @@ buf += this.clipboardHTML(); var filterFormat = ''; - var filterFolder = undefined; + var filterFolder = ''; if (!this.curFolder) { buf += '