From 7c21fdc3844bc475a775d2873e0cb43371bf0514 Mon Sep 17 00:00:00 2001 From: Jake Marsh Date: Tue, 1 Mar 2016 12:22:13 -0800 Subject: [PATCH 1/4] replace jshint with eslint --- .jshintrc | 20 -------------------- .travis.yml | 3 ++- gulp/tasks/lint.js | 11 ----------- gulp/tasks/watch.js | 2 +- package.json | 3 --- 5 files changed, 3 insertions(+), 36 deletions(-) delete mode 100644 .jshintrc delete mode 100644 gulp/tasks/lint.js diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 5386d240..00000000 --- a/.jshintrc +++ /dev/null @@ -1,20 +0,0 @@ -{ - "node": true, - "jasmine": true, - "browser": true, - "esnext": true, - "bitwise": true, - "curly": true, - "eqeqeq": true, - "immed": true, - "indent": 2, - "latedef": true, - "noarg": true, - "regexp": true, - "undef": true, - "unused": true, - "strict": false, - "trailing": true, - "smarttabs": true, - "newcap": false -} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 99118aee..e710cc92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,8 @@ node_js: sudo: false script: - - ./node_modules/.bin/gulp lint test + - ./node_modules/.bin/gulp eslint + - ./node_modules/.bin/gulp test cache: directories: diff --git a/gulp/tasks/lint.js b/gulp/tasks/lint.js deleted file mode 100644 index 5985a6d5..00000000 --- a/gulp/tasks/lint.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -import config from '../config'; -import gulp from 'gulp'; -import jshint from 'gulp-jshint'; - -gulp.task('lint', function() { - return gulp.src([config.scripts.src, '!app/js/templates.js']) - .pipe(jshint()) - .pipe(jshint.reporter('jshint-stylish')); -}); \ No newline at end of file diff --git a/gulp/tasks/watch.js b/gulp/tasks/watch.js index 648d85f8..373e80e5 100644 --- a/gulp/tasks/watch.js +++ b/gulp/tasks/watch.js @@ -8,7 +8,7 @@ gulp.task('watch', ['browserSync'], function() { global.isWatching = true; // Scripts are automatically watched and rebundled by Watchify inside Browserify task - gulp.watch(config.scripts.src, ['lint']); + gulp.watch(config.scripts.src, ['eslint']); gulp.watch(config.styles.src, ['styles']); gulp.watch(config.images.src, ['images']); gulp.watch(config.fonts.src, ['fonts']); diff --git a/package.json b/package.json index 068baf5d..21445b07 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "gulp-gzip": "^1.2.0", "gulp-if": "^2.0.0", "gulp-imagemin": "^2.4.0", - "gulp-jshint": "^2.0.0", "gulp-notify": "^2.0.0", "gulp-protractor": "^2.1.0", "gulp-rename": "^1.2.0", @@ -60,8 +59,6 @@ "gulp-util": "^3.0.1", "imagemin-pngcrush": "^4.1.0", "isparta": "^4.0.0", - "jshint": "^2.9.1", - "jshint-stylish": "^2.1.0", "karma": "^0.13.21", "karma-browserify": "^5.0.2", "karma-chrome-launcher": "^0.2.1", From 95f26e610179f725f34347992e994b948f705076 Mon Sep 17 00:00:00 2001 From: Jake Marsh Date: Tue, 1 Mar 2016 12:22:30 -0800 Subject: [PATCH 2/4] bump versions, finish setting up eslint --- .eslintrc | 25 ++++++++++++++++++++++--- gulp/config.js | 3 ++- gulp/tasks/eslint.js | 2 +- package.json | 5 +++-- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.eslintrc b/.eslintrc index 03d21fa1..3aec2846 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,24 @@ { - "env" : { - "es6" : true + "parser": "babel-eslint", + "ecmaFeatures": { + "modules": true + }, + "env": { + "browser": true, + "node": true, + "es6": true + }, + "rules": { + "quotes": [2, "single"], + "eol-last": 0, + "no-debugger": 1, + "no-mixed-requires": 0, + "no-underscore-dangle": 0, + "no-multi-spaces": 0, + "no-trailing-spaces": 0, + "no-extra-boolean-cast": 0, + "no-unused-vars": 2, + "new-cap": 0, + "camelcase": 2 } -} +} \ No newline at end of file diff --git a/gulp/config.js b/gulp/config.js index 01ef7ecb..055b1cce 100644 --- a/gulp/config.js +++ b/gulp/config.js @@ -17,7 +17,8 @@ export default { scripts: { src: 'app/js/**/*.js', - dest: 'build/js' + dest: 'build/js', + test: 'test/**/*.js' }, images: { diff --git a/gulp/tasks/eslint.js b/gulp/tasks/eslint.js index 0043c65c..6265aaea 100644 --- a/gulp/tasks/eslint.js +++ b/gulp/tasks/eslint.js @@ -7,7 +7,7 @@ import eslint from 'gulp-eslint'; gulp.task('eslint', () => { // Be sure to return the stream from the task; // Otherwise, the task may end before the stream has finished. - return gulp.src([config.scripts.src, '!app/js/templates.js']) + return gulp.src([config.scripts.src, '!app/js/templates.js', config.scripts.test]) // eslint() attaches the lint output to the "eslint" property // of the file object so it can be used by other modules. .pipe(eslint()) diff --git a/package.json b/package.json index 21445b07..b07241d3 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "angular-mocks": "^1.3.15", "angular-ui-router": "^0.2.13", "babel-core": "^6.3.26", + "babel-eslint": "^5.0.0", "babel-preset-es2015": "^6.3.13", "babel-register": "^6.5.2", "babelify": "^7.2.0", @@ -39,13 +40,13 @@ "bulkify": "^1.1.1", "debowerify": "^1.3.1", "del": "^2.1.0", - "eslint": "^1.10.3", + "eslint": "^2.2.0", "express": "^4.13.3", "gulp": "^3.9.0", "gulp-angular-templatecache": "^1.3.0", "gulp-autoprefixer": "^3.1.0", "gulp-changed": "^1.0.0", - "gulp-eslint": "^1.1.1", + "gulp-eslint": "^2.0.0", "gulp-gzip": "^1.2.0", "gulp-if": "^2.0.0", "gulp-imagemin": "^2.4.0", From d46511f74877fe9c11bdd944ab3bedff53db83c8 Mon Sep 17 00:00:00 2001 From: Jake Marsh Date: Tue, 1 Mar 2016 12:22:39 -0800 Subject: [PATCH 3/4] update tests for eslint --- test/.eslintrc | 8 ++++++++ test/unit/constants_spec.js | 2 -- test/unit/controllers/example_spec.js | 2 -- test/unit/directives/example_spec.js | 2 +- test/unit/filters/example_spec.js | 2 -- test/unit/services/example_spec.js | 2 -- 6 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 test/.eslintrc diff --git a/test/.eslintrc b/test/.eslintrc new file mode 100644 index 00000000..2da0df3f --- /dev/null +++ b/test/.eslintrc @@ -0,0 +1,8 @@ +{ + "env": { + "jasmine": true + }, + "globals": { + "angular": true + } +} \ No newline at end of file diff --git a/test/unit/constants_spec.js b/test/unit/constants_spec.js index 81cdc7a7..d835f966 100644 --- a/test/unit/constants_spec.js +++ b/test/unit/constants_spec.js @@ -1,5 +1,3 @@ -/*global angular */ - 'use strict'; describe('Unit: Constants', function() { diff --git a/test/unit/controllers/example_spec.js b/test/unit/controllers/example_spec.js index 4f71c4f5..be52bd2c 100644 --- a/test/unit/controllers/example_spec.js +++ b/test/unit/controllers/example_spec.js @@ -1,5 +1,3 @@ -/*global angular */ - 'use strict'; describe('Unit: ExampleCtrl', function() { diff --git a/test/unit/directives/example_spec.js b/test/unit/directives/example_spec.js index 77cac062..a24a9a46 100644 --- a/test/unit/directives/example_spec.js +++ b/test/unit/directives/example_spec.js @@ -1,4 +1,4 @@ -/*global angular, module, browser*/ +/* global module */ 'use strict'; diff --git a/test/unit/filters/example_spec.js b/test/unit/filters/example_spec.js index fe7f833b..6bcdf0a9 100644 --- a/test/unit/filters/example_spec.js +++ b/test/unit/filters/example_spec.js @@ -1,5 +1,3 @@ -/*global angular */ - 'use strict'; describe('Unit: ExampleFilter', function() { diff --git a/test/unit/services/example_spec.js b/test/unit/services/example_spec.js index 77aba4d6..5ca3457b 100644 --- a/test/unit/services/example_spec.js +++ b/test/unit/services/example_spec.js @@ -1,5 +1,3 @@ -/*global angular */ - 'use strict'; describe('Unit: ExampleService', function() { From 1403653c318f5afa44c53fb151906da19e5a9560 Mon Sep 17 00:00:00 2001 From: Jake Marsh Date: Tue, 1 Mar 2016 12:22:50 -0800 Subject: [PATCH 4/4] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b07241d3..c2c19d8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angularjs-gulp-browserify-boilerplate", - "version": "1.5.2", + "version": "1.5.3", "author": "Jake Marsh ", "description": "Boilerplate using AngularJS, SASS, Gulp, and Browserify while also utilizing best practices.", "repository": {