Skip to content

Commit b988c0e

Browse files
committed
Build: Add a comment explaining why the es3 option is needed
It might not be obvious to everyone that IE 9 & Android 4.0 are not ES5-compliant browsers (by a large margin) so it's better to add a support comment. This requires slight changes in parsing the config file as it's not a pure JSON anymore. JSHint understands such files without problems. (cherry-picked from 669cb16) Closes gh-2520
1 parent b8b111e commit b988c0e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

Gruntfile.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ module.exports = function( grunt ) {
44
function readOptionalJSON( filepath ) {
55
var data = {};
66
try {
7-
data = grunt.file.readJSON( filepath );
7+
data = JSON.parse( stripJSONComments(
8+
fs.readFileSync( filepath, { encoding: "utf8" } )
9+
) );
810
} catch ( e ) {}
911
return data;
1012
}
1113

12-
var gzip = require( "gzip-js" ),
14+
var fs = require( "fs" ),
15+
stripJSONComments = require( "strip-json-comments" ),
16+
gzip = require( "gzip-js" ),
1317
srcHintOptions = readOptionalJSON( "src/.jshintrc" );
1418

1519
// The concatenated file won't pass onevar

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"requirejs": "2.1.17",
4646
"sinon": "1.12.2",
4747
"sizzle": "2.2.0",
48+
"strip-json-comments": "1.0.3",
4849
"testswarm": "1.1.0"
4950
},
5051
"scripts": {

src/.jshintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
"sub": true,
1414

15+
// Support: IE < 10, Android < 4.1
16+
// The above browsers are failing a lot of tests in the ES5
17+
// test suite at http://test262.ecmascript.org.
1518
"es3": true,
1619
"browser": true,
1720
"wsh": true,

0 commit comments

Comments
 (0)