Change to eslint from jshint.

It's way better. Original files have been linted.
This commit is contained in:
Hyunje Alex Jun 2015-01-25 19:19:37 +00:00
parent 5d62b130e9
commit 95540bdd9e
8 changed files with 39 additions and 81 deletions

19
.eslintrc Normal file
View File

@ -0,0 +1,19 @@
{
"env" : {
"node": true,
"browser": true
},
"globals": {
"$": true
},
"rules" : {
"quotes": false,
"space-after-keywords": [2, "always", {"checkFunctionKeyword": true}],
"space-before-blocks": [2, "always"],
"brace-style": [2, "1tbs", { "allowSingleLine": false}],
"spaced-line-comment": [2, "always"],
"radix": [2, "always"],
"key-spacing": [2, "always", {"beforeColon": false, "afterColon": true}],
"no-multiple-empty-lines": [2, {max: 1}],
}
}

View File

@ -1,61 +0,0 @@
{
"passfail" : false,
"maxerr" : 100,
"browser" : true,
"node" : true,
"rhino" : false,
"couch" : false,
"wsh" : false,
"jquery" : true,
"prototypejs" : false,
"mootools" : false,
"dojo" : false,
"predef" : [
"require",
"define"
],
"debug" : false,
"devel" : true,
"strict" : true,
"globalstrict" : false,
"asi" : false,
"laxbreak" : false,
"bitwise" : false,
"boss" : false,
"curly" : true,
"eqeqeq" : true,
"eqnull" : false,
"evil" : false,
"expr" : false,
"forin" : false,
"immed" : true,
"latedef" : true,
"loopfunc" : false,
"noarg" : true,
"regexp" : true,
"regexdash" : false,
"scripturl" : true,
"shadow" : false,
"supernew" : false,
"undef" : true,
"newcap" : true,
"noempty" : false,
"nonew" : true,
"nomen" : false,
"onevar" : false,
"plusplus" : false,
"sub" : false,
"trailing" : true,
"white" : true,
"indent" : 2,
"laxcomma" : true,
"camelcase" : true
}

View File

@ -4,7 +4,7 @@ var gulp = require('gulp')
, browserify = require('browserify')
, bump = require('gulp-bump')
, connect = require('gulp-connect')
, jshint = require('gulp-jshint')
, eslint = require('gulp-eslint')
, rename = require('gulp-rename')
, rimraf = require('gulp-rimraf')
, sass = require('gulp-sass')
@ -13,8 +13,9 @@ var gulp = require('gulp')
gulp.task('lint', function () {
return gulp.src(['./src/**/*.js', './gulpfile.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('clean:js', function () {

View File

@ -30,7 +30,7 @@
"gulp": "^3.8.10",
"gulp-bump": "^0.1.11",
"gulp-connect": "^2.2.0",
"gulp-jshint": "^1.9.0",
"gulp-eslint": "^0.2.0",
"gulp-rename": "^1.2.0",
"gulp-rimraf": "^0.1.1",
"gulp-sass": "^1.3.1",

View File

@ -3,13 +3,13 @@
*/
'use strict';
module.exports = (function() {
module.exports = (function () {
function s4() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return function() {
return function () {
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
};

View File

@ -14,5 +14,5 @@ module.exports = {
suppressScrollX: false,
suppressScrollY: false,
scrollXMarginOffset: 0,
scrollYMarginOffset: 0,
scrollYMarginOffset: 0
};

View File

@ -3,8 +3,7 @@
*/
'use strict';
var cls = require('../lib/class')
, d = require('../lib/dom')
var d = require('../lib/dom')
, h = require('../lib/helper')
, instances = require('./instances');

View File

@ -63,7 +63,7 @@ module.exports = function (element, userSettings) {
e.preventDefault();
};
var mouseUpHandler = function (e) {
var mouseUpHandler = function () {
cls.remove(element, 'ps-x');
cls.remove(element, 'ps-in-scrolling');
$(i.ownerDocument).unbind(i.eventClass('mousemove'), mouseMoveHandler);
@ -97,7 +97,7 @@ module.exports = function (element, userSettings) {
e.preventDefault();
};
var mouseUpHandler = function (e) {
var mouseUpHandler = function () {
cls.remove(element, 'ps-y');
cls.remove(element, 'ps-in-scrolling');
$(i.ownerDocument).unbind(i.eventClass('mousemove'), mouseMoveHandler);
@ -253,10 +253,10 @@ module.exports = function (element, userSettings) {
function bindKeyboardHandler() {
var hovered = false;
$(element).bind(i.eventClass('mouseenter'), function (e) {
$(element).bind(i.eventClass('mouseenter'), function () {
hovered = true;
});
$(element).bind(i.eventClass('mouseleave'), function (e) {
$(element).bind(i.eventClass('mouseleave'), function () {
hovered = false;
});
@ -331,7 +331,7 @@ module.exports = function (element, userSettings) {
}
function bindRailClickHandler() {
function stopPropagation(e) { e.stopPropagation(); }
var stopPropagation = window.Event.prototype.stopPropagation.bind;
$(i.scrollbarY).bind(i.eventClass('click'), stopPropagation);
$(i.scrollbarYRail).bind(i.eventClass('click'), function (e) {
@ -403,7 +403,7 @@ module.exports = function (element, userSettings) {
}
var isSelected = false;
$(i.ownerDocument).bind(i.eventClass('selectionchange'), function (e) {
$(i.ownerDocument).bind(i.eventClass('selectionchange'), function () {
if ($.contains(element, getRangeNode())) {
isSelected = true;
} else {
@ -411,7 +411,7 @@ module.exports = function (element, userSettings) {
stopScrolling();
}
});
$(window).bind(i.eventClass('mouseup'), function (e) {
$(window).bind(i.eventClass('mouseup'), function () {
if (isSelected) {
isSelected = false;
stopScrolling();
@ -480,10 +480,10 @@ module.exports = function (element, userSettings) {
var inGlobalTouch = false;
var inLocalTouch = false;
function globalTouchStart(e) {
function globalTouchStart() {
inGlobalTouch = true;
}
function globalTouchEnd(e) {
function globalTouchEnd() {
inGlobalTouch = false;
}
@ -550,7 +550,7 @@ module.exports = function (element, userSettings) {
}
}
}
function touchEnd(e) {
function touchEnd() {
if (!inGlobalTouch && inLocalTouch) {
inLocalTouch = false;
@ -600,7 +600,7 @@ module.exports = function (element, userSettings) {
}
function bindScrollHandler() {
$(element).bind(i.eventClass('scroll'), function (e) {
$(element).bind(i.eventClass('scroll'), function () {
updateGeometry(element);
});
}