From a7b773befe2e11441f88c8a7b87f3a076db403cf Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Mon, 5 Aug 2013 14:02:08 -0400 Subject: [PATCH] Convert JSHint settings to a .jshintrc file. The new version of the Eclipse JSHint plugin, 0.9.8, now stores settings in this more standard format. --- .jshintrc | 45 +++++++++++++++++++ .settings/com.eclipsesource.jshint.ui.prefs | 1 - .../createSandcastleJsHintOptions.js | 10 +---- Tools/buildTasks/runJsHint.js | 16 ++----- Tools/buildTasks/shared.js | 8 +++- build.xml | 11 +++-- 6 files changed, 63 insertions(+), 28 deletions(-) create mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 000000000000..d0aab9e94a74 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,45 @@ +{ + "bitwise": false, + "camelcase": false, + "curly": true, + "eqeqeq": true, + "es3": true, + "forin": true, + "immed": true, + "latedef": true, + "newcap": true, + "noarg": true, + "noempty": false, + "nonew": true, + "plusplus": false, + "quotmark": false, + "regexp": false, + "undef": true, + "unused": false, + "strict": true, + "trailing": true, + "asi": false, + "boss": false, + "debug": false, + "eqnull": false, + "esnext": false, + "evil": false, + "expr": false, + "funcscope": false, + "globalstrict": false, + "iterator": false, + "lastsemic": false, + "laxbreak": false, + "laxcomma": false, + "loopfunc": false, + "moz": false, + "multistr": true, + "proto": false, + "regexdash": false, + "scripturl": false, + "smarttabs": false, + "shadow": false, + "sub": false, + "supernew": false, + "browser": true +} \ No newline at end of file diff --git a/.settings/com.eclipsesource.jshint.ui.prefs b/.settings/com.eclipsesource.jshint.ui.prefs index 786365c144f3..5d8e5b1f560c 100644 --- a/.settings/com.eclipsesource.jshint.ui.prefs +++ b/.settings/com.eclipsesource.jshint.ui.prefs @@ -1,5 +1,4 @@ eclipse.preferences.version=1 excluded=Apps/Sandcastle/ThirdParty//*\:Source/ThirdParty//*\:Source/Workers/cesiumWorkerBootstrapper.js\:ThirdParty//*\:Tools/build.js included=//*.js -options=bitwise \: false,\r\ncamelcase \: false,\r\ncurly \: true,\r\neqeqeq \: true,\r\nes3 \: true,\r\nforin \: true,\r\nimmed \: true,\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\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\nmoz \: false,\r\nmultistr \: true,\r\nproto \: false,\r\nregexdash \: false,\r\nscripturl \: false,\r\nsmarttabs \: false,\r\nshadow \: false,\r\nsub \: false,\r\nsupernew \: false,\r\nbrowser \: true projectSpecificOptions=true diff --git a/Tools/buildTasks/createSandcastleJsHintOptions.js b/Tools/buildTasks/createSandcastleJsHintOptions.js index 268e8e6917df..01bc9fa929cc 100644 --- a/Tools/buildTasks/createSandcastleJsHintOptions.js +++ b/Tools/buildTasks/createSandcastleJsHintOptions.js @@ -3,15 +3,9 @@ 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*/ +load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,loadJsHintOptionsFile,File,FileReader,FileWriter,FileUtils*/ -function loadJsHintOptions() { - "use strict"; - /*jshint evil:true*/ - return eval('({' + attributes.get('jshintoptions') + '})'); -} - -var jsHintOptions = loadJsHintOptions(); +var jsHintOptions = loadJsHintOptionsFile(attributes.get('jshintoptionspath')); jsHintOptions.predef = ['require', 'console', 'Sandcastle', 'Cesium']; diff --git a/Tools/buildTasks/runJsHint.js b/Tools/buildTasks/runJsHint.js index 2d5d96e04105..de296e8c962f 100644 --- a/Tools/buildTasks/runJsHint.js +++ b/Tools/buildTasks/runJsHint.js @@ -3,24 +3,16 @@ 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*/ +load(project.getProperty('tasksDirectory') + '/shared.js'); /*global forEachFile,readFileContents,writeFileContents,loadJsHintOptionsFile,File,FileReader,FileWriter,FileUtils*/ /*global window:true*/ var window = window || {}; -var jsHintPath = attributes.get('jshintpath'); -load(jsHintPath); /*global JSHINT*/ +load(attributes.get('jshintpath')); /*global JSHINT*/ -function loadJsHintOptions() { - "use strict"; - /*jshint evil:true*/ - return eval('({' + attributes.get('jshintoptions') + '})'); -} - -var jsHintOptions = loadJsHintOptions(); +var jsHintOptions = loadJsHintOptionsFile(attributes.get('jshintoptionspath')); -var sandcastleJsHintOptionsPath = attributes.get('sandcastlejshintoptionspath'); -load(sandcastleJsHintOptionsPath);/*global sandcastleJsHintOptions*/ +load(attributes.get('sandcastlejshintoptionspath')); /*global sandcastleJsHintOptions*/ var errors = []; diff --git a/Tools/buildTasks/shared.js b/Tools/buildTasks/shared.js index 92e3674edadd..8b0414edb02c 100644 --- a/Tools/buildTasks/shared.js +++ b/Tools/buildTasks/shared.js @@ -48,4 +48,10 @@ function writeFileContents(filename, contents, writeIfUnchanged) { writer.write(contents); writer.close(); } -} \ No newline at end of file +} + +function loadJsHintOptionsFile(path) { + "use strict"; + /*jshint evil:true*/ + return eval('(' + readFileContents(path) + ')'); +} diff --git a/build.xml b/build.xml index 24ff80506822..682e92002a9e 100644 --- a/build.xml +++ b/build.xml @@ -18,7 +18,7 @@ - + @@ -128,6 +128,7 @@ + @@ -184,21 +185,19 @@ - + - + - - - +