mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-06 13:47:24 -05:00
Also made linting synchronous, which makes Gulp's output look slightly nicer (and time it, which is cool).
73 lines
1.7 KiB
JavaScript
73 lines
1.7 KiB
JavaScript
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 replace = require('gulp-replace');
|
|
|
|
var jsHintOptions = {
|
|
"nonbsp": true,
|
|
"noarg": true,
|
|
"loopfunc": true,
|
|
"latedef": 'nofunc',
|
|
|
|
"freeze": true,
|
|
"immed": true,
|
|
"undef": true,
|
|
|
|
// style
|
|
// "indent": true,
|
|
"smarttabs": true,
|
|
"trailing": true,
|
|
"newcap": true,
|
|
|
|
"sub": true,
|
|
"evil": true,
|
|
"esnext": true,
|
|
"node": true,
|
|
"eqeqeq": false,
|
|
|
|
"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
|
|
}
|
|
};
|
|
|
|
gulp.task('lint', function () {
|
|
var directories = ['./*.js', './data/*.js', './mods/*/*.js', './tournaments/*.js', './chat-plugins/*.js', './config/*.js'];
|
|
|
|
// 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(replace(/\bvar\b/g, 'let'))
|
|
.pipe(jshint(jsHintOptions))
|
|
.pipe(jshint.reporter(jshintStylish));
|
|
});
|
|
|
|
gulp.task('fastlint', function () {
|
|
var directories = ['./*.js', './tournaments/*.js', './chat-plugins/*.js', './config/*.js'];
|
|
|
|
return gulp.src(directories)
|
|
.pipe(replace(/\bvar\b/g, 'let'))
|
|
.pipe(jshint(jsHintOptions))
|
|
.pipe(jshint.reporter(jshintStylish));
|
|
});
|
|
|
|
gulp.task('default', ['lint']);
|