Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

JSHint suggested changes, mostly semicolon insertion or fixing variab…

…le scope
  • Loading branch information...
commit 32171a5e270376f89842ffda10c1902c3e9d74c6 1 parent 96295a6
@unwiredben unwiredben authored
View
4 source/boot/loader.js
@@ -210,14 +210,14 @@
//
// e.g. foo/bar/baz/lib/zot -> zot package
//
- for (var i=parts.length-1, p; p=parts[i]; i--) {
+ for (i=parts.length-1, p; p=parts[i]; i--) {
if (p == "lib" || p == "enyo") {
parts = parts.slice(i+1);
break;
}
}
// remove ".." and "."
- for (var i=parts.length-1, p; p=parts[i]; i--) {
+ for (i=parts.length-1, p; p=parts[i]; i--) {
if (p == ".." || p == ".") {
parts.splice(i, 1);
}
View
2  source/dom/dispatcher.js
@@ -87,7 +87,7 @@ enyo.dispatcher = {
// called in the context of an event
enyo.iePreventDefault = function() {
this.returnValue = false;
-}
+};
enyo.dispatch = function(inEvent) {
return enyo.dispatcher.dispatch(inEvent);
View
4 source/dom/gesture.js
@@ -119,14 +119,14 @@ enyo.gesture.preventDefault = function() {
if (this.srcEvent) {
this.srcEvent.preventDefault();
}
-}
+};
enyo.gesture.disablePrevention = function() {
this.preventDefault = enyo.nop;
if (this.srcEvent) {
this.srcEvent.preventDefault = enyo.nop;
}
-}
+};
enyo.dispatcher.features.push(
function(e) {
View
4 source/kernel/Component.js
@@ -257,10 +257,10 @@ enyo.kind({
nameComponent: function(inComponent) {
var prefix = enyo.Component.prefixFromKindName(inComponent.kindName);
// get last memoized name index
- var i = this._componentNameMap[prefix] || 0;
+ var n, i = this._componentNameMap[prefix] || 0;
// find an available name
do {
- var n = prefix + (++i > 1 ? String(i) : "");
+ n = prefix + (++i > 1 ? String(i) : "");
} while (this.$[n]);
// memoize next likely-unique id tag for this prefix
this._componentNameMap[prefix] = Number(i);
View
3  source/kernel/Oop.js
@@ -144,9 +144,10 @@ enyo.kind = function(inProps) {
enyo.kind.makeCtor = function() {
return function() {
// two-pass instantiation
+ var result;
if (this._constructor) {
// pure construction
- var result = this._constructor.apply(this, arguments);
+ result = this._constructor.apply(this, arguments);
}
// defer initialization until entire constructor chain has finished
if (this.constructed) {
View
6 source/kernel/animation.js
@@ -8,7 +8,7 @@
};
var _cancelFrame = function(inId) {
return window.clearTimeout(inId);
- }
+ };
for (var i = 0, pl = prefix.length, p, wc, wr; (p = prefix[i]) || i < pl; i++) {
// if prefixed, becomes Request and Cancel
wc = p ? (p + enyo.cap(c)) : c;
@@ -79,7 +79,9 @@ enyo.easing = {
/**
Gives an interpolation of an animated transition's distance from 0 to 1.
- Given a start time (_inT0_) and an animation duration (_inDuration_), applies the _inEasing_ function to the percentage of time elapsed / duration, capped at 100%.
+ Given a start time (_inT0_) and an animation duration (_inDuration_), applies
+ the _inEasing_ function to the percentage of time elapsed / duration, capped
+ at 100%.
*/
enyo.easedLerp = function(inT0, inDuration, inEasing) {
var lerp = (enyo.now() - inT0) / inDuration;
View
2  source/kernel/lang.js
@@ -156,7 +156,7 @@
var results = [];
var add = function(e, i, a) {
results.push(inFunc.call(c, e, i, a));
- }
+ };
enyo.forEach(inArray, add, c);
return results;
}
View
4 source/kernel/log.js
@@ -8,7 +8,7 @@ enyo.logging = {
levels: {log: 20, warn: 10, error: 0},
// return true if logging level is lower than the current log level
shouldLog: function(inMethod) {
- var ll = parseInt(this.levels[inMethod]);
+ var ll = parseInt(this.levels[inMethod], 0);
return (ll <= this.level);
},
/*
@@ -61,7 +61,7 @@ The log level is used as a watermark to control the amount of logging.
Setting the log level lower will prevent logging functions with a higher level from being executed.
*/
enyo.setLogLevel = function(inLevel) {
- var ll = parseInt(inLevel);
+ var ll = parseInt(inLevel, 0);
if (isFinite(ll)) {
enyo.logging.level = ll;
}
View
2  source/kernel/macroize.js
@@ -66,4 +66,4 @@ enyo.quickMacroize = function(inText, inMap, inPattern) {
//* @protected
// matches macros of form {$name}
-enyo.macroize.pattern = /{\$([^{}]*)}/g;
+enyo.macroize.pattern = /\{\$([^{}]*)\}/g;
View
10 source/touch/ScrollStrategy.js
@@ -128,11 +128,11 @@ enyo.kind({
this.canVertical = sb.maxTop > 0 && this.vertical != "hidden";
this.canHorizontal = sb.maxLeft > 0 && this.horizontal != "hidden";
this.startEdges = {
- top: y == 0,
- bottom: y == sb.maxTop,
- left: x == 0,
- right: x == sb.maxLeft
- }
+ top: y === 0,
+ bottom: y === sb.maxTop,
+ left: x === 0,
+ right: x === sb.maxLeft
+ };
},
// NOTE: down, move, and drag handlers are needed only for native touch scrollers
shouldDrag: function(inEvent) {
View
8 source/touch/Thumb.js
@@ -5,8 +5,8 @@
classes: "enyo-thumb",
axis: "v",
create: function() {
- this.inherited(arguments)
- var v = this.axis == "v";;
+ this.inherited(arguments);
+ var v = this.axis == "v";
this.dimension = v ? "height" : "width";
this.offset = v ? "top" : "left";
this.translation = v ? "translateY" : "translateX";
@@ -24,13 +24,13 @@
update: function(inStrategy) {
var d = this.dimension, o = this.offset;
var bd = this.scrollBounds[this.sizeDimension], sbd = this.scrollBounds[d];
- var overs = 0, overp = 0, over=0;
+ var overs = 0, overp = 0, over = 0;
if (bd >= sbd) {
this.hide();
return;
}
if (inStrategy.isOverscrolling()) {
- var over = inStrategy.getOverScrollBounds()["over" + o];
+ over = inStrategy.getOverScrollBounds()["over" + o];
overs = Math.abs(over);
overp = Math.max(over, 0);
}
View
2  source/touch/TouchScrollStrategy.js
@@ -122,7 +122,7 @@ enyo.kind({
},
scrollTo: function(inX, inY) {
this.stop();
- this.$.scrollMath.scrollTo(inY || inY == 0 ? inY : null, inX);
+ this.$.scrollMath.scrollTo(inY || inY === 0 ? inY : null, inX);
},
scrollIntoView: function() {
this.stop();

3 comments on commit 32171a5

@sjmiles

Please avoid taking blanket advice from these tools in the future. They are not aware of our style guides or certain coding intents. There was also some outright breakage, in particular removing the var from:

for (var i=parts.length-1, p; p=parts[i]; i--) {

in loader.js caused 'p' to be undefined and broke the universe.

We over-var and so on on purpose. You can yell at me about that stuff in other tickets. :)

The CSS files are also somewhat delicate. Sometimes we leave out selectors for certain platforms on purpose. There too, it's best to tread lightly.

@unwiredben
@sjmiles

No worries.

Please sign in to comment.
Something went wrong with that request. Please try again.