diff --git a/gulpfile.js b/gulpfile.js index e2502fa..9ba5d88 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,7 +6,7 @@ var rename = require('gulp-rename'); var path = require('path'); var plumber = require('gulp-plumber'); var runSequence = require('run-sequence'); -var jshint = require('gulp-jshint'); +var eslint = require('gulp-eslint'); /** * File patterns @@ -31,7 +31,7 @@ var lintFiles = [ 'gulpfile.js', // Karma configuration 'karma-*.conf.js' -]; // .concat(sourceFiles); +].concat(sourceFiles); gulp.task('build', function() { gulp.src(sourceFiles) @@ -47,7 +47,7 @@ gulp.task('build', function() { * Process */ gulp.task('process-all', function (done) { - runSequence('jshint', 'test-src', 'build', done); + runSequence('lint', 'test-src', 'build', done); }); /** @@ -62,12 +62,23 @@ gulp.task('watch', function () { /** * Validate source JavaScript */ -gulp.task('jshint', function () { +gulp.task('lint', function () { return gulp.src(lintFiles) .pipe(plumber()) - .pipe(jshint()) - .pipe(jshint.reporter('jshint-stylish')) - .pipe(jshint.reporter('fail')); + .pipe(eslint({ + extends: 'eslint:recommended', + globals: { + angular: true, + module: true, + require: true, + __dirname: true, + document: true + } + })) + // Outputs the results to the console + .pipe(eslint.format()) + // Exits the process with exit-code(1) if there were errors + .pipe(eslint.failAfterError()); }); /** diff --git a/package.json b/package.json index a59ad84..b49ffae 100644 --- a/package.json +++ b/package.json @@ -9,14 +9,17 @@ "devDependencies": { "chai": "^1.9.1", "chai-jquery": "^1.2.3", + "eslint": "^2.11.1", + "eslint-config-standard": "^5.3.1", + "eslint-plugin-promise": "^1.3.1", + "eslint-plugin-standard": "^1.3.2", "gulp": "^3.8.7", "gulp-concat": "^2.3.4", - "gulp-jshint": "^1.8.4", + "gulp-eslint": "^2.0.0", "gulp-plumber": "^0.6.6", "gulp-rename": "^1.2.0", "gulp-uglify": "^0.3.1", "jasmine-core": "^2.3.4", - "jshint-stylish": "^0.4.0", "karma": "^0.12.22", "karma-chai": "^0.1.0", "karma-chai-jquery": "^1.0.0", diff --git a/src/angular-zendesk-widget/zendeskWidget.module.js b/src/angular-zendesk-widget/zendeskWidget.module.js index 633eab4..80b5a23 100644 --- a/src/angular-zendesk-widget/zendeskWidget.module.js +++ b/src/angular-zendesk-widget/zendeskWidget.module.js @@ -10,13 +10,12 @@ } var window = $window; + // Following is essentially a copy paste of JS portion of the Zendesk embed code // with our settings subbed in. For more info, see: // https://support.zendesk.com/hc/en-us/articles/203908456-Using-Web-Widget-to-embed-customer-service-in-your-website - // Note that JSHint ignore is not working in latest release, so can't actually turn - // on JSHint yet. See https://github.com/jshint/jshint/issues/2411 - /* jshint ignore:start */ + /*eslint-disable */ window.zEmbed || function(e, t) { var n, o, d, i, s, a = [], @@ -35,7 +34,7 @@ }, o.write(''), o.close() }("https://assets.zendesk.com/embeddable_framework/main.js", zendeskWidgetSettings.accountUrl); - /* jshint ignore:end */ + /*eslint-enable */ $window.zE(function() { zendeskWidgetSettings.beforePageLoad($window.zE);