Change to eslint from jshint.
It's way better. Original files have been linted.
This commit is contained in:
parent
5d62b130e9
commit
95540bdd9e
19
.eslintrc
Normal file
19
.eslintrc
Normal 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}],
|
||||||
|
}
|
||||||
|
}
|
61
.jshintrc
61
.jshintrc
@ -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
|
|
||||||
}
|
|
@ -4,7 +4,7 @@ var gulp = require('gulp')
|
|||||||
, browserify = require('browserify')
|
, browserify = require('browserify')
|
||||||
, bump = require('gulp-bump')
|
, bump = require('gulp-bump')
|
||||||
, connect = require('gulp-connect')
|
, connect = require('gulp-connect')
|
||||||
, jshint = require('gulp-jshint')
|
, eslint = require('gulp-eslint')
|
||||||
, rename = require('gulp-rename')
|
, rename = require('gulp-rename')
|
||||||
, rimraf = require('gulp-rimraf')
|
, rimraf = require('gulp-rimraf')
|
||||||
, sass = require('gulp-sass')
|
, sass = require('gulp-sass')
|
||||||
@ -13,8 +13,9 @@ var gulp = require('gulp')
|
|||||||
|
|
||||||
gulp.task('lint', function () {
|
gulp.task('lint', function () {
|
||||||
return gulp.src(['./src/**/*.js', './gulpfile.js'])
|
return gulp.src(['./src/**/*.js', './gulpfile.js'])
|
||||||
.pipe(jshint())
|
.pipe(eslint())
|
||||||
.pipe(jshint.reporter('default'));
|
.pipe(eslint.format())
|
||||||
|
.pipe(eslint.failOnError());
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('clean:js', function () {
|
gulp.task('clean:js', function () {
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
"gulp": "^3.8.10",
|
"gulp": "^3.8.10",
|
||||||
"gulp-bump": "^0.1.11",
|
"gulp-bump": "^0.1.11",
|
||||||
"gulp-connect": "^2.2.0",
|
"gulp-connect": "^2.2.0",
|
||||||
"gulp-jshint": "^1.9.0",
|
"gulp-eslint": "^0.2.0",
|
||||||
"gulp-rename": "^1.2.0",
|
"gulp-rename": "^1.2.0",
|
||||||
"gulp-rimraf": "^0.1.1",
|
"gulp-rimraf": "^0.1.1",
|
||||||
"gulp-sass": "^1.3.1",
|
"gulp-sass": "^1.3.1",
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = (function() {
|
module.exports = (function () {
|
||||||
function s4() {
|
function s4() {
|
||||||
return Math.floor((1 + Math.random()) * 0x10000)
|
return Math.floor((1 + Math.random()) * 0x10000)
|
||||||
.toString(16)
|
.toString(16)
|
||||||
.substring(1);
|
.substring(1);
|
||||||
}
|
}
|
||||||
return function() {
|
return function () {
|
||||||
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
|
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
|
||||||
s4() + '-' + s4() + s4() + s4();
|
s4() + '-' + s4() + s4() + s4();
|
||||||
};
|
};
|
||||||
|
@ -14,5 +14,5 @@ module.exports = {
|
|||||||
suppressScrollX: false,
|
suppressScrollX: false,
|
||||||
suppressScrollY: false,
|
suppressScrollY: false,
|
||||||
scrollXMarginOffset: 0,
|
scrollXMarginOffset: 0,
|
||||||
scrollYMarginOffset: 0,
|
scrollYMarginOffset: 0
|
||||||
};
|
};
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var cls = require('../lib/class')
|
var d = require('../lib/dom')
|
||||||
, d = require('../lib/dom')
|
|
||||||
, h = require('../lib/helper')
|
, h = require('../lib/helper')
|
||||||
, instances = require('./instances');
|
, instances = require('./instances');
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ module.exports = function (element, userSettings) {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
var mouseUpHandler = function (e) {
|
var mouseUpHandler = function () {
|
||||||
cls.remove(element, 'ps-x');
|
cls.remove(element, 'ps-x');
|
||||||
cls.remove(element, 'ps-in-scrolling');
|
cls.remove(element, 'ps-in-scrolling');
|
||||||
$(i.ownerDocument).unbind(i.eventClass('mousemove'), mouseMoveHandler);
|
$(i.ownerDocument).unbind(i.eventClass('mousemove'), mouseMoveHandler);
|
||||||
@ -97,7 +97,7 @@ module.exports = function (element, userSettings) {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
var mouseUpHandler = function (e) {
|
var mouseUpHandler = function () {
|
||||||
cls.remove(element, 'ps-y');
|
cls.remove(element, 'ps-y');
|
||||||
cls.remove(element, 'ps-in-scrolling');
|
cls.remove(element, 'ps-in-scrolling');
|
||||||
$(i.ownerDocument).unbind(i.eventClass('mousemove'), mouseMoveHandler);
|
$(i.ownerDocument).unbind(i.eventClass('mousemove'), mouseMoveHandler);
|
||||||
@ -253,10 +253,10 @@ module.exports = function (element, userSettings) {
|
|||||||
|
|
||||||
function bindKeyboardHandler() {
|
function bindKeyboardHandler() {
|
||||||
var hovered = false;
|
var hovered = false;
|
||||||
$(element).bind(i.eventClass('mouseenter'), function (e) {
|
$(element).bind(i.eventClass('mouseenter'), function () {
|
||||||
hovered = true;
|
hovered = true;
|
||||||
});
|
});
|
||||||
$(element).bind(i.eventClass('mouseleave'), function (e) {
|
$(element).bind(i.eventClass('mouseleave'), function () {
|
||||||
hovered = false;
|
hovered = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -331,7 +331,7 @@ module.exports = function (element, userSettings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function bindRailClickHandler() {
|
function bindRailClickHandler() {
|
||||||
function stopPropagation(e) { e.stopPropagation(); }
|
var stopPropagation = window.Event.prototype.stopPropagation.bind;
|
||||||
|
|
||||||
$(i.scrollbarY).bind(i.eventClass('click'), stopPropagation);
|
$(i.scrollbarY).bind(i.eventClass('click'), stopPropagation);
|
||||||
$(i.scrollbarYRail).bind(i.eventClass('click'), function (e) {
|
$(i.scrollbarYRail).bind(i.eventClass('click'), function (e) {
|
||||||
@ -403,7 +403,7 @@ module.exports = function (element, userSettings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isSelected = false;
|
var isSelected = false;
|
||||||
$(i.ownerDocument).bind(i.eventClass('selectionchange'), function (e) {
|
$(i.ownerDocument).bind(i.eventClass('selectionchange'), function () {
|
||||||
if ($.contains(element, getRangeNode())) {
|
if ($.contains(element, getRangeNode())) {
|
||||||
isSelected = true;
|
isSelected = true;
|
||||||
} else {
|
} else {
|
||||||
@ -411,7 +411,7 @@ module.exports = function (element, userSettings) {
|
|||||||
stopScrolling();
|
stopScrolling();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(window).bind(i.eventClass('mouseup'), function (e) {
|
$(window).bind(i.eventClass('mouseup'), function () {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
isSelected = false;
|
isSelected = false;
|
||||||
stopScrolling();
|
stopScrolling();
|
||||||
@ -480,10 +480,10 @@ module.exports = function (element, userSettings) {
|
|||||||
var inGlobalTouch = false;
|
var inGlobalTouch = false;
|
||||||
var inLocalTouch = false;
|
var inLocalTouch = false;
|
||||||
|
|
||||||
function globalTouchStart(e) {
|
function globalTouchStart() {
|
||||||
inGlobalTouch = true;
|
inGlobalTouch = true;
|
||||||
}
|
}
|
||||||
function globalTouchEnd(e) {
|
function globalTouchEnd() {
|
||||||
inGlobalTouch = false;
|
inGlobalTouch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,7 +550,7 @@ module.exports = function (element, userSettings) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function touchEnd(e) {
|
function touchEnd() {
|
||||||
if (!inGlobalTouch && inLocalTouch) {
|
if (!inGlobalTouch && inLocalTouch) {
|
||||||
inLocalTouch = false;
|
inLocalTouch = false;
|
||||||
|
|
||||||
@ -600,7 +600,7 @@ module.exports = function (element, userSettings) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function bindScrollHandler() {
|
function bindScrollHandler() {
|
||||||
$(element).bind(i.eventClass('scroll'), function (e) {
|
$(element).bind(i.eventClass('scroll'), function () {
|
||||||
updateGeometry(element);
|
updateGeometry(element);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user