Skip to content

Commit 669cb16

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. Closes gh-2520
1 parent aabe94e commit 669cb16

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
@@ -47,6 +47,7 @@
4747
"requirejs": "2.1.17",
4848
"sinon": "1.10.3",
4949
"sizzle": "2.2.0",
50+
"strip-json-comments": "1.0.3",
5051
"testswarm": "1.1.0",
5152
"win-spawn": "2.0.0"
5253
},

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

1720
"globals": {

0 commit comments

Comments
 (0)