Skip to content

Commit ad0e4ac

Browse files
committed
Large batch of jshint fixes.
1 parent 325b3a2 commit ad0e4ac

20 files changed

Lines changed: 138 additions & 135 deletions

File tree

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
Gruntfile.js
12
node_modules/*
23
build/*
34
dist/*

.jshintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"globals" : { "Phaser": false, "PIXI": false, "p2": false, "CocoonJS": false, "process": false },
2+
"globals" : { "Phaser": false, "PIXI": false, "p2": false, "CocoonJS": false, "process": false, "JSON": false },
33

44
// Ignore Environment Globals
55
"browser" : true, // Standard browser globals e.g. `window`, `document`.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"grunt-contrib-concat": "^0.4.0",
3737
"grunt-contrib-connect": "^0.7.1",
3838
"grunt-contrib-copy": "^0.5.0",
39-
"grunt-contrib-jshint": "^0.9.2",
39+
"grunt-contrib-jshint": "^1.0.0",
4040
"grunt-contrib-uglify": "^0.4.0",
4141
"grunt-eslint": "^19.0.0",
4242
"grunt-git": "^0.3.3",

src/Phaser.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global Phaser:true */
21
/**
32
* @author Richard Davey <rich@photonstorm.com>
43
* @copyright 2016 Photon Storm Ltd.
@@ -8,7 +7,7 @@
87
/**
98
* @namespace Phaser
109
*/
11-
var Phaser = Phaser || {
10+
var Phaser = Phaser || { // jshint ignore:line
1211

1312
/**
1413
* The Phaser version number.

src/animation/AnimationParser.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,16 @@ Phaser.AnimationParser = {
160160
signature.forEach( function(key) {
161161
if (!json[key])
162162
{
163-
console.warn("Phaser.AnimationParser.JSONDataPyxel: Invalid Pyxel Tilemap JSON given, missing '" + key + "' key.");
163+
console.warn('Phaser.AnimationParser.JSONDataPyxel: Invalid Pyxel Tilemap JSON given, missing "' + key + '" key.');
164164
console.log(json);
165165
return;
166166
}
167167
});
168168

169169
// For this purpose, I only care about parsing tilemaps with a single layer.
170-
if(json['layers'].length != 1) {
171-
console.warn("Phaser.AnimationParser.JSONDataPyxel: Too many layers, this parser only supports flat Tilemaps.");
170+
if (json['layers'].length !== 1)
171+
{
172+
console.warn('Phaser.AnimationParser.JSONDataPyxel: Too many layers, this parser only supports flat Tilemaps.');
172173
console.log(json);
173174
return;
174175
}

src/core/Game.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ Phaser.Game.prototype = {
629629
r = 'WebGL';
630630
c++;
631631
}
632-
else if (this.renderType == Phaser.HEADLESS)
632+
else if (this.renderType === Phaser.HEADLESS)
633633
{
634634
r = 'Headless';
635635
}

src/core/Group.js

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,34 +1180,34 @@ Phaser.Group.prototype.setProperty = function (child, key, value, operation, for
11801180
if (len === 1)
11811181
{
11821182
if (operation === 0) { child[key[0]] = value; }
1183-
else if (operation == 1) { child[key[0]] += value; }
1184-
else if (operation == 2) { child[key[0]] -= value; }
1185-
else if (operation == 3) { child[key[0]] *= value; }
1186-
else if (operation == 4) { child[key[0]] /= value; }
1183+
else if (operation === 1) { child[key[0]] += value; }
1184+
else if (operation === 2) { child[key[0]] -= value; }
1185+
else if (operation === 3) { child[key[0]] *= value; }
1186+
else if (operation === 4) { child[key[0]] /= value; }
11871187
}
11881188
else if (len === 2)
11891189
{
11901190
if (operation === 0) { child[key[0]][key[1]] = value; }
1191-
else if (operation == 1) { child[key[0]][key[1]] += value; }
1192-
else if (operation == 2) { child[key[0]][key[1]] -= value; }
1193-
else if (operation == 3) { child[key[0]][key[1]] *= value; }
1194-
else if (operation == 4) { child[key[0]][key[1]] /= value; }
1191+
else if (operation === 1) { child[key[0]][key[1]] += value; }
1192+
else if (operation === 2) { child[key[0]][key[1]] -= value; }
1193+
else if (operation === 3) { child[key[0]][key[1]] *= value; }
1194+
else if (operation === 4) { child[key[0]][key[1]] /= value; }
11951195
}
11961196
else if (len === 3)
11971197
{
11981198
if (operation === 0) { child[key[0]][key[1]][key[2]] = value; }
1199-
else if (operation == 1) { child[key[0]][key[1]][key[2]] += value; }
1200-
else if (operation == 2) { child[key[0]][key[1]][key[2]] -= value; }
1201-
else if (operation == 3) { child[key[0]][key[1]][key[2]] *= value; }
1202-
else if (operation == 4) { child[key[0]][key[1]][key[2]] /= value; }
1199+
else if (operation === 1) { child[key[0]][key[1]][key[2]] += value; }
1200+
else if (operation === 2) { child[key[0]][key[1]][key[2]] -= value; }
1201+
else if (operation === 3) { child[key[0]][key[1]][key[2]] *= value; }
1202+
else if (operation === 4) { child[key[0]][key[1]][key[2]] /= value; }
12031203
}
12041204
else if (len === 4)
12051205
{
12061206
if (operation === 0) { child[key[0]][key[1]][key[2]][key[3]] = value; }
1207-
else if (operation == 1) { child[key[0]][key[1]][key[2]][key[3]] += value; }
1208-
else if (operation == 2) { child[key[0]][key[1]][key[2]][key[3]] -= value; }
1209-
else if (operation == 3) { child[key[0]][key[1]][key[2]][key[3]] *= value; }
1210-
else if (operation == 4) { child[key[0]][key[1]][key[2]][key[3]] /= value; }
1207+
else if (operation === 1) { child[key[0]][key[1]][key[2]][key[3]] += value; }
1208+
else if (operation === 2) { child[key[0]][key[1]][key[2]][key[3]] -= value; }
1209+
else if (operation === 3) { child[key[0]][key[1]][key[2]][key[3]] *= value; }
1210+
else if (operation === 4) { child[key[0]][key[1]][key[2]][key[3]] /= value; }
12111211
}
12121212

12131213
return true;
@@ -1498,40 +1498,37 @@ Phaser.Group.prototype.callbackFromArray = function (child, callback, length) {
14981498

14991499
// Kinda looks like a Christmas tree
15001500

1501-
if (length == 1)
1501+
if (length === 1)
15021502
{
15031503
if (child[callback[0]])
15041504
{
15051505
return child[callback[0]];
15061506
}
15071507
}
1508-
else if (length == 2)
1508+
else if (length === 2)
15091509
{
15101510
if (child[callback[0]][callback[1]])
15111511
{
15121512
return child[callback[0]][callback[1]];
15131513
}
15141514
}
1515-
else if (length == 3)
1515+
else if (length === 3)
15161516
{
15171517
if (child[callback[0]][callback[1]][callback[2]])
15181518
{
15191519
return child[callback[0]][callback[1]][callback[2]];
15201520
}
15211521
}
1522-
else if (length == 4)
1522+
else if (length === 4)
15231523
{
15241524
if (child[callback[0]][callback[1]][callback[2]][callback[3]])
15251525
{
15261526
return child[callback[0]][callback[1]][callback[2]][callback[3]];
15271527
}
15281528
}
1529-
else
1529+
else if (child[callback])
15301530
{
1531-
if (child[callback])
1532-
{
1533-
return child[callback];
1534-
}
1531+
return child[callback];
15351532
}
15361533

15371534
return false;

src/geom/Circle.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,9 @@ Phaser.Circle.contains = function (a, x, y) {
488488
* @return {boolean} A value of true if the object has exactly the same values for the x, y and diameter properties as this Circle object; otherwise false.
489489
*/
490490
Phaser.Circle.equals = function (a, b) {
491-
return (a.x == b.x && a.y == b.y && a.diameter == b.diameter);
491+
492+
return (a.x === b.x && a.y === b.y && a.diameter === b.diameter);
493+
492494
};
493495

494496
/**
@@ -500,7 +502,9 @@ Phaser.Circle.equals = function (a, b) {
500502
* @return {boolean} A value of true if the specified object intersects with this Circle object; otherwise false.
501503
*/
502504
Phaser.Circle.intersects = function (a, b) {
505+
503506
return (Phaser.Math.distance(a.x, a.y, b.x, b.y) <= (a.radius + b.radius));
507+
504508
};
505509

506510
/**

src/geom/Line.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ Phaser.Line.prototype = {
304304

305305
var i = 1;
306306

307-
while (!((x1 == x2) && (y1 == y2)))
307+
while (!((x1 === x2) && (y1 === y2)))
308308
{
309309
var e2 = err << 1;
310310

src/geom/Rectangle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ Phaser.Rectangle.containsRect = function (a, b) {
913913
*/
914914
Phaser.Rectangle.equals = function (a, b) {
915915

916-
return (a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height);
916+
return (a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height);
917917

918918
};
919919

0 commit comments

Comments
 (0)