mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-09 04:23:45 -05:00
commit
1104731a4e
|
|
@ -1,3 +1,4 @@
|
|||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
|
|
|
|||
242
gulpfile.js
242
gulpfile.js
|
|
@ -1,11 +1,39 @@
|
|||
var gulp = require('gulp');
|
||||
var jshintStylish = require('jshint-stylish');
|
||||
var gutil = require('gulp-util'); // Currently unused, but gulp strongly suggested I install...
|
||||
var jshint = require('gulp-jshint');
|
||||
var jscs = require('gulp-jscs');
|
||||
var replace = require('gulp-replace');
|
||||
var path = require('path');
|
||||
var util = require('util');
|
||||
|
||||
var jsHintOptions = {
|
||||
var gulp = require('gulp');
|
||||
var lazypipe = require('lazypipe');
|
||||
var merge = require('merge-stream');
|
||||
var jscs = require('gulp-jscs');
|
||||
var jshint = require('gulp-jshint');
|
||||
var replace = require('gulp-replace');
|
||||
var jshintStylish = require('./' + path.relative(__dirname, require('jshint-stylish')));
|
||||
|
||||
var globals = {};
|
||||
var globalList = [
|
||||
'Config', 'ResourceMonitor', 'toId', 'toName', 'string', 'LoginServer',
|
||||
'Users', 'Rooms', 'Verifier', 'CommandParser', 'Simulator', 'Tournaments',
|
||||
'Dnsbl', 'Cidr', 'Sockets', 'Tools', 'TeamValidator'
|
||||
];
|
||||
globalList.forEach(function (identifier) {globals[identifier] = false;});
|
||||
|
||||
function transformLet () {
|
||||
// Replacing `var` with `let` is sort of a hack that stops jsHint from
|
||||
// complaining that I'm using `var` like `let` should be used, but
|
||||
// without having to deal with iffy `let` support.
|
||||
|
||||
return lazypipe()
|
||||
.pipe(replace.bind(null, /\bvar\b/g, 'let'))();
|
||||
}
|
||||
|
||||
function lint (jsHintOptions, jscsOptions) {
|
||||
return lazypipe()
|
||||
.pipe(jshint.bind(jshint, jsHintOptions, {timeout: 150000}))
|
||||
.pipe(jscs.bind(jscs, jscsOptions))();
|
||||
}
|
||||
|
||||
var jsHintOptions = {};
|
||||
jsHintOptions.base = {
|
||||
"nonbsp": true,
|
||||
"nonew": true,
|
||||
"noarg": true,
|
||||
|
|
@ -13,111 +41,161 @@ var jsHintOptions = {
|
|||
"latedef": 'nofunc',
|
||||
|
||||
"freeze": true,
|
||||
"immed": true,
|
||||
"undef": true,
|
||||
|
||||
// style
|
||||
"smarttabs": true,
|
||||
"trailing": true,
|
||||
"newcap": true,
|
||||
|
||||
"sub": true,
|
||||
"evil": true,
|
||||
"esnext": true,
|
||||
"node": true,
|
||||
"eqeqeq": true,
|
||||
|
||||
"globals": {
|
||||
"Config": false,
|
||||
"ResourceMonitor": false,
|
||||
"toId": false,
|
||||
"toName": false,
|
||||
"string": false,
|
||||
"LoginServer": false,
|
||||
"Users": false,
|
||||
"Rooms": false,
|
||||
"Verifier": false,
|
||||
"CommandParser": false,
|
||||
"Simulator": false,
|
||||
"Tournaments": false,
|
||||
"Dnsbl": false,
|
||||
"Cidr": false,
|
||||
"Sockets": false,
|
||||
"Tools": false,
|
||||
"TeamValidator": false
|
||||
}
|
||||
"globals": globals
|
||||
};
|
||||
jsHintOptions.legacy = util._extend(util._extend({}, jsHintOptions.base), {
|
||||
"es3": true
|
||||
});
|
||||
jsHintOptions.test = util._extend(util._extend({}, jsHintOptions.base), {
|
||||
"globals": util._extend(globals, {
|
||||
"BattleEngine": false
|
||||
}),
|
||||
"mocha": true
|
||||
});
|
||||
|
||||
var jscsOptions = {
|
||||
"excludeFiles": ["./**/pokedex.js", "./**/formats-data.js", "./**/learnsets.js", "./**/learnsets-g6.js", "./config/config.js"],
|
||||
|
||||
"preset": "google",
|
||||
var jscsOptions = {};
|
||||
jscsOptions.base = {
|
||||
"preset": "yandex",
|
||||
|
||||
"requireCurlyBraces": null,
|
||||
"requireCamelCaseOrUpperCaseIdentifiers": null,
|
||||
|
||||
"maximumLineLength": null,
|
||||
"validateIndentation": "\t",
|
||||
"validateIndentation": '\t',
|
||||
"validateQuoteMarks": null,
|
||||
"disallowYodaConditions": null,
|
||||
"disallowQuotedKeysInObjects": null,
|
||||
"requireDotNotation": null,
|
||||
|
||||
"disallowMultipleVarDecl": null,
|
||||
"disallowImplicitTypeConversion": null,
|
||||
"requireSpaceAfterLineComment": null,
|
||||
"validateJSDoc": null,
|
||||
|
||||
"disallowMixedSpacesAndTabs": "smart",
|
||||
"disallowMultipleVarDecl": null,
|
||||
|
||||
"requireSpaceAfterKeywords": true,
|
||||
"requireSpaceBeforeBinaryOperators": true,
|
||||
"disallowSpacesInAnonymousFunctionExpression": null,
|
||||
"requireSpacesInAnonymousFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
|
||||
"validateJSDoc": null,
|
||||
"disallowSpacesInFunctionDeclaration": null,
|
||||
"requireSpacesInFunctionDeclaration": {
|
||||
"beforeOpeningCurlyBrace": true
|
||||
},
|
||||
"requireSpacesInAnonymousFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true,
|
||||
"beforeOpeningCurlyBrace": true
|
||||
},
|
||||
"disallowSpacesInNamedFunctionExpression": null,
|
||||
"requireSpacesInNamedFunctionExpression": {
|
||||
"beforeOpeningCurlyBrace": true
|
||||
},
|
||||
"validateParameterSeparator": ", ",
|
||||
|
||||
"requireBlocksOnNewline": 1,
|
||||
"disallowPaddingNewlinesInBlocks": true,
|
||||
"disallowEmptyBlocks": true,
|
||||
"disallowNewlineBeforeBlockStatements": true,
|
||||
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
"requireOperatorBeforeLineBreak": true,
|
||||
"disallowTrailingComma": true,
|
||||
|
||||
"requireCapitalizedConstructors": true,
|
||||
|
||||
"validateLineBreaks": 'CI' in process.env ? 'LF' : null,
|
||||
"disallowMultipleLineBreaks": null,
|
||||
|
||||
"esnext": true
|
||||
};
|
||||
jscsOptions.config = util._extend(util._extend({}, jscsOptions.base), {
|
||||
"disallowTrailingComma": null
|
||||
});
|
||||
jscsOptions.dataCompactArr = util._extend(util._extend({}, jscsOptions.base), {
|
||||
"requireSpaceAfterBinaryOperators": ["="],
|
||||
"requireSpaceBeforeBinaryOperators": ["="],
|
||||
"disallowSpaceAfterBinaryOperators": [","],
|
||||
"disallowSpaceBeforeBinaryOperators": [","]
|
||||
});
|
||||
jscsOptions.dataCompactAll = {
|
||||
"disallowTrailingComma": true,
|
||||
|
||||
"validateLineBreaks": 'CI' in process.env ? 'LF' : null,
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
"requireSpaceAfterBinaryOperators": ["="],
|
||||
"requireSpaceBeforeBinaryOperators": ["="],
|
||||
|
||||
"validateQuoteMarks": "\"",
|
||||
"disallowQuotedKeysInObjects": "allButReserved",
|
||||
|
||||
"disallowSpaceAfterObjectKeys": true,
|
||||
"disallowSpaceAfterPrefixUnaryOperators": true,
|
||||
"disallowSpaceBeforePostfixUnaryOperators": true,
|
||||
|
||||
"disallowTrailingComma": true,
|
||||
"validateLineBreaks": require('os').EOL.replace(/\r/g, 'CR').replace(/\n/g, 'LF'),
|
||||
"validateParameterSeparator": ", ",
|
||||
|
||||
"requireCapitalizedConstructors": true
|
||||
"disallowSpaceBeforeObjectValues": true,
|
||||
"disallowSpacesInsideBrackets": true,
|
||||
"disallowSpacesInsideArrayBrackets": true,
|
||||
"disallowSpacesInsideObjectBrackets": true,
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
"disallowSpaceAfterBinaryOperators": [","],
|
||||
"disallowSpaceBeforeBinaryOperators": [","]
|
||||
};
|
||||
|
||||
gulp.task('data', function () {
|
||||
var directories = ['./data/*.js', './mods/*/*.js'];
|
||||
jsHintOptions['es3'] = true;
|
||||
|
||||
// Replacing `var` with `let` is sort of a hack that stops jsHint from
|
||||
// complaining that I'm using `var` like `let` should be used, but
|
||||
// without having to deal with iffy `let` support.
|
||||
|
||||
return gulp.src(directories)
|
||||
.pipe(jscs(jscsOptions))
|
||||
.pipe(replace(/\bvar\b/g, 'let'))
|
||||
.pipe(jshint(jsHintOptions))
|
||||
.pipe(jshint.reporter(jshintStylish))
|
||||
.pipe(jshint.reporter('fail'))
|
||||
.pipe(jscs(jscsOptions));
|
||||
jscsOptions.dataCompactAllIndented = util._extend(util._extend({}, jscsOptions.dataCompactAll), {
|
||||
"validateIndentation": '\t'
|
||||
});
|
||||
|
||||
gulp.task('fastlint', function () {
|
||||
var directories = ['./*.js', './tournaments/*.js', './chat-plugins/*.js', './config/*.js'];
|
||||
delete jsHintOptions['es3'];
|
||||
var lintData = [
|
||||
{
|
||||
dirs: ['./*.js', './tournaments/*.js', './chat-plugins/*.js', './config/!(config).js', './**/scripts.js', './**/rulesets.js', './**/statuses.js'],
|
||||
jsHint: jsHintOptions.base,
|
||||
jscs: jscsOptions.base
|
||||
}, {
|
||||
dirs: ['./config/config*.js'],
|
||||
jsHint: jsHintOptions.base,
|
||||
jscs: jscsOptions.config
|
||||
}, {
|
||||
dirs: ['./**/abilities.js', './**/items.js', './**/moves.js', './**/typechart.js', './**/aliases.js'],
|
||||
jsHint: jsHintOptions.legacy,
|
||||
jscs: jscsOptions.base
|
||||
}, {
|
||||
dirs: ['./data/formats-data.js', './mods/*/formats-data.js', './mods/!(gen1)/pokedex.js'],
|
||||
jsHint: jsHintOptions.legacy,
|
||||
jscs: jscsOptions.dataCompactArr
|
||||
}, {
|
||||
dirs: ['./data/pokedex.js', './mods/gen1/pokedex.js'],
|
||||
jsHint: jsHintOptions.legacy,
|
||||
jscs: jscsOptions.dataCompactAll
|
||||
}, {
|
||||
dirs: ['./data/learnsets*.js', './mods/*/learnsets.js'],
|
||||
jsHint: jsHintOptions.legacy,
|
||||
jscs: jscsOptions.dataCompactAllIndented
|
||||
}, {
|
||||
dirs: ['./test/*.js', './test/application/*.js', './test/simulator/*/*.js'],
|
||||
jsHint: jsHintOptions.test,
|
||||
jscs: jscsOptions.base
|
||||
}
|
||||
];
|
||||
|
||||
return gulp.src(directories)
|
||||
.pipe(jscs(jscsOptions))
|
||||
.pipe(replace(/\bvar\b/g, 'let'))
|
||||
.pipe(jshint(jsHintOptions))
|
||||
var linter = function () {
|
||||
return (
|
||||
merge.apply(
|
||||
null,
|
||||
lintData.map(function (source) {
|
||||
return gulp.src(source.dirs)
|
||||
.pipe(transformLet())
|
||||
.pipe(lint(source.jsHint, source.jscs));
|
||||
})
|
||||
).pipe(jshint.reporter(jshintStylish))
|
||||
.pipe(jshint.reporter('fail'))
|
||||
);
|
||||
};
|
||||
|
||||
gulp.task('fastlint', function () {
|
||||
var source = lintData[0];
|
||||
return gulp.src(source.dirs)
|
||||
.pipe(transformLet())
|
||||
.pipe(lint(source.jsHint, source.jscs))
|
||||
.pipe(jshint.reporter(jshintStylish))
|
||||
.pipe(jshint.reporter('fail'));
|
||||
});
|
||||
|
||||
gulp.task('default', ['fastlint', 'data']);
|
||||
gulp.task('lint', ['fastlint', 'data']);
|
||||
gulp.task('lint', linter);
|
||||
gulp.task('default', linter);
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
exports.BattlePokedex = {
|
||||
rotomheat: {
|
||||
inherit: true,
|
||||
types: ["Electric", "Ghost"]
|
||||
types: ["Electric","Ghost"]
|
||||
},
|
||||
rotomwash: {
|
||||
inherit: true,
|
||||
types: ["Electric", "Ghost"]
|
||||
types: ["Electric","Ghost"]
|
||||
},
|
||||
rotomfrost: {
|
||||
inherit: true,
|
||||
types: ["Electric", "Ghost"]
|
||||
types: ["Electric","Ghost"]
|
||||
},
|
||||
rotomfan: {
|
||||
inherit: true,
|
||||
types: ["Electric", "Ghost"]
|
||||
types: ["Electric","Ghost"]
|
||||
},
|
||||
rotommow: {
|
||||
inherit: true,
|
||||
types: ["Electric", "Ghost"]
|
||||
types: ["Electric","Ghost"]
|
||||
}
|
||||
};
|
||||
|
|
|
|||
11
package.json
11
package.json
|
|
@ -49,12 +49,13 @@
|
|||
],
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"gulp-util": "~2.2.14",
|
||||
"gulp": "~3.8.7",
|
||||
"gulp-jshint": "~1.9.2",
|
||||
"gulp-jscs": "~1.3.1",
|
||||
"gulp-jshint": "git://github.com/spalger/gulp-jshint#c18df3a11",
|
||||
"gulp-jscs": "~1.4.0",
|
||||
"gulp-replace": "~0.5.1",
|
||||
"jshint-stylish": "~0.1.5",
|
||||
"mocha": "~2.1.0"
|
||||
"jshint-stylish": "~1.0.0",
|
||||
"mocha": "~2.1.0",
|
||||
"lazypipe": "~0.2.2",
|
||||
"merge-stream": "~0.1.7"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ describe('Users features', function () {
|
|||
user.disconnectAll();
|
||||
for (var i = 0; i < totalConnections; i++) {
|
||||
assert.strictEqual(Users.connections[connections[i].id], undefined);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('should clear `user` property for all ' + totalConnections + ' connection(s)', function () {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ before('initialization', function () {
|
|||
this.timeout(0); // Remove timeout limitation
|
||||
|
||||
require('./../app.js');
|
||||
process.listeners('uncaughtException').forEach(function (listener) {
|
||||
process.listeners('uncaughtException').forEach(function (listener) {
|
||||
process.removeListener('uncaughtException', listener);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ describe('Intimidate', function () {
|
|||
battle.join('p2', 'Guest 2', 1, [
|
||||
{species: "Greninja", ability: 'protean', moves: ['uturn']},
|
||||
{species: "Mew", ability: 'synchronize', moves: ['softboiled']},
|
||||
{species: "Gyarados", ability: 'intimidate', moves: ['splash']},
|
||||
{species: "Gyarados", ability: 'intimidate', moves: ['splash']}
|
||||
]);
|
||||
battle.commitDecisions();
|
||||
assert.strictEqual(battle.p1.active[0].boosts['atk'], -1);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ describe('Type addition', function () {
|
|||
battle.join('p1', 'Guest 1', 1, [{species: "Gourgeist", ability: 'frisk', moves: [moveData.name]}]);
|
||||
battle.join('p2', 'Guest 2', 1, [{species: "Arceus", ability: 'multitype', moves: ['extremespeed']}]);
|
||||
battle.commitDecisions();
|
||||
assert.deepEqual(battle.p2.active[0].getTypes(), ['Normal', moveData.type]);
|
||||
assert.deepEqual(battle.p2.active[0].getTypes(), ['Normal', moveData.type]);
|
||||
});
|
||||
|
||||
adderMoves.forEach(function (moveData2) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ describe('Roost', function () {
|
|||
battle = BattleEngine.Battle.construct('battle-roost-latency', 'doublescustomgame');
|
||||
battle.join('p1', 'Guest 1', 1, [
|
||||
{species: "Pidgeot", item: 'laggingtail', ability: 'victorystar', moves: ['aircutter']},
|
||||
{species: "Gligar", item: 'laggingtail', ability: 'immunity', moves: ['earthquake']},
|
||||
{species: "Gligar", item: 'laggingtail', ability: 'immunity', moves: ['earthquake']}
|
||||
]);
|
||||
battle.join('p2', 'Guest 2', 1, [
|
||||
{species: "Kecleon", ability: 'colorchange', moves: ['roost']},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user