diff options
author | Hendrik Leppelsack <hendrik@leppelsack.de> | 2016-03-09 11:13:16 +0100 |
---|---|---|
committer | Hendrik Leppelsack <hendrik@leppelsack.de> | 2016-03-09 11:28:52 +0100 |
commit | dff149a63e80dad707312da15af9be9914bdcc41 (patch) | |
tree | 21c2f3c9a65de5d044231383e2f6bc358e6b32b4 | |
parent | 297d8157455b68a7fe8c5819b7c92fd9b82019ae (diff) |
add better js linting
-rw-r--r-- | .eslintrc.json | 24 | ||||
-rw-r--r-- | .jshintrc | 3 | ||||
-rw-r--r-- | gulpfile.js | 19 | ||||
-rw-r--r-- | package.json | 2 |
4 files changed, 41 insertions, 7 deletions
diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..45b46f4c --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,24 @@ +{ + "extends": "eslint:recommended", + "rules": { + "no-undef": "off", + "no-unused-vars": "off", + + "eqeqeq": ["warn", "smart"], + "no-console": "warn", + "no-loop-func": "warn", + + "block-spacing": "error", + "camelcase": "error", + "comma-spacing": "error", + "comma-style": "error", + "curly": ["error", "multi-line", "consistent"], + "indent": ["error", "tab"], + "no-alert": "error", + "no-trailing-spaces": "error", + "quotes": ["error", "single", "avoid-escape"], + "semi": "error", + "space-before-blocks": "error" + + } +} diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index c44dc44f..00000000 --- a/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -[ - -]
\ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 852a627b..7f262af4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,6 +1,6 @@ var gulp = require('gulp'), concat = require('gulp-concat'), - jshint = require('gulp-jshint'); + eslint = require('gulp-eslint'); gulp.task('js', function() { return gulp.src([ @@ -10,12 +10,25 @@ gulp.task('js', function() { 'js/services/**/*.js', 'js/filters/**/*.js' ]) - .pipe(jshint('.jshintrc')) - .pipe(jshint.reporter('default')) + .pipe(eslint()) + .pipe(eslint.format()) .pipe(concat('script.js')) .pipe(gulp.dest('js/public')); }); +gulp.task('eslint', function() { + return gulp.src([ + 'js/main.js', + 'js/components/**/*.js', + 'js/models/**/*.js', + 'js/services/**/*.js', + 'js/filters/**/*.js' + ]) + .pipe(eslint()) + .pipe(eslint.format()) + .pipe(eslint.failAfterError()); +}) + gulp.task('watch', ['js'], function() { gulp.watch('js/**/*.js', ['js']); }); diff --git a/package.json b/package.json index cb835f33..c820cbc5 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,6 @@ "devDependencies": { "gulp": "^3.9.0", "gulp-concat": "^2.6.0", - "gulp-jshint": "^1.11.2" + "gulp-eslint": "^2.0.0" } } |