mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-09-30 23:01:05 -05:00
Sync ESLint version and rules with server repo
This commit is contained in:
34
.eslintrc.js
34
.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
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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':
|
||||
|
||||
@@ -434,7 +434,7 @@ var BattleTooltips = (function () {
|
||||
if (pokemon.ability === pokemon.baseAbility) {
|
||||
text += '<p>Ability: ' + Tools.getAbility(pokemon.ability).name + '</p>';
|
||||
} else {
|
||||
text += '<p>Ability: ' + Tools.getAbility(pokemon.ability).name + ' (base: ' + Tools.getAbility(pokemon.baseAbility).name + ')' + '</p>';
|
||||
text += '<p>Ability: ' + Tools.getAbility(pokemon.ability).name + ' (base: ' + Tools.getAbility(pokemon.baseAbility).name + ')' + '</p>';
|
||||
}
|
||||
} else if (pokemon.baseAbility) {
|
||||
text += '<p>Ability: ' + Tools.getAbility(pokemon.baseAbility).name + '</p>';
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -800,7 +800,8 @@
|
||||
if (!teams.length) {
|
||||
return '<button class="select teamselect" name="team" disabled>You have no teams</button>';
|
||||
}
|
||||
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 '<button class="select teamselect" name="team" value="' + (teamIndex === undefined ? '' : teamIndex) + '">' + TeamPopup.renderTeam(teamIndex) + '</button>';
|
||||
return '<button class="select teamselect" name="team" value="' + (teamIndex < 0 ? '' : teamIndex) + '">' + TeamPopup.renderTeam(teamIndex) + '</button>';
|
||||
},
|
||||
|
||||
// buttons
|
||||
|
||||
@@ -305,7 +305,7 @@
|
||||
buf += this.clipboardHTML();
|
||||
|
||||
var filterFormat = '';
|
||||
var filterFolder = undefined;
|
||||
var filterFolder = '';
|
||||
|
||||
if (!this.curFolder) {
|
||||
buf += '<h2>Hi</h2>';
|
||||
@@ -2587,7 +2587,7 @@
|
||||
if (!set) return;
|
||||
var gen = this.curTeam.gen;
|
||||
|
||||
var minSpe = undefined;
|
||||
var minSpe;
|
||||
if (resetSpeed) minSpe = false;
|
||||
if (moveName.substr(0, 13) === 'Hidden Power ') {
|
||||
var hpType = moveName.substr(13);
|
||||
|
||||
@@ -896,7 +896,7 @@
|
||||
break;
|
||||
|
||||
case 'popup':
|
||||
var maxWidth = undefined;
|
||||
var maxWidth;
|
||||
var type = 'semimodal';
|
||||
data = data.substr(7);
|
||||
if (data.substr(0, 6) === '|wide|') {
|
||||
|
||||
@@ -746,8 +746,8 @@
|
||||
else if (format === 'doublesou') tierSet = tierSet.slice(slices.DOU);
|
||||
else if (format === 'doublesuu') tierSet = tierSet.slice(slices.DUU);
|
||||
else if (format === 'doublesnu') tierSet = tierSet.slice(slices.DNU);
|
||||
else if (isDoubles) tierSet = tierSet;
|
||||
else tierSet = tierSet.slice(slices.OU, slices.UU).concat(agTierSet).concat(tierSet.slice(slices.Uber, slices.OU)).concat(tierSet.slice(slices.UU));
|
||||
// else if (isDoubles) tierSet = tierSet;
|
||||
else if (!isDoubles) tierSet = tierSet.slice(slices.OU, slices.UU).concat(agTierSet).concat(tierSet.slice(slices.Uber, slices.OU)).concat(tierSet.slice(slices.UU));
|
||||
|
||||
if (format === 'vgc2016') {
|
||||
tierSet = tierSet.filter(function (r) {
|
||||
|
||||
@@ -534,7 +534,7 @@ Storage.unpackAllTeams = function (buffer) {
|
||||
|
||||
return buffer.split('\n').map(function (line) {
|
||||
var pipeIndex = line.indexOf('|');
|
||||
if (pipeIndex < 0) return;
|
||||
if (pipeIndex < 0) return '';
|
||||
var bracketIndex = line.indexOf(']');
|
||||
if (bracketIndex > pipeIndex) bracketIndex = -1;
|
||||
var slashIndex = line.lastIndexOf('/', pipeIndex);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"eslint": "~1.10.3"
|
||||
"eslint": "~2.12.0"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user