From 4e670f71cabde72dcbf70f279eabf4201259913a Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 20 Oct 2015 17:14:53 +0200 Subject: [PATCH] [wip] Lint the javascript code with eslint ```gulp lint``` --- .eslintrc | 14 ++++++++++++++ gulpfile.js | 7 +++++++ package.json | 2 ++ 3 files changed, 23 insertions(+) create mode 100644 .eslintrc diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000000..d959af7b16 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,14 @@ +{ + "extends": "eslint:recommended", + "env": { + "browser": true + }, + "plugins": [ + "html" + ], + "globals": { + "CustomElements": true, + "HTMLImports": true, + "Polymer": true + } +} diff --git a/gulpfile.js b/gulpfile.js index ce09f66be6..795e4e7b8f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -20,6 +20,7 @@ var runseq = require('run-sequence'); var lazypipe = require('lazypipe'); var polyclean = require('polyclean'); var del = require('del'); +var eslint = require('gulp-eslint'); var path = require('path'); @@ -122,3 +123,9 @@ gulp.task('audit', function() { gulp.task('release', function(cb) { runseq('default', ['copy-bower-json', 'audit'], cb); }); + +gulp.task('lint', function() { + return gulp.src('src/**/*.html') + .pipe(eslint()) + .pipe(eslint.format()); +}); diff --git a/package.json b/package.json index 51733dcda4..0c4b7c1a9d 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,10 @@ }, "devDependencies": { "del": "^1.1.1", + "eslint-plugin-html": "^1.0.4", "gulp": "^3.8.11", "gulp-audit": "^1.0.0", + "gulp-eslint": "^1.0.0", "gulp-rename": "^1.2.2", "gulp-replace": "^0.5.3", "gulp-vulcanize": "^6.0.1",