Skip to content

Fixes Issue #1: Re-enables JS linting #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,7 +31,7 @@ var lintFiles = [
'gulpfile.js',
// Karma configuration
'karma-*.conf.js'
]; // .concat(sourceFiles);
].concat(sourceFiles);

gulp.task('build', function() {
gulp.src(sourceFiles)
Expand All @@ -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);
});

/**
Expand All @@ -62,12 +62,23 @@ gulp.task('watch', function () {
/**
* Validate source JavaScript
*/
gulp.task('jshint', function () {
gulp.task('lint', function () {
Copy link
Contributor Author

@kanhirun kanhirun May 31, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When linting, the user shouldn't know what linter they are using. Instead, they should just invoke the command, and resolve conflicts.

return gulp.src(lintFiles)
.pipe(plumber())
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
.pipe(eslint({
extends: 'eslint:recommended',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just inlined the configuration options here, but I saw that crosslead-platform has a .eslintrc file. I suggest—in the PR—a way to avoid falling into this adhocity trap.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, that we can spread our linting gospel to the masses.

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());
});

/**
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 3 additions & 4 deletions src/angular-zendesk-widget/zendeskWidget.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [],
Expand All @@ -35,7 +34,7 @@
}, o.write('<body onload="document._l();">'), o.close()
}("https://assets.zendesk.com/embeddable_framework/main.js", zendeskWidgetSettings.accountUrl);

/* jshint ignore:end */
/*eslint-enable */

$window.zE(function() {
zendeskWidgetSettings.beforePageLoad($window.zE);
Expand Down