Bug 1436303 - Enable mozilla/no-define-cc-etc for some DevTools files;r=ochameau,standard8

MozReview-Commit-ID: IbSt6lAhOYt

--HG--
extra : rebase_source : 61b562240f83da0ec15e584cd0e965466b6be4b1
This commit is contained in:
Julian Descottes 2018-06-08 16:46:59 +02:00
parent e0c4b56af2
commit 9f859ee6b8
5 changed files with 37 additions and 20 deletions

View File

@ -39,15 +39,6 @@ module.exports = {
"env": {
"mozilla/browser-window": true
}
}, {
// XXX Bug 1436303. These directories are still being fixed, so turn off
// mozilla/no-cc-etc for now.
"files": [
"devtools/**"
],
"rules": {
"mozilla/no-define-cc-etc": "off",
}
}, {
// XXX Bug 1452706. These directories are still being fixed, so turn off
// mozilla/require-expected-throws-or-rejects for now.

View File

@ -149,7 +149,40 @@ module.exports = {
"rules": {
"no-unused-vars": ["error", {"args": "none", "vars": "local"}],
}
}],
}, {
// Cu, Cc etc... are not available in most devtools modules loaded by require.
"files": [
"**"
],
"excludedFiles": [
// Enable the rule on JSM, test head files and some specific files.
"**/*.jsm",
"**/test/**/head.js",
"**/test/**/shared-head.js",
"client/debugger/test/mochitest/code_frame-script.js",
"client/inspector/animation-old/test/doc_frame_script.js",
"client/inspector/animation/test/doc_frame_script.js",
"client/inspector/rules/test/doc_frame_script.js",
"client/inspector/shared/test/doc_frame_script.js",
"client/jsonview/converter-observer.js",
"client/jsonview/test/doc_frame_script.js",
"client/responsive.html/browser/content.js",
"client/shared/browser-loader.js",
"server/actors/webconsole/content-process-forward.js",
"server/actors/worker/service-worker-process.js",
"server/startup/content-process.js",
"server/startup/frame.js",
"shared/base-loader.js",
"shared/worker/loader.js",
"startup/aboutdebugging-registration.js",
"startup/aboutdevtools/aboutdevtools-registration.js",
"startup/aboutdevtoolstoolbox-registration.js",
"startup/devtools-startup.js",
],
"rules": {
"mozilla/no-define-cc-etc": "off",
}
}, ],
"rules": {
// These are the rules that have been configured so far to match the
// devtools coding style.

View File

@ -10,8 +10,7 @@
// devtools.
// It contains various common helper functions.
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr, Constructor: CC}
= Components;
const { Constructor: CC } = Components;
function scopedCuImport(path) {
const scope = {};

View File

@ -9,8 +9,7 @@
this.EXPORTED_SYMBOLS = ["Loader", "resolveURI", "Module", "Require", "unload"];
const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu,
results: Cr, manager: Cm } = Components;
const { Constructor: CC, manager: Cm } = Components;
const systemPrincipal = CC("@mozilla.org/systemprincipal;1", "nsIPrincipal")();
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm", {});

View File

@ -449,12 +449,7 @@ var {
} = (function() {
// Main thread
if (typeof Components === "object") {
const {
Constructor: CC,
classes: Cc,
interfaces: Ci,
utils: Cu
} = Components;
const { Constructor: CC } = Components;
const principal = CC("@mozilla.org/systemprincipal;1", "nsIPrincipal")();