From 557e1e0311223707fd471d0e02015f224ba7cf49 Mon Sep 17 00:00:00 2001 From: Nelson Loyola Date: Tue, 23 Aug 2016 17:31:11 +0200 Subject: [PATCH] Added option to turn off JSHint for translations When the option is set to true, the comment "// jshint ignore: start" is prepended to the compiled translations file. Thus the file is ignored by JSHint. --- README.md | 7 ++++--- lib/compile.js | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9827d7e..623abad 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Check the website for usage instructions: [http://angular-gettext.rocketeer.be/] ## Options -All options and defaults are displayed below: +All options and defaults are displayed below: ```JSON { @@ -33,11 +33,12 @@ All options and defaults are displayed below: "lineNumbers": true, "format": "javascript", "defaultLanguage": false, - "requirejs": false + "requirejs": false, + "jshintIgnore": false } ``` -## License +## License (The MIT License) diff --git a/lib/compile.js b/lib/compile.js index 96234d3..251b2dc 100644 --- a/lib/compile.js +++ b/lib/compile.js @@ -20,7 +20,11 @@ var formats = { module += '}]);'; if (options.requirejs) { - return 'define([\'angular\', \'' + options.modulePath + '\'], function (angular) {\n' + module + '\n});'; + module = 'define([\'angular\', \'' + options.modulePath + '\'], function (angular) {\n' + module + '\n});'; + } + + if (options.jshintIgnore) { + module = '// jshint ignore: start\n' + module; } return module;