Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1443661 - Enable ESLint rule no-undef for test files in devtools/…
Browse files Browse the repository at this point in the history
…client/webconsole/new-console-output/. r=nchevobbe

MozReview-Commit-ID: 39cCKczUMQI
  • Loading branch information
Standard8 committed Mar 6, 2018
1 parent 77a78bb commit a1386c4
Show file tree
Hide file tree
Showing 20 changed files with 88 additions and 12 deletions.
16 changes: 16 additions & 0 deletions devtools/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ module.exports = {
"reportError": true,
"require": true,
},
"overrides": [{
// XXX Bug 1230193. We're still working on enabling no-undef for these test
// directories.
"files": [
"client/memory/test/**",
"server/tests/browser/**",
"server/tests/mochitest/**",
"server/tests/unit/**",
"shared/heapsnapshot/tests/unit/**",
"shared/tests/unit/**",
"shared/webconsole/test/**",
],
"rules": {
"no-undef": "off",
}
}],
"rules": {
// These are the rules that have been configured so far to match the
// devtools coding style.
Expand Down
2 changes: 2 additions & 0 deletions devtools/.eslintrc.mochitests.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ module.exports = {
},

"rules": {
// Allow non-camelcase so that run_test doesn't produce a warning.
"camelcase": "off",
// Tests can always import anything.
"mozilla/reject-some-requires": 0,
},
Expand Down
6 changes: 0 additions & 6 deletions devtools/.eslintrc.xpcshell.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ module.exports = {
"rules": {
// Allow non-camelcase so that run_test doesn't produce a warning.
"camelcase": "off",
// 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": "off",
"block-scoped-var": "off",
// Tests can always import anything.
"mozilla/reject-some-requires": "off",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"use strict";

module.exports = {
"env": {
"browser": false,
"mocha": true,
},

"globals": {
// document and window are injected via jsdom-global.
"document": false,
"window": false,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use strict";

module.exports = {
// Extend from the shared list of defined globals for mochitests.
"extends": "../../../../../.eslintrc.mochitests.js"
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

module.exports = {
"extends": "../.eslintrc.mocha.js"
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"use strict";

module.exports = {
// Extend from the shared list of defined globals for mochitests.
"extends": "../../../../../.eslintrc.mochitests.js"
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

module.exports = {
"extends": "../.eslintrc.mocha.js"
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */

/* eslint-env node */

"use strict";

const mcRoot = `${__dirname}/../../../../../`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async function testMessages(hud) {
expectUncaughtException();

executeSoon(() => {
// eslint-disable-next-line no-undef
foobarException();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

/* import-globals-from head.js */

// XXX Remove this when the file is migrated to the new frontend.
/* eslint-disable no-undef */

// Check that console.clear() does not clear the output of the browser console.

"use strict";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

/* import-globals-from head.js */

// XXX Remove this when the file is migrated to the new frontend.
/* eslint-disable no-undef */

// Check that inspecting a closure in the variables view sidebar works when
// execution is paused.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

"use strict";

// XXX Remove this when the file is migrated to the new frontend.
/* eslint-disable no-undef */

// See Bug 595223.

const PREF = "devtools.webconsole.persistlog";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

/* import-globals-from head.js */

// XXX Remove this when the file is migrated to the new frontend.
/* eslint-disable no-undef */

// Test that the JS input field is focused when the user switches back to the
// web console from other tools, see bug 891581.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

/* import-globals-from head.js */

// XXX Remove this when the file is migrated to the new frontend.
/* eslint-disable no-undef */

// Test that long strings can be expanded in the console output.

"use strict";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

/* import-globals-from head.js */

// XXX Remove this when the file is migrated to the new frontend.
/* eslint-disable no-undef */

// Test that very long strings do not hang the browser.

"use strict";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* import-globals-from ../../../../shared/test/shared-head.js */
/* eslint no-unused-vars: [2, {"vars": "local"}] */

"use strict";

// Import helpers registering the test-actor in remote targets
/* globals registerTestActor, getTestActor, Task, openToolboxForTab, gBrowser */
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/shared/test/test-actor-registry.js",
this);

// shared-head.js handles imports, constants, and utility functions
// Load the shared-head file first.
/* import-globals-from ../../../../shared/test/shared-head.js */
Services.scriptloader.loadSubScript(
"chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js",
this);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

module.exports = {
"extends": "../.eslintrc.mocha.js"
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

module.exports = {
"extends": "../.eslintrc.mocha.js"
};

0 comments on commit a1386c4

Please sign in to comment.