Skip to content

Commit

Permalink
Bug 1203520 - We need a DevTools ESLint plugin containing our ruleset…
Browse files Browse the repository at this point in the history
… r=gps

--HG--
extra : commitid : FrMOnVBUxmY
extra : rebase_source : c38511e94177f651a0decad41180991c54cb0f33
  • Loading branch information
Michael Ratcliffe committed Sep 30, 2015
1 parent 1f09adc commit 3efb3a9
Show file tree
Hide file tree
Showing 37 changed files with 1,042 additions and 52 deletions.
5 changes: 5 additions & 0 deletions .eslintrc
@@ -0,0 +1,5 @@
{
"plugins": [
"mozilla"
]
}
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -71,3 +71,6 @@ testing/web-platform/sync/

# Android Gradle artifacts.
mobile/android/gradle/.gradle

# Ignore node_modules from eslint-plugin-mozilla
testing/eslint-plugin-mozilla/node_modules/
3 changes: 3 additions & 0 deletions .hgignore
Expand Up @@ -93,3 +93,6 @@ GPATH
# Ignore mozharness execution files
^testing/mozharness/logs/
^testing/mozharness/build/

# Ignore node_modules from eslint-plugin-mozilla
^testing/eslint-plugin-mozilla/node_modules/
5 changes: 5 additions & 0 deletions devtools/.eslintrc
Expand Up @@ -25,6 +25,11 @@
// These are the rules that have been configured so far to match the
// devtools coding style.

// Rules from the mozilla plugin
"mozilla/components-imports": 1,
"mozilla/import-headjs-globals": 1,
"mozilla/mark-test-function-used": 1,

// Disallow using variables outside the blocks they are defined (especially
// since only let and const are used, see "no-var").
"block-scoped-var": 2,
Expand Down
17 changes: 5 additions & 12 deletions devtools/.eslintrc.mochitests
@@ -1,21 +1,15 @@
// Parent config file for all devtools browser mochitest files.
{
"rules": {
// Only disallow non-global unused vars, so that things like the test
// function do not produce errors.
"no-unused-vars": [2, {"vars": "local"}],
// Allow using undefined variables so that tests can refer to functions
// and variables defined in head.js files, without having to maintain a
// list of globals in each .eslintrc file.
// Note that bug 1168340 will eventually help auto-registering globals
// from head.js files.
"no-undef": 0,
"block-scoped-var": 0
// Only disallow non-global unused vars, so that head.js does not produce
// errors.
"no-unused-vars": [2, {"vars": "local"}]
},
// All globals made available in the test environment.
"globals": {
"add_task": true,
"Assert": true,
"BrowserTestUtils": true,
"content": true,
"document": true,
"EventUtils": true,
Expand All @@ -38,7 +32,6 @@
"setTimeout": true,
"SimpleTest": true,
"SpecialPowers": true,
"test": true,
"todo": true,
"todo_is": true,
"todo_isnot": true,
Expand All @@ -47,4 +40,4 @@
"waitForFocus": true,
"window": true,
}
}
}
3 changes: 1 addition & 2 deletions devtools/client/animationinspector/animation-controller.js
Expand Up @@ -3,8 +3,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals ViewHelpers, Task, AnimationsPanel, promise, EventEmitter,
AnimationsFront */
/* globals AnimationsPanel */

"use strict";

Expand Down
1 change: 0 additions & 1 deletion devtools/client/animationinspector/components.js
Expand Up @@ -3,7 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals ViewHelpers */

"use strict";

Expand Down
1 change: 0 additions & 1 deletion devtools/client/framework/toolbox-hosts.js
@@ -1,7 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals DOMHelpers, Services */

"use strict";

Expand Down
3 changes: 0 additions & 3 deletions devtools/client/framework/toolbox.js
@@ -1,9 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals gDevTools, DOMHelpers, toolboxStrings, InspectorFront, Selection,
CommandUtils, DevToolsUtils, Hosts, osString, showDoorhanger,
getHighlighterUtils, createPerformanceFront */

"use strict";

Expand Down
1 change: 0 additions & 1 deletion devtools/client/layoutview/view.js
Expand Up @@ -3,7 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals ViewHelpers, window, document */

"use strict";

Expand Down
2 changes: 1 addition & 1 deletion devtools/client/promisedebugger/promise-controller.js
Expand Up @@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* global promise, PromisesPanel, PromisesFront, DevToolsUtils */
/* global PromisesPanel */

"use strict";

Expand Down
2 changes: 0 additions & 2 deletions devtools/client/shared/inplace-editor.js
Expand Up @@ -4,8 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* globals focusManager, CSSPropertyList, domUtils */

/**
* Basic use:
* let spanToEdit = document.getElementById("somespan");
Expand Down
3 changes: 0 additions & 3 deletions devtools/client/shared/widgets/Tooltip.js
Expand Up @@ -4,9 +4,6 @@

"use strict";

/* globals beautify, setNamedTimeout, clearNamedTimeout, VariablesView,
VariablesViewController, Task */

const {Cu, Ci} = require("chrome");
const promise = require("promise");
const {Spectrum} = require("devtools/client/shared/widgets/Spectrum");
Expand Down
3 changes: 1 addition & 2 deletions devtools/client/styleinspector/computed-view.js
Expand Up @@ -4,8 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* globals overlays, StyleInspectorMenu, loader, clipboardHelper,
_Iterator, StopIteration */
/* globals _Iterator, StopIteration */

"use strict";

Expand Down
4 changes: 0 additions & 4 deletions devtools/client/styleinspector/rule-view.js
Expand Up @@ -4,10 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* globals overlays, Services, EventEmitter, StyleInspectorMenu,
clipboardHelper, _strings, domUtils, AutocompletePopup, loader,
osString */

"use strict";

const {Cc, Ci, Cu} = require("chrome");
Expand Down
2 changes: 0 additions & 2 deletions devtools/client/styleinspector/style-inspector-menu.js
Expand Up @@ -4,8 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* globals overlays, Services, clipboardHelper, _strings */

"use strict";

const {Cc, Ci, Cu} = require("chrome");
Expand Down
2 changes: 0 additions & 2 deletions devtools/client/styleinspector/style-inspector.js
Expand Up @@ -4,8 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* globals RuleView, ComputedView, gDevTools */

"use strict";

const {Cc, Cu, Ci} = require("chrome");
Expand Down
2 changes: 0 additions & 2 deletions devtools/client/styleinspector/utils.js
Expand Up @@ -4,8 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* global domUtils */

"use strict";

const {Cc, Ci, Cu} = require("chrome");
Expand Down
5 changes: 3 additions & 2 deletions devtools/server/actors/inspector.js
@@ -1,7 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals DevToolsUtils, DOMParser, eventListenerService, CssLogic */

"use strict";

Expand Down Expand Up @@ -999,7 +998,9 @@ var NodeFront = protocol.FrontClass(NodeActor, {
return this._form.props ? (name in this._form.props) : null;
},

get formProperties() this._form.props,
get formProperties() {
return this._form.props
},

/**
* Return a new AttributeModificationList for this node.
Expand Down
2 changes: 0 additions & 2 deletions devtools/server/actors/promises.js
Expand Up @@ -12,8 +12,6 @@ const { ObjectActor,
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
loader.lazyRequireGetter(this, "events", "sdk/event/core");

/* global events */

// Teach protocol.js how to deal with legacy actor types
types.addType("ObjectActor", {
write: actor => actor.grip(),
Expand Down
2 changes: 1 addition & 1 deletion devtools/server/actors/styles.js
@@ -1,7 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals CssLogic, DOMUtils, CSS */
/* globals CSS */

"use strict";

Expand Down
1 change: 0 additions & 1 deletion devtools/shared/gcli/commands/highlight.js
@@ -1,7 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals nodesSelected, PluralForm */

"use strict";

Expand Down
2 changes: 0 additions & 2 deletions devtools/shared/output-parser.js
Expand Up @@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* globals DOMUtils */

"use strict";

const {Cc, Ci, Cu} = require("chrome");
Expand Down
2 changes: 0 additions & 2 deletions devtools/shared/webconsole/network-monitor.js
@@ -1,8 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/* globals NetworkHelper, Services, DevToolsUtils, NetUtil,
gActivityDistributor */

"use strict";

Expand Down

0 comments on commit 3efb3a9

Please sign in to comment.