Permalink
Browse files

Allow multi-line strings in JSHint options.

  • Loading branch information...
shunter committed Mar 25, 2013
1 parent f2e4375 commit 8cfaa6fadff46646dbdbde9f576ed10dca755a96
@@ -1,5 +1,5 @@
eclipse.preferences.version=1
excluded=Apps/Sandcastle/Cesium-hint.js\:Source/ThirdParty//*\:Source/Workers/cesiumWorkerBootstrapper.js\:ThirdParty//*
included=//*.js
-options=bitwise \: false,\r\ncamelcase \: false,\r\ncurly \: true,\r\neqeqeq \: true,\r\nforin \: true,\r\nimmed \: false,\r\nlatedef \: true,\r\nnewcap \: true,\r\nnoarg \: true,\r\nnoempty \: false,\r\nnonew \: true,\r\nplusplus \: false,\r\nquotmark \: false,\r\nregexp \: false,\r\nundef \: true,\r\nunused \: false,\r\nstrict \: true,\r\ntrailing \: true,\r\nasi \: false,\r\nboss \: false,\r\ndebug \: false,\r\neqnull \: false,\r\nes5 \: false,\r\nesnext \: false,\r\nevil \: false,\r\nexpr \: false,\r\nfuncscope \: false,\r\nglobalstrict \: false,\r\niterator \: false,\r\nlastsemic \: false,\r\nlaxbreak \: false,\r\nlaxcomma \: false,\r\nloopfunc \: false,\r\nmultistr \: false,\r\nonecase \: false,\r\nproto \: false,\r\nregexdash \: false,\r\nscripturl \: false,\r\nsmarttabs \: false,\r\nshadow \: false,\r\nsub \: false,\r\nsupernew \: false,\r\nvalidthis \: false,\r\nbrowser \: true
+options=bitwise \: false,\r\ncamelcase \: false,\r\ncurly \: true,\r\neqeqeq \: true,\r\nforin \: true,\r\nimmed \: false,\r\nlatedef \: true,\r\nnewcap \: true,\r\nnoarg \: true,\r\nnoempty \: false,\r\nnonew \: true,\r\nplusplus \: false,\r\nquotmark \: false,\r\nregexp \: false,\r\nundef \: true,\r\nunused \: false,\r\nstrict \: true,\r\ntrailing \: true,\r\nasi \: false,\r\nboss \: false,\r\ndebug \: false,\r\neqnull \: false,\r\nes5 \: false,\r\nesnext \: false,\r\nevil \: false,\r\nexpr \: false,\r\nfuncscope \: false,\r\nglobalstrict \: false,\r\niterator \: false,\r\nlastsemic \: false,\r\nlaxbreak \: false,\r\nlaxcomma \: false,\r\nloopfunc \: false,\r\nmultistr \: true,\r\nonecase \: false,\r\nproto \: false,\r\nregexdash \: false,\r\nscripturl \: false,\r\nsmarttabs \: false,\r\nshadow \: false,\r\nsub \: false,\r\nsupernew \: false,\r\nvalidthis \: false,\r\nbrowser \: true
projectSpecificOptions=true
@@ -1,6 +1,4 @@
/*global importClass,project,attributes,elements,java,Packages*/
-/*jshint strict:false,multistr:true*/
-
importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/
Main.exec(['-e', '{}']);
var load = Main.global.load;
@@ -14,6 +12,8 @@ var assignments = [];
var nonIdentifierRegexp = /[^0-9a-zA-Z_$]/g;
forEachFile('sourcefiles', function(relativePath, file) {
+ "use strict";
+
var moduleId = relativePath.replace('\\', '/');
moduleId = moduleId.substring(0, moduleId.lastIndexOf('.'));
@@ -1,6 +1,4 @@
/*global importClass,project,attributes,elements,java,Packages*/
-/*jshint strict:false,multistr:true*/
-
importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/
Main.exec(['-e', '{}']);
var load = Main.global.load;
@@ -10,6 +8,8 @@ load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile
var demos = [];
forEachFile('demos', function(relativePath, file) {
+ "use strict";
+
var demo = relativePath.substring(0, relativePath.lastIndexOf('.')).replace('\\', '/');
var demoObject = {
name : String(demo),
@@ -1,13 +1,18 @@
/*global importClass,project,attributes,elements,java,Packages*/
-/*jshint strict:false,multistr:true,evil:true*/
-
importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/
Main.exec(['-e', '{}']);
var load = Main.global.load;
load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,File,FileReader,FileWriter,FileUtils*/
-var jsHintOptions = eval('({' + attributes.get('jshintoptions') + '})');
+function loadJsHintOptions() {
+ "use strict";
+ /*jshint evil:true*/
+ return eval('({' + attributes.get('jshintoptions') + '})');
+}
+
+var jsHintOptions = loadJsHintOptions();
+
jsHintOptions.predef = ['require', 'console', 'Sandcastle', 'Cesium'];
var contents = '\
@@ -1,6 +1,4 @@
/*global importClass,project,attributes,elements,java,Packages*/
-/*jshint strict:false,multistr:true*/
-
importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/
Main.exec(['-e', '{}']);
var load = Main.global.load;
@@ -10,6 +8,8 @@ load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile
var specs = [];
forEachFile('specs', function(relativePath, file) {
+ "use strict";
+
var spec = relativePath.substring(0, relativePath.lastIndexOf('.')).replace('\\', '/');
specs.push("'Specs/" + spec + "'");
});
@@ -1,6 +1,4 @@
/*global importClass,project,attributes,elements,java,Packages*/
-/*jshint strict:false,multistr:true*/
-
importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/
Main.exec(['-e', '{}']);
var load = Main.global.load;
@@ -9,6 +7,8 @@ load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile
var glslDocComments = [];
forEachFile('glslfiles', function(relativePath, file) {
+ "use strict";
+
var contents = readFileContents(file);
contents = contents.replace(/\r\n/gm, '\n');
@@ -1,16 +1,14 @@
/*global importClass,project,attributes,elements,java,Packages*/
-/*jshint strict:false,multistr:true*/
-
-importClass(java.io.StringReader); /*global StringReader*/
-importClass(java.util.HashSet); /*global HashSet*/
-importClass(Packages.org.apache.tools.ant.filters.StripJavaComments); /*global StripJavaComments*/
-
importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/
Main.exec(['-e', '{}']);
var load = Main.global.load;
load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,File,FileReader,FileWriter,FileUtils*/
+importClass(java.io.StringReader); /*global StringReader*/
+importClass(java.util.HashSet); /*global HashSet*/
+importClass(Packages.org.apache.tools.ant.filters.StripJavaComments); /*global StripJavaComments*/
+
var minify = /^true$/.test(attributes.get('minify'));
var minifyStateFilePath = attributes.get('minifystatefile');
@@ -23,10 +21,12 @@ var minifyStateFileLastModified = new File(minifyStateFilePath).lastModified();
var leftOverJsFiles = new HashSet();
forEachFile('existingjsfiles', function(relativePath, file) {
+ "use strict";
leftOverJsFiles.add(file.getAbsolutePath());
});
forEachFile('glslfiles', function(relativePath, file) {
+ "use strict";
var glslFile = file;
var jsFile = new File(file.getParent(), file.getName().replace('.glsl', '.js'));
@@ -1,6 +1,4 @@
/*global self,importClass,project,attributes,elements,java,Packages*/
-/*jshint strict:false,multistr:true,evil:true*/
-
importClass(Packages.org.mozilla.javascript.tools.shell.Main); /*global Main*/
Main.exec(['-e', '{}']);
var load = Main.global.load;
@@ -10,7 +8,13 @@ load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile
var jsHintPath = attributes.get('jshintpath');
load(jsHintPath); /*global JSHINT*/
-var jsHintOptions = eval('({' + attributes.get('jshintoptions') + '})');
+function loadJsHintOptions() {
+ "use strict";
+ /*jshint evil:true*/
+ return eval('({' + attributes.get('jshintoptions') + '})');
+}
+
+var jsHintOptions = loadJsHintOptions();
var sandcastleJsHintOptionsPath = attributes.get('sandcastlejshintoptionspath');
load(sandcastleJsHintOptionsPath);/*global sandcastleJsHintOptions*/
@@ -1,12 +1,12 @@
/*global importClass,project,attributes,elements,java,Packages*/
-/*jshint strict:false*/
-
importClass(java.io.File); /*global File*/
importClass(java.io.FileReader); /*global FileReader*/
importClass(java.io.FileWriter); /*global FileWriter*/
importClass(Packages.org.apache.tools.ant.util.FileUtils); /*global FileUtils*/
function forEachFile(filesetName, func) {
+ "use strict";
+
var filesets = elements.get(filesetName);
for ( var i = 0, filesetsLen = filesets.size(); i < filesetsLen; ++i) {
var fileset = filesets.get(i);
@@ -23,6 +23,8 @@ function forEachFile(filesetName, func) {
}
function readFileContents(file) {
+ "use strict";
+
var reader = new FileReader(file);
var contents = String(FileUtils.readFully(reader));
reader.close();
@@ -31,6 +33,8 @@ function readFileContents(file) {
}
function writeFileContents(filename, contents, writeIfUnchanged) {
+ "use strict";
+
var previousContents;
var file = new File(filename);
if (!writeIfUnchanged) {

0 comments on commit 8cfaa6f

Please sign in to comment.