Bug 1456755 - Enable ESLint rule no-undef for devtools/{client/scratchpad/,shared/tests/unit}. r?jdescottes
MozReview-Commit-ID: 1GdQdf1y0gc
--- a/devtools/.eslintrc.js
+++ b/devtools/.eslintrc.js
@@ -11,19 +11,17 @@ module.exports = {
"module": true,
"reportError": true,
"require": true,
},
"overrides": [{
// XXX Bug 1230193. We're still working on enabling no-undef for these test
// directories.
"files": [
- "client/scratchpad/**",
"server/tests/mochitest/**",
- "shared/tests/unit/**",
],
"rules": {
"no-undef": "off",
}
}, {
"files": [
"client/framework/**",
],
--- a/devtools/client/scratchpad/scratchpad.js
+++ b/devtools/client/scratchpad/scratchpad.js
@@ -7,16 +7,21 @@
* Original version history can be found here:
* https://github.com/mozilla/workspace
*
* Copied and relicensed from the Public Domain.
* See bug 653934 for details.
* https://bugzilla.mozilla.org/show_bug.cgi?id=653934
*/
+// Via scratchpad.xul
+/* import-globals-from ../../../toolkit/content/globalOverlay.js */
+// Via editMenuCommands.inc.xul
+/* import-globals-from ../../../toolkit/content/editMenuOverlay.js */
+
"use strict";
const SCRATCHPAD_CONTEXT_CONTENT = 1;
const SCRATCHPAD_CONTEXT_BROWSER = 2;
const BUTTON_POSITION_SAVE = 0;
const BUTTON_POSITION_CANCEL = 1;
const BUTTON_POSITION_DONT_SAVE = 2;
const BUTTON_POSITION_REVERT = 0;
--- a/devtools/shared/tests/unit/head_devtools.js
+++ b/devtools/shared/tests/unit/head_devtools.js
@@ -16,16 +16,19 @@ registerCleanupFunction(() => {
// Register a console listener, so console messages don't just disappear
// into the ether.
// If for whatever reason the test needs to post console errors that aren't
// failures, set this to true.
var ALLOW_CONSOLE_ERRORS = false;
+// XXX This listener is broken, see bug 1456634, for now turn off no-undef here,
+// this needs turning back on!
+/* eslint-disable no-undef */
var listener = {
observe: function(message) {
let string;
try {
message.QueryInterface(Ci.nsIScriptError);
dump(message.sourceName + ":" + message.lineNumber + ": " +
scriptErrorFlagsToKind(message.flags) + ": " +
message.errorMessage + "\n");
@@ -45,10 +48,11 @@ var listener = {
DebuggerServer.xpcInspector.exitNestedEventLoop();
}
if (!ALLOW_CONSOLE_ERRORS) {
do_throw("head_devtools.js got console message: " + string + "\n");
}
}
};
+/* eslint-enable no-undef */
Services.console.registerListener(listener);