Skip to content

Commit

Permalink
Build: Add a comment explaining why the es3 option is needed
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mgol committed Aug 3, 2015
1 parent b8b111e commit b988c0e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ module.exports = function( grunt ) {
function readOptionalJSON( filepath ) {
var data = {};
try {
data = grunt.file.readJSON( filepath );
data = JSON.parse( stripJSONComments(
fs.readFileSync( filepath, { encoding: "utf8" } )
) );
} catch ( e ) {}
return data;
}

var gzip = require( "gzip-js" ),
var fs = require( "fs" ),
stripJSONComments = require( "strip-json-comments" ),
gzip = require( "gzip-js" ),
srcHintOptions = readOptionalJSON( "src/.jshintrc" );

// The concatenated file won't pass onevar
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"requirejs": "2.1.17",
"sinon": "1.12.2",
"sizzle": "2.2.0",
"strip-json-comments": "1.0.3",
"testswarm": "1.1.0"
},
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions src/.jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

"sub": true,

// Support: IE < 10, Android < 4.1
// The above browsers are failing a lot of tests in the ES5
// test suite at http://test262.ecmascript.org.
"es3": true,
"browser": true,
"wsh": true,
Expand Down

0 comments on commit b988c0e

Please sign in to comment.