forked from DeepRoost/infinite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
123 lines (101 loc) · 3.1 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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 jsHintOptions = {
"nonbsp": true,
"nonew": true,
"noarg": true,
"loopfunc": true,
"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
}
};
var jscsOptions = {
"excludeFiles": ["./**/pokedex.js", "./**/formats-data.js", "./**/learnsets.js", "./**/learnsets-g6.js", "./config/config.js"],
"preset": "google",
"requireCurlyBraces": null,
"requireCamelCaseOrUpperCaseIdentifiers": null,
"maximumLineLength": null,
"validateIndentation": "\t",
"validateQuoteMarks": null,
"disallowMixedSpacesAndTabs": "smart",
"disallowMultipleVarDecl": null,
"requireSpaceAfterKeywords": true,
"requireSpaceBeforeBinaryOperators": true,
"disallowSpacesInAnonymousFunctionExpression": null,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"validateJSDoc": null,
"requireBlocksOnNewline": 1,
"disallowPaddingNewlinesInBlocks": true,
"disallowEmptyBlocks": true,
"disallowNewlineBeforeBlockStatements": true,
"requireCommaBeforeLineBreak": true,
"requireOperatorBeforeLineBreak": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"disallowTrailingComma": true,
"validateLineBreaks": require('os').EOL.replace(/\r/g, 'CR').replace(/\n/g, 'LF'),
"validateParameterSeparator": ", ",
"requireCapitalizedConstructors": true
};
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));
});
gulp.task('fastlint', function () {
var directories = ['./*.js', './tournaments/*.js', './chat-plugins/*.js', './config/*.js'];
delete jsHintOptions['es3'];
return gulp.src(directories)
.pipe(jscs(jscsOptions))
.pipe(replace(/\bvar\b/g, 'let'))
.pipe(jshint(jsHintOptions))
.pipe(jshint.reporter(jshintStylish))
.pipe(jshint.reporter('fail'));
});
gulp.task('default', ['fastlint', 'data']);
gulp.task('lint', ['fastlint', 'data']);