Thứ Năm, 22 tháng 12, 2016

Using JSHint with Gulp

Install jshint, gulp-jshint, jshint-stylish
1
npm install jshint gulp-jshint jshint-stylish --save-dev

Config javascript version in .jshintrc file:
1
2
3
{
  "esversion": 6
}

Define task in gulpfile.js:
1
2
3
4
5
6
7
8
9
var gulp = require('gulp');
var jshint = require('gulp-jshint');
 
gulp.task('jshint', function () {
    return gulp.src('source/**/*.js')
  .pipe(jshint())
  .pipe(jshint.reporter('jshint-stylish'))
  .pipe(jshint.reporter('fail'));
});

Không có nhận xét nào :

Đăng nhận xét