forked from ErikEvenson/googleads-node-lib
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlint.js
80 lines (71 loc) · 1.5 KB
/
lint.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
var
cache = require('gulp-cached'),
debug = require('debug')(__filename),
gjslint = require('gulp-gjslint'),
gulp = require('gulp'),
gutil = require('gulp-util'),
jshint = require('gulp-jshint'),
map = require('map-stream'),
path = require('path');
var beeper = function(file, cb) {
return map(function(file, cb) {
if (!file.jshint.success) {
// console.log('JSHINT fail in '+file.path);
file.jshint.results.forEach(function(err) {
if (err) { gutil.beep(); }
});
}
cb(null, file);
});
};
var jsLintFiles = [
'./**/*.js',
// Don't lint bower components
'!**/bower_components/**/*',
// Don't lint node modules
'!**/node_modules/**/*',
// Don't lint coverage results
'!coverage/**/*'
];
gulp.task(
'lint',
'lint project using all linters',
['lint:gjslint', 'lint:jshint'],
function() {
// Linting...
},
{
options: {}
}
);
gulp.task(
'lint:gjslint',
'lint project using Google linter',
function() {
var options = {
// This flag doesn't seem to work...
flags: ['--beep', '--nojsdoc']
};
return gulp.src(jsLintFiles)
.pipe(cache('gjslinting'))
.pipe(gjslint(options))
.pipe(gjslint.reporter('console'));
},
{
options: {}
}
);
gulp.task(
'lint:jshint',
'lint project using jshint',
function() {
return gulp.src(jsLintFiles)
.pipe(cache('jshinting'))
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(beeper());
},
{
options: {}
}
);