Skip to content

Commit

Permalink
Remove JSHint and use ESLint.
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed May 22, 2017
1 parent a226a6e commit c5ec544
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 63 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.git/
/node_modules/
/demo/js/*.min.js
/dist/*.min.js
24 changes: 10 additions & 14 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
module.exports = {
env: {
"browser": true
'browser': true
},
globals: {
baguetteBox: true,
hljs: true
},
extends: "eslint:recommended",
extends: 'eslint:recommended',
rules: {
"indent": [
"error",
'indent': [
'error',
4
],
"quotes": [
"error",
"single"
'quotes': [
'error',
'single'
],
"semi": [
"error",
"always"
'semi': [
'error',
'always'
]
}
};
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.publish/
node_modules/
assets/
demo/js/baguetteBox.js
demo/css/baguetteBox.css
demo/js/baguetteBox.js
node_modules/
16 changes: 0 additions & 16 deletions .jshintrc

This file was deleted.

36 changes: 18 additions & 18 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* jshint node:true */
/* eslint-env node */

'use strict';

Expand Down Expand Up @@ -36,7 +36,7 @@ var autoprefixerBrowsers = [

gulp.task('build.demo-css', function() {
return gulp.src(src.css)
.pipe(plugins.if(/.scss/, plugins.sass({ style: 'compressed', noCache: true }))) // jshint ignore:line
.pipe(plugins.if(/.scss/, plugins.sass({ style: 'compressed', noCache: true })))
.pipe(plugins.autoprefixer(autoprefixerBrowsers))
.pipe(plugins.concat('baguetteBox.css'))
.pipe(gulp.dest(demo.css));
Expand All @@ -50,7 +50,7 @@ gulp.task('build.demo-js', function () {

gulp.task('build.dist-css', function() {
return gulp.src(src.css)
.pipe(plugins.if(/.scss/, plugins.sass({ style: 'compressed', noCache: true }))) // jshint ignore:line
.pipe(plugins.if(/.scss/, plugins.sass({ style: 'compressed', noCache: true })))
.pipe(plugins.autoprefixer(autoprefixerBrowsers))
.pipe(plugins.concat('baguetteBox.css'))
.pipe(gulp.dest(dist.css))
Expand All @@ -73,10 +73,10 @@ gulp.task('build.demo', ['build.demo-css', 'build.demo-js']);
gulp.task('build.dist', ['build.dist-css', 'build.dist-js']);

gulp.task('lint', function() {
return gulp.src([src.js, 'gulpfile.js'])
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish'))
.pipe(plugins.jshint.reporter('fail'));
return gulp.src([src.js, 'gulpfile.js', '.eslintrc.js'])
.pipe(plugins.eslint())
.pipe(plugins.eslint.format())
.pipe(plugins.eslint.failAfterError());
});

gulp.task('bump-minor', function () {
Expand All @@ -93,17 +93,17 @@ gulp.task('bump-patch', function () {

gulp.task('update-version', function () {
return gulp.src([demo.css + '*.css',
demo.js + '*.js',
dist.css + '*.css',
dist.js + '*.js'
], {
base: './'
})
.pipe(plugins.injectVersion({
replace: '%%INJECT_VERSION%%',
prepend: ''
}))
.pipe(gulp.dest('./'));
demo.js + '*.js',
dist.css + '*.css',
dist.js + '*.js'
], {
base: './'
})
.pipe(plugins.injectVersion({
replace: '%%INJECT_VERSION%%',
prepend: ''
}))
.pipe(gulp.dest('./'));
});

gulp.task('watch', ['watch.browser-sync'], function() {
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@
"gulp-gh-pages": "~0.5.4",
"gulp-if": "~2.0.2",
"gulp-inject-version": "~1.0.0",
"gulp-jshint": "~2.0.4",
"gulp-eslint": "~3.0.1",
"gulp-load-plugins": "~1.5.0",
"gulp-rimraf": "~0.2.1",
"gulp-sass": "~3.1.0",
"gulp-uglify": "~2.1.0",
"gulp-usemin": "~0.3.27",
"jshint": "~2.9.1",
"jshint-stylish": "~2.2.0",
"jsonfile": "~2.4.0",
"run-sequence": "~1.2.1"
},
Expand Down
18 changes: 8 additions & 10 deletions src/baguetteBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@
}
};
var previousButtonClickHandler = function(event) {
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // jshint ignore:line
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // eslint-disable-line no-unused-expressions
showPreviousImage();
};
var nextButtonClickHandler = function(event) {
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // jshint ignore:line
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // eslint-disable-line no-unused-expressions
showNextImage();
};
var closeButtonClickHandler = function(event) {
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // jshint ignore:line
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // eslint-disable-line no-unused-expressions
hideOverlay();
};
var touchstartHandler = function(event) {
Expand All @@ -102,7 +102,7 @@
if (touchFlag || touch.multitouch) {
return;
}
event.preventDefault ? event.preventDefault() : event.returnValue = false; // jshint ignore:line
event.preventDefault ? event.preventDefault() : event.returnValue = false; // eslint-disable-line no-unused-expressions
var touchEvent = event.touches[0] || event.changedTouches[0];
// Move at least 40 pixels to trigger the action
if (touchEvent.pageX - touch.startX > 40) {
Expand Down Expand Up @@ -133,7 +133,7 @@

// forEach polyfill for IE8
// http://stackoverflow.com/a/14827443/1077846
/* jshint ignore:start */
/* eslint-disable */
if (![].forEach) {
Array.prototype.forEach = function(callback, thisArg) {
for (var i = 0; i < this.length; i++) {
Expand All @@ -153,7 +153,7 @@
return d;
};
}
/* jshint ignore:end */
/* eslint-enable */

// Script entry point
function run(selector, userOptions) {
Expand Down Expand Up @@ -199,7 +199,7 @@
var gallery = [];
[].forEach.call(tagsNodeList, function(imageElement, imageIndex) {
var imageElementClickHandler = function(event) {
event.preventDefault ? event.preventDefault() : event.returnValue = false; // jshint ignore:line
event.preventDefault ? event.preventDefault() : event.returnValue = false; // eslint-disable-line no-unused-expressions
prepareOverlay(gallery, userOptions);
showOverlay(imageIndex);
};
Expand Down Expand Up @@ -478,7 +478,7 @@

// Return if the index exceeds prepared images in the overlay
// or if the current gallery has been changed / closed
if (imageContainer === undefined || galleryItem === undefined) {
if (typeof imageContainer === 'undefined' || typeof galleryItem === 'undefined') {
return;
}

Expand Down Expand Up @@ -615,14 +615,12 @@
if (options.animation === 'fadeIn') {
slider.style.opacity = 0;
setTimeout(function() {
/* jshint -W030 */
supports.transforms ?
slider.style.transform = slider.style.webkitTransform = 'translate3d(' + offset + ',0,0)'
: slider.style.left = offset;
slider.style.opacity = 1;
}, 400);
} else {
/* jshint -W030 */
supports.transforms ?
slider.style.transform = slider.style.webkitTransform = 'translate3d(' + offset + ',0,0)'
: slider.style.left = offset;
Expand Down

0 comments on commit c5ec544

Please sign in to comment.