In the root of your ionic app, there is a gulpfile.js file. Open it in an editor and paste the following gulp task:
gulp.task('lint', function() {
return gulp.src(['./www/js/**/*.js'])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
});
This looks for a folder called 'js' inside the 'www' folder. If you have other folders containing JavaScript files, add those too. For example, lets also add a folder called 'views':
gulp.task('lint', function() {
return gulp.src(['./www/js/**/*.js','./www/views/**/*.js'])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
});
Explanations:
1) /**/*.js - This syntax means to look at all the js files in the subfolders too
2) .jshintrc - This is a configuration file that we will create in the next example.