I am currently using JSHint with my Gulp workflow, and would like to suppress the semicolon errors when working with JavaScript.
I'm currently using gulp-jshint. How do I enable the "asi" flag within Gulp to make the errors go away?
The type of error I am receiving is:
~/bootstrap-4.0.0-alpha/js/src/modal.js: line 1, col 26, Missing semicolon.
Despite it being valid JavaScript. Any help would be appreciated!
Here's my Gulp File in case it helps:
// Load Node Modules/Plugins
var gulp = require('gulp');
var concat = require('gulp-concat');
var del = require('del');
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
// Process Styles
gulp.task('styles', function() {
return gulp.src('scss/*.scss')
.pipe(sass())
.pipe(gulp.dest('dist'));
});
// Process Scripts
gulp.task('scripts', function() {
return gulp.src('js/src/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('bootstrap.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
// Watch tasks
gulp.task('watch', function() {
gulp.watch('scss/*.scss', 'styles');
gulp.watch('js/src/*.js', 'scripts');
});
gulp.task('build', ['styles', 'scripts', 'watch']);
gulp.task('default', ['clean'], () => {
gulp.start('build');
});
In .jshintrc
, set the following to tolerate Automatic Semicolon Insertion:
"asi" : true,
As described here, which points you to this example.