From 669cb16d763cb5486dadd56ec15a17b2b0303571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski?= Date: Sun, 2 Aug 2015 01:48:54 +0200 Subject: [PATCH] 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 --- Gruntfile.js | 8 ++++++-- package.json | 1 + src/.jshintrc | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 1a6bdac1a..0fe64d7e6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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 diff --git a/package.json b/package.json index 5d8299534..43d24ba5d 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "requirejs": "2.1.17", "sinon": "1.10.3", "sizzle": "2.2.0", + "strip-json-comments": "1.0.3", "testswarm": "1.1.0", "win-spawn": "2.0.0" }, diff --git a/src/.jshintrc b/src/.jshintrc index 281b683b9..ea3549d5c 100644 --- a/src/.jshintrc +++ b/src/.jshintrc @@ -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, "globals": {