Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 1cc6091

Browse files
committed
ESLint: specify node env only for node scripts, enabled some rules
Rules enabled: - no-bitwise - new-cap - no-empty - strict
1 parent c23147e commit 1cc6091

File tree

22 files changed

+1308
-1310
lines changed

22 files changed

+1308
-1310
lines changed

.eslintrc.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
{
2-
"env": {
3-
"node": true
4-
},
52
"rules": {
6-
"no-bitwise": 0,
3+
"no-bitwise": 2,
74
"curly": 2,
85
"eqeqeq": 2,
96
"guard-for-in": 0,
107
"wrap-iife": [2, "outside"],
118
"no-use-before-define": 0,
12-
"new-cap": [0, {
9+
"new-cap": [2, {
1310
"capIsNewExceptions": [
1411
"$.Deferred",
1512
"$.Event",
@@ -19,13 +16,13 @@
1916
"JSLINT"
2017
]}],
2118
"no-caller": 2,
22-
"no-empty": 0,
19+
"no-empty": 2,
2320
"no-new": 2,
2421
"no-invalid-regexp": 2,
2522
"no-control-regex": 2,
2623
"no-regex-spaces": 2,
2724
"no-undef": 2,
28-
"strict": 0,
25+
"strict": 2,
2926
"no-unused-vars": [0, {"vars": "all", "args": "none"}],
3027
"semi": 2,
3128

@@ -54,12 +51,15 @@
5451
"globals": {
5552
"brackets": false,
5653

54+
"console": false,
55+
5756
"window": false,
5857
"alert": false,
5958
"document": false,
6059
"localStorage": false,
6160
"navigator": false,
6261
"setTimeout": false,
62+
"clearTimeout": false,
6363

6464
"require": false,
6565
"define": false,

Gruntfile.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
* DEALINGS IN THE SOFTWARE.
2121
*
2222
*/
23+
/*eslint-env node*/
2324
/*global module, require*/
24-
module.exports = function (grunt) {
25-
'use strict';
2625

26+
'use strict';
27+
28+
module.exports = function (grunt) {
2729
// load dependencies
2830
require('load-grunt-tasks')(grunt, {
2931
pattern: [

src/LiveDevelopment/MultiBrowserImpl/launchers/node/LauncherDomain.js

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,54 +20,51 @@
2020
* DEALINGS IN THE SOFTWARE.
2121
*
2222
*/
23-
23+
/*eslint-env node*/
2424
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, node: true */
2525

26-
(function () {
27-
"use strict";
26+
"use strict";
2827

29-
var open = require("open");
28+
var open = require("open");
3029

31-
/**
32-
* @private
33-
* The Brackets domain manager for registering node extensions.
34-
* @type {?DomainManager}
35-
*/
36-
var _domainManager;
30+
/**
31+
* @private
32+
* The Brackets domain manager for registering node extensions.
33+
* @type {?DomainManager}
34+
*/
35+
var _domainManager;
3736

38-
/**
39-
* Launch the given URL in the system default browser.
40-
* TODO: it now launching just on default browser, add launchers for specific browsers.
41-
* @param {string} url
42-
*/
43-
function _cmdLaunch(url) {
44-
open(url);
45-
}
37+
/**
38+
* Launch the given URL in the system default browser.
39+
* TODO: it now launching just on default browser, add launchers for specific browsers.
40+
* @param {string} url
41+
*/
42+
function _cmdLaunch(url) {
43+
open(url);
44+
}
4645

4746

48-
/**
49-
* Initializes the domain and registers commands.
50-
* @param {DomainManager} domainManager The DomainManager for the server
51-
*/
52-
function init(domainManager) {
53-
_domainManager = domainManager;
54-
if (!domainManager.hasDomain("launcher")) {
55-
domainManager.registerDomain("launcher", {major: 0, minor: 1});
56-
}
57-
domainManager.registerCommand(
58-
"launcher", // domain name
59-
"launch", // command name
60-
_cmdLaunch, // command handler function
61-
false, // this command is synchronous in Node
62-
"Launches a given HTML file in the browser for live development",
63-
[
64-
{ name: "url", type: "string", description: "file:// url to the HTML file" },
65-
{ name: "browser", type: "string", description: "browser name"}
66-
],
67-
[]
68-
);
47+
/**
48+
* Initializes the domain and registers commands.
49+
* @param {DomainManager} domainManager The DomainManager for the server
50+
*/
51+
function init(domainManager) {
52+
_domainManager = domainManager;
53+
if (!domainManager.hasDomain("launcher")) {
54+
domainManager.registerDomain("launcher", {major: 0, minor: 1});
6955
}
56+
domainManager.registerCommand(
57+
"launcher", // domain name
58+
"launch", // command name
59+
_cmdLaunch, // command handler function
60+
false, // this command is synchronous in Node
61+
"Launches a given HTML file in the browser for live development",
62+
[
63+
{ name: "url", type: "string", description: "file:// url to the HTML file" },
64+
{ name: "browser", type: "string", description: "browser name"}
65+
],
66+
[]
67+
);
68+
}
7069

71-
exports.init = init;
72-
73-
}());
70+
exports.init = init;

0 commit comments

Comments
 (0)