-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
39 lines (32 loc) · 1.01 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
var gulp = require('gulp');
var fs = require('fs');
var path = require('path');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var jscs = require('gulp-jscs-with-reporter');
var jscsReporter = require('gulp-jscs-html-reporter');
function rcjson(filename) {
var json;
try {
json = eval("("+fs.readFileSync(path.join(__dirname, filename),'utf-8')+")");
} catch(e) {
console.error('rc parse error! rc file:'+filename);
}
return json;
}
var jsHintConfig = rcjson('.jshintrc');
var jsCsConfig = rcjson('.jscsrc');
gulp.task('lint', function () {
return gulp.src(['./lib/**/*.{js,jsx}'])
.pipe(jshint(jsHintConfig))
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('fail'))
.pipe(jshint.reporter('gulp-jshint-html-reporter', {
filename: __dirname + '/jshint-output.ignore.html'
}))
.pipe(jscs(jsCsConfig))
.pipe(jscs.reporter('inline'))
.pipe(jscs.reporter(jscsReporter, {
filename: __dirname + '/jscs-output.ignore.html'
}));
});