Skip to content

Commit ed9e344

Browse files
mikesherovrwaldron
authored andcommitted
enforce double quotes via JSHint. Closes jquerygh-975
1 parent 605a380 commit ed9e344

File tree

16 files changed

+116
-107
lines changed

16 files changed

+116
-107
lines changed

.jshintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"expr": true,
66
"latedef": true,
77
"noarg": true,
8+
"quotmark": "double",
89
"smarttabs": true,
910
"trailing": true,
1011
"undef": true

grunt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ module.exports = function( grunt ) {
153153
}, {
154154
authUsername: config.authUsername,
155155
authToken: config.authToken,
156-
jobName: 'jQuery commit #<a href="https://github.com/jquery/jquery/commit/' + commit + '">' + commit.substr( 0, 10 ) + '</a>',
156+
jobName: "jQuery commit #<a href='https://github.com/jquery/jquery/commit/" + commit + "'>" + commit.substr( 0, 10 ) + "</a>",
157157
runMax: config.runMax,
158158
"runNames[]": tests,
159159
"runUrls[]": testUrls,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"grunt-compare-size": ">=0.1.0",
2727
"grunt-git-authors": ">=1.0.0",
2828
"grunt-update-submodules": ">=0.1.0",
29-
"grunt": "~0.3.9",
29+
"grunt": "~0.3.17",
3030
"testswarm": "0.2.2"
3131
},
3232
"keywords": []

src/.jshintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"undef": true,
1111
"smarttabs": true,
1212
"sub": true,
13-
"maxerr": 100
13+
"maxerr": 100,
14+
"quotmark": "double"
1415
},
1516
"globals": {
1617
"define": true,

test/.jshintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"undef": true,
1111
"smarttabs": true,
1212
"maxerr": 100,
13-
"sub": true
13+
"sub": true,
14+
"quotmark": "double"
1415
},
1516
"globals": {
1617
"define": true,

test/unit/ajax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2674,7 +2674,7 @@ if ( jQuery.ajax && ( !isLocal || hasPHP ) ) {
26742674
ok( false, "error callback called" );
26752675
}
26762676
}).fail(function( _, reason ) {
2677-
strictEqual( reason, 'canceled', "Request aborted by the prefilter must fail with 'canceled' status text" );
2677+
strictEqual( reason, "canceled", "Request aborted by the prefilter must fail with 'canceled' status text" );
26782678
});
26792679

26802680
});

test/unit/attributes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,11 @@ test("removeAttr(String)", function() {
516516

517517
try {
518518
$first = jQuery("#first").attr("contenteditable", "true").removeAttr("contenteditable");
519-
equal( $first.attr('contenteditable'), undefined, "Remove the contenteditable attribute" );
519+
equal( $first.attr("contenteditable"), undefined, "Remove the contenteditable attribute" );
520520
} catch(e) {
521521
ok( false, "Removing contenteditable threw an error (#10429)" );
522522
}
523-
523+
524524
$first = jQuery("<div Case='mixed'></div>");
525525
equal( $first.attr("Case"), "mixed", "case of attribute doesn't matter" );
526526
$first.removeAttr("Case");

test/unit/callbacks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ var output,
3232
};
3333
}
3434
};
35-
35+
3636
function showFlags( flags ) {
3737
if ( typeof flags === "string" ) {
38-
return '"' + flags + '"';
38+
return "'" + flags + "'";
3939
}
4040
var output = [], key;
4141
for ( key in flags ) {
42-
output.push( '"' + key + '": ' + flags[ key ] );
42+
output.push( "'" + key + "': " + flags[ key ] );
4343
}
4444
return "{ " + output.join( ", " ) + " }";
4545
}

test/unit/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ test("XSS via location.hash", function() {
567567
};
568568
try {
569569
// This throws an error because it's processed like an id
570-
jQuery( '#<img id="check9521" src="no-such-.gif" onerror="jQuery._check9521(false)">' ).appendTo("#qunit-fixture");
570+
jQuery( "#<img id='check9521' src='no-such-.gif' onerror='jQuery._check9521(false)'>" ).appendTo("#qunit-fixture");
571571
} catch (err) {
572572
jQuery["_check9521"](true);
573573
}

test/unit/data.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,10 @@ test("jQuery.data supports interoperable hyphenated/camelCase get/set of propert
570570
"an-object": {},
571571
"bool-true": true,
572572
"bool-false": false,
573-
"some-json": '{ "foo": "bar" }',
573+
// JSHint enforces double quotes,
574+
// but JSON strings need double quotes to parse
575+
// so we need escaped double quotes here
576+
"some-json": "{ \"foo\": \"bar\" }",
574577
"num-1-middle": true,
575578
"num-end-2": true,
576579
"2-num-start": true
@@ -597,7 +600,10 @@ test("jQuery.data supports interoperable removal of hyphenated/camelCase propert
597600
"an-object": {},
598601
"bool-true": true,
599602
"bool-false": false,
600-
"some-json": '{ "foo": "bar" }'
603+
// JSHint enforces double quotes,
604+
// but JSON strings need double quotes to parse
605+
// so we need escaped double quotes here
606+
"some-json": "{ \"foo\": \"bar\" }"
601607
};
602608

603609
expect( 27 );
@@ -650,7 +656,7 @@ test( "Only check element attributes once when calling .data() - #8909", functio
650656

651657
test( "JSON data- attributes can have newlines", function() {
652658
expect(1);
653-
659+
654660
var x = jQuery("<div data-some='{\n\"foo\":\n\t\"bar\"\n}'></div>");
655661
equal( x.data("some").foo, "bar", "got a JSON data- attribute with spaces" );
656662
x.remove();

0 commit comments

Comments
 (0)