Skip to content

Commit

Permalink
Fix some JSHint issues
Browse files Browse the repository at this point in the history
Mostly to reduce the scope of disabled warnings.

- Allow es6 syntax
- Disable specific lint rather than all where possible
- Update jshint while we're at it
  • Loading branch information
starwed committed Sep 22, 2018
1 parent 9426e42 commit 9f15cad
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"eqeqeq": true,
"esversion": 5,
"esversion": 6,
"freeze": true,
"futurehostile": true,
"latedef": "nofunc",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"grunt-browserify": "^5.0.0",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-jshint": "^1.1.0",
"grunt-contrib-qunit": "^1.2.0",
"grunt-contrib-uglify": "^2.0.0",
"grunt-contrib-watch": "^1.0.0",
Expand Down
10 changes: 6 additions & 4 deletions src/core/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,14 @@ module.exports = {
isAsset = function(a) {
return Crafty.asset(a) || null;
},
// jshint ignore:start

isSupportedAudio = function(f) {

return Crafty.support.audio && Crafty.audio.supports(
Utility.fileTypeOf( f ).type
);
},
// jshint ignore:end

isValidImage = function(f) {

return -1 < Crafty.imageWhitelist.indexOf(
Expand Down Expand Up @@ -332,7 +332,9 @@ module.exports = {

current = (typeof current === "object") ?
current : {'': current + ''};
// jshint ignore:start

// Disable (Don't make functions in a loop) warning
// jshint -W083
var files = Object.keys( current ).filter(function (key) {

var fileUrl = getFilePath(type, current[key]);
Expand All @@ -344,9 +346,9 @@ module.exports = {
)
return shortURLOf( fileUrl );
});
// jshint +W083

if ( files[0] ) obj = Crafty.audio.add(asset, files);
// jshint ignore:end
//extract actual audio obj if audio creation was successfull
if ( obj ) obj = obj.obj;

Expand Down
2 changes: 1 addition & 1 deletion src/core/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports.blobOf = function blobOf(URI) {

XHR.open('GET', URI);

return new Promise(function (resolve, reject) { // jshint ignore:line
return new Promise(function (resolve, reject) {

XHR.onload = function () { resolve( this.response ); };

Expand Down
17 changes: 3 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ find-up@^1.0.0:
path-exists "^2.0.0"
pinkie-promise "^2.0.0"

[email protected], findup-sync@^0.4.3:
[email protected]:
version "0.4.3"
resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-0.4.3.tgz#40043929e7bc60adf0b7f4827c4c6e75a0deca12"
dependencies:
Expand Down Expand Up @@ -1664,7 +1664,7 @@ grunt-contrib-copy@^1.0.0:
chalk "^1.1.1"
file-sync-cmp "^0.1.0"

grunt-contrib-jshint@^1.0.0:
grunt-contrib-jshint@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/grunt-contrib-jshint/-/grunt-contrib-jshint-1.1.0.tgz#369d909b2593c40e8be79940b21340850c7939ac"
dependencies:
Expand Down Expand Up @@ -3162,18 +3162,7 @@ [email protected]:
version "0.2.0"
resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620"

qunitjs@^2.3.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/qunitjs/-/qunitjs-2.3.1.tgz#dedf1fc55c2a63c5faa3915c063a980c3facb716"
dependencies:
chokidar "1.6.1"
commander "2.9.0"
exists-stat "1.0.0"
findup-sync "^0.4.3"
js-reporters "1.2.0"
walk-sync "0.3.1"

qunitjs@^2.4.1:
qunitjs@^2.3.0, qunitjs@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/qunitjs/-/qunitjs-2.4.1.tgz#88aba055a9e2ec3dbebfaad02471b2cb002c530b"
dependencies:
Expand Down

0 comments on commit 9f15cad

Please sign in to comment.