From af9235ddd8a1e621eeec891a87ee0cf4df248602 Mon Sep 17 00:00:00 2001 From: ficristo Date: Wed, 9 Dec 2015 21:35:14 +0100 Subject: [PATCH] Switched from JSHint to ESLint --- .brackets.json | 11 ++++ .eslintignore | 2 + .eslintrc.json | 46 +++++++++++++++ .jshintrc | 75 ------------------------- Gruntfile.js | 16 +++--- appshell/appshell_extensions.js | 3 - appshell/node-core/BaseDomain.js | 28 ++++----- appshell/node-core/ConnectionManager.js | 40 ++++++------- appshell/node-core/DomainManager.js | 32 +++++------ appshell/node-core/Launcher.js | 38 ++++++------- appshell/node-core/Logger.js | 34 ++++++----- appshell/node-core/Server.js | 43 +++++++------- package.json | 2 +- tasks/.eslintrc.json | 7 +++ tasks/build.js | 3 - tasks/common.js | 32 +++++------ tasks/set-release.js | 2 - tasks/setup.js | 10 +--- 18 files changed, 193 insertions(+), 231 deletions(-) create mode 100644 .brackets.json create mode 100644 .eslintignore create mode 100644 .eslintrc.json delete mode 100644 .jshintrc create mode 100644 tasks/.eslintrc.json diff --git a/.brackets.json b/.brackets.json new file mode 100644 index 000000000..9e286c6e3 --- /dev/null +++ b/.brackets.json @@ -0,0 +1,11 @@ +{ + "defaultExtension": "js", + "language": { + "javascript": { + "linting.prefer": ["ESLint"], + "linting.usePreferredOnly": true + } + }, + "spaceUnits": 4, + "useTabChar": false +} diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..2c8fa919f --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +# Third party modules +**/thirdparty/** diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..508174566 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,46 @@ +{ + "env": { + "node": true + }, + "rules": { + "no-bitwise": 2, + "curly": 2, + "eqeqeq": 2, + "guard-for-in": 2, + "wrap-iife": [2, "outside"], + "no-use-before-define": 2, + "new-cap": 2, + "no-caller": 2, + "no-empty": 2, + "no-new": 2, + "no-invalid-regexp": 2, + "no-control-regex": 2, + "no-regex-spaces": 2, + "no-undef": 2, + "strict": 2, + "no-unused-vars": [2, {"vars": "all", "args": "none"}], + "semi": 2, + + "no-iterator": 2, + "no-loop-func": 2, + "no-multi-str": 2, + "no-fallthrough": 2, + "no-proto": 2, + "no-script-url": 2, + "no-shadow": 0, + "no-shadow-restricted-names": 2, + "no-new-func": 2, + "no-new-wrappers": 2, + "no-new-require": 2, + "new-parens": 2, + "no-new-object": 2, + "no-invalid-this": 2, + "indent": [2, 4], + + "valid-jsdoc": 0, + "valid-typeof": 2, + + "no-trailing-spaces": [2, { "skipBlankLines": true }], + "eol-last": 2 + } +} diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 33c869c08..000000000 --- a/.jshintrc +++ /dev/null @@ -1,75 +0,0 @@ -{ - "bitwise" : true, - "curly" : true, - "eqeqeq" : true, - "forin" : true, - "immed" : true, - "latedef" : true, - "newcap" : true, - "noarg" : true, - "noempty" : true, - "nonew" : true, - "plusplus" : true, - "regexp" : true, - "undef" : true, - "strict" : true, - "trailing" : false, - - "asi" : false, - "boss" : false, - "debug" : false, - "eqnull" : false, - "es5" : false, - "esnext" : false, - "evil" : false, - "expr" : false, - "funcscope" : false, - "globalstrict" : false, - "iterator" : false, - "lastsemic" : false, - "laxbreak" : false, - "laxcomma" : false, - "loopfunc" : false, - "multistr" : false, - "onecase" : false, - "proto" : false, - "regexdash" : false, - "scripturl" : false, - "smarttabs" : false, - "shadow" : false, - "sub" : false, - "supernew" : false, - "validthis" : false, - - "browser" : true, - "couch" : false, - "devel" : false, - "dojo" : false, - "jquery" : false, - "mootools" : false, - "node" : false, - "nonstandard" : false, - "prototypejs" : false, - "rhino" : false, - "wsh" : false, - - "nomen" : false, - "onevar" : false, - "passfail" : false, - "white" : false, - - "maxerr" : 100, - "predef" : [ - ], - "indent" : 4, - "globals" : [ - "require", - "define", - "brackets", - "$", - "PathUtils", - "window", - "navigator", - "Mustache" - ] -} \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 2c4a9bf29..d9ea64e9c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -20,13 +20,11 @@ * DEALINGS IN THE SOFTWARE. * */ -/*jslint regexp:true*/ -/*global module, require, process*/ + module.exports = function (grunt) { "use strict"; var common = require("./tasks/common")(grunt), - resolve = common.resolve, platform = common.platform(), staging; @@ -202,10 +200,14 @@ module.exports = function (grunt) { "dest" : "deps/cef" } }, - "jshint": { - "all" : ["Gruntfile.js", "tasks/**/*.js"], + "eslint": { + "all" : [ + "Gruntfile.js", + "tasks/**/*.js", + "appshell/node-core/*.js" + ], "options": { - "jshintrc" : ".jshintrc" + "quiet" : true } }, "build": { @@ -235,7 +237,7 @@ module.exports = function (grunt) { }); grunt.loadTasks("tasks"); - grunt.loadNpmTasks("grunt-contrib-jshint"); + grunt.loadNpmTasks("grunt-eslint"); grunt.loadNpmTasks("grunt-contrib-copy"); grunt.loadNpmTasks("grunt-contrib-clean"); grunt.loadNpmTasks("grunt-curl"); diff --git a/appshell/appshell_extensions.js b/appshell/appshell_extensions.js index 244e028a3..7e8db28d0 100644 --- a/appshell/appshell_extensions.js +++ b/appshell/appshell_extensions.js @@ -27,9 +27,6 @@ // Note: All file native file i/o functions are synchronous, but are exposed // here as asynchronous calls. -/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, forin: true, maxerr: 50, regexp: true */ -/*global define, native */ - var appshell; if (!appshell) { appshell = {}; diff --git a/appshell/node-core/BaseDomain.js b/appshell/node-core/BaseDomain.js index 9a19373c5..c62280ab8 100644 --- a/appshell/node-core/BaseDomain.js +++ b/appshell/node-core/BaseDomain.js @@ -1,30 +1,26 @@ /* * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * */ -/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, - maxerr: 50, node: true */ -/*global */ - (function () { "use strict"; diff --git a/appshell/node-core/ConnectionManager.js b/appshell/node-core/ConnectionManager.js index e2c3e8e33..c6394cf50 100644 --- a/appshell/node-core/ConnectionManager.js +++ b/appshell/node-core/ConnectionManager.js @@ -1,30 +1,26 @@ /* * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * */ -/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, -maxerr: 50, node: true */ -/*global */ - (function () { "use strict"; @@ -69,7 +65,7 @@ maxerr: 50, node: true */ /** * @private * Sends a message over the WebSocket. Called by public sendX commands. - * @param {string} type Message type. Currently supported types are + * @param {string} type Message type. Currently supported types are "event", "commandResponse", "commandError", "error" * @param {object} message Message body, must be JSON.stringify-able */ @@ -132,7 +128,9 @@ maxerr: 50, node: true */ if (this._ws) { try { this._ws.close(); - } catch (e) { } + } catch (e) { + // Do nothing + } } this._connected = false; _connections.splice(_connections.indexOf(this), 1); @@ -182,7 +180,7 @@ maxerr: 50, node: true */ }; /** - * Sends a response indicating that an error occurred during command + * Sends a response indicating that an error occurred during command * execution * @param {number} id unique ID of the command that was executed. ID is * generated by the client when the command is issued. @@ -226,7 +224,9 @@ maxerr: 50, node: true */ for (i = 0; i < _connections.length; i++) { try { _connections[i].close(); - } catch (err) { } + } catch (err) { + // Do nothing + } } _connections = []; } diff --git a/appshell/node-core/DomainManager.js b/appshell/node-core/DomainManager.js index 7db643da4..28fe90c06 100644 --- a/appshell/node-core/DomainManager.js +++ b/appshell/node-core/DomainManager.js @@ -1,35 +1,33 @@ /* * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * */ -/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, -maxerr: 50, node: true */ -/*global */ - (function () { "use strict"; + // TODO: verify if this has any side effects, and if not remove it. + require("./Server"); + var util = require("util"), - server = require("./Server"), ConnectionManager = require("./ConnectionManager"); /** diff --git a/appshell/node-core/Launcher.js b/appshell/node-core/Launcher.js index ae2ed57af..f8ffbbc42 100644 --- a/appshell/node-core/Launcher.js +++ b/appshell/node-core/Launcher.js @@ -1,30 +1,26 @@ /* * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * */ -/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, -maxerr: 50, node: true */ -/*global */ - (function () { "use strict"; @@ -35,12 +31,12 @@ maxerr: 50, node: true */ /** @define {boolean} Whether debugger should be enabled at launch * * If true, the debugger is enabled automatically, and the init function is - * *not* called. This gives the user time to connect with the remote - * debugger and set breakpoints before running "launch" him/herself from the - * console. In this case, launch is run by calling the global function + * *not* called. This gives the user time to connect with the remote + * debugger and set breakpoints before running "launch" him/herself from the + * console. In this case, launch is run by calling the global function * debugLaunch(), which only exists if DEBUG_ON_LAUNCH is set. * - * NOTE: This is only useful for debugging the launch routine. If you + * NOTE: This is only useful for debugging the launch routine. If you * want to simply debug some command module, enable the debugger by * sending the base.enableDebugger command and then connect to it. * @@ -115,7 +111,7 @@ maxerr: 50, node: true */ }, 100000); // Inject a global so that user can call launch from the console - // The debugger won't stop at breakpoints if they're reached as a + // The debugger won't stop at breakpoints if they're reached as a // direct result of evaluation of the console. So, we call launch() // from a timer. This will allow hitting breakpoints set in launch() // and in the functions it calls. diff --git a/appshell/node-core/Logger.js b/appshell/node-core/Logger.js index 61a9ba42b..6b0ca45dc 100644 --- a/appshell/node-core/Logger.js +++ b/appshell/node-core/Logger.js @@ -1,30 +1,26 @@ /* * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * */ -/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, -maxerr: 50, node: true */ -/*global */ - (function () { "use strict"; @@ -32,7 +28,7 @@ maxerr: 50, node: true */ util = require("util"), EventEmitter = require("events").EventEmitter; - /** + /** * @constructor * The Logger module is a singleton object used for logging. * Logger inherits from the EventEmitter class and exports itself @@ -73,7 +69,9 @@ maxerr: 50, node: true */ fs.appendFileSync(_logFilename, timestampString + message + "\n"); - } catch (e) { } + } catch (e) { + // Do nothing + } } _logHistory.push({ level: level, diff --git a/appshell/node-core/Server.js b/appshell/node-core/Server.js index 64b5434ab..e30a3ca71 100644 --- a/appshell/node-core/Server.js +++ b/appshell/node-core/Server.js @@ -1,30 +1,26 @@ /* * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * */ -/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, -maxerr: 50, node: true */ -/*global */ - (function () { "use strict"; @@ -34,15 +30,14 @@ maxerr: 50, node: true */ /** @define{number} Number of ms between pings to parent process */ var PING_DELAY = 1000; // send ping to parent process every 1 second - var fs = require("fs"), - http = require("http"), + var http = require("http"), WebSocket = require("./thirdparty/ws"), EventEmitter = require("events").EventEmitter, Logger = require("./Logger"), ConnectionManager = require("./ConnectionManager"), DomainManager = require("./DomainManager"); - /** + /** * @constructor * The Server module is a singleton object that manages both the * connection to the parent process (over stdin/stdout) and to clients @@ -80,12 +75,16 @@ maxerr: 50, node: true */ if (_wsServer) { try { _wsServer.close(); - } catch (err1) { } + } catch (err1) { + // Do nothing + } } if (_httpServer) { try { _httpServer.close(); - } catch (err2) { } + } catch (err2) { + // Do nothing + } } ConnectionManager.closeAllConnections(); Logger.info("[Server] stopped"); @@ -135,7 +134,7 @@ maxerr: 50, node: true */ // set up event handlers for stdin process.stdin.on("data", function (data) { - // no-op, but make sure we read the data so the buffer + // no-op, but make sure we read the data so the buffer // doesn't fill up }); diff --git a/package.json b/package.json index e3009fbff..6345daed5 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "devDependencies": { "grunt": "0.4.1", "grunt-cli": "0.1.6", - "grunt-contrib-jshint": "0.2.0", + "grunt-eslint": "17.3.1", "grunt-contrib-copy": "0.5.0", "grunt-contrib-clean": "0.4.0", "guid": "0.0.10", diff --git a/tasks/.eslintrc.json b/tasks/.eslintrc.json new file mode 100644 index 000000000..653a5abb7 --- /dev/null +++ b/tasks/.eslintrc.json @@ -0,0 +1,7 @@ +{ + "extends": "../.eslintrc.json", + + "rules": { + "no-invalid-this": 0 + } +} diff --git a/tasks/build.js b/tasks/build.js index b5517e093..0ca6a98c9 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -20,15 +20,12 @@ * DEALINGS IN THE SOFTWARE. * */ -/*jslint vars:true, regexp:true, nomen:true*/ -/*global module, require, process*/ module.exports = function (grunt) { "use strict"; var fs = require("fs"), common = require("./common")(grunt), - q = require("q"), semver = require("semver"), spawn = common.spawn, resolve = common.resolve, diff --git a/tasks/common.js b/tasks/common.js index 226dcbce6..0760baa03 100644 --- a/tasks/common.js +++ b/tasks/common.js @@ -1,27 +1,26 @@ /* * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * */ -/*jslint es5:true, vars: true, plusplus: true, regexp: true, nomen: true*/ -/*global module, require, process, Buffer*/ + module.exports = function (grunt) { "use strict"; @@ -141,10 +140,7 @@ module.exports = function (grunt) { */ function spawn(commands, opts) { var result = q.resolve(), - children = [], - i, - current, - next; + children = []; opts = opts || {}; opts.env = opts.env || process.env; diff --git a/tasks/set-release.js b/tasks/set-release.js index 77cccbbd6..1a2c81430 100644 --- a/tasks/set-release.js +++ b/tasks/set-release.js @@ -20,7 +20,6 @@ * DEALINGS IN THE SOFTWARE. * */ -/*global module, require*/ module.exports = function (grunt) { "use strict"; @@ -48,7 +47,6 @@ module.exports = function (grunt) { packageJSON = grunt.file.readJSON(packageJsonPath), winInstallerBuildXmlPath = "installer/win/brackets-win-install-build.xml", buildInstallerScriptPath = "installer/mac/buildInstaller.sh", - wxsPath = "installer/win/Brackets.wxs", versionRcPath = "appshell/version.rc", infoPlistPath = "appshell/mac/Info.plist", release = grunt.option("release") || "", diff --git a/tasks/setup.js b/tasks/setup.js index 7323061e2..94735d7c5 100644 --- a/tasks/setup.js +++ b/tasks/setup.js @@ -20,14 +20,12 @@ * DEALINGS IN THE SOFTWARE. * */ -/*jslint vars:true*/ -/*global module, require, process*/ + module.exports = function (grunt) { "use strict"; var common = require("./common")(grunt), fs = require("fs"), - child_process = require("child_process"), path = require("path"), q = require("q"), /* win only (lib), mac only (Resources, tools) */ @@ -102,8 +100,6 @@ module.exports = function (grunt) { // task: cef-clean grunt.registerTask("cef-clean", "Removes CEF binaries and linked folders", function () { - var path; - // delete dev symlinks from "setup_for_hacking" common.deleteFile("Release/dev", { force: true }); common.deleteFile("Debug/dev", { force: true }); @@ -276,8 +272,7 @@ module.exports = function (grunt) { return rename("deps/" + zipName, "deps/cef"); }).then(function () { var memo = path.resolve(process.cwd(), "deps/cef/" + zipName + ".txt"), - permissionsPromise, - defer = q.defer(); + permissionsPromise; if (platform === "mac") { // FIXME figure out how to use fs.chmod to only do additive mode u+x @@ -334,7 +329,6 @@ module.exports = function (grunt) { curlTask = "curl-dir:" + config, setupTask = "node-" + platform, nodeVersion = grunt.config("node.version"), - npmVersion = grunt.config("npm.version"), txtName = "version-" + nodeVersion + ".txt", missingDest = false;