-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
48 lines (40 loc) · 1.04 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
'use strict';
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var jasmine = require('gulp-jasmine');
var gulpIf = require('gulp-if');
var jsonlint = require("gulp-jsonlint");
var config = {
allJs: [
'*.js',
'fixtures/**/*.js'
],
allJson: [
'**/*.jsonlint'
],
test: 'test.js'
}
function isFixed(file) {
return file.eslint && typeof file.eslint.output === 'string';
}
gulp.task('jslint', function() {
return gulp.src(config.allJs)
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('lint-fix', function() {
return gulp.src(config.allJs)
.pipe(eslint({ fix: true }))
.pipe(eslint.format())
.pipe(gulpIf(isFixed, gulp.dest('./')));
});
gulp.task('jasmine', function() {
return gulp.src(config.test)
.pipe(jasmine({ verbose: false }));
});
gulp.task('jsonlint', function() {
return gulp.src("./src/*.json")
.pipe(jsonlint())
.pipe(jsonlint.reporter());
})
gulp.task('test', ['jslint', 'jsonlint', 'jasmine']);