forked from mirrors/gecko-dev
Bug 1451659 - Enable ESLint for devtools/client/{canvasdebugger,framework,scratchpad,shadereditor}/. r=jdescottes
Disable rules with many failures for now, in a way that mentored bugs can easily pick them up. Fix other minor issues raised by various rules. MozReview-Commit-ID: 71OQI7jLihe --HG-- extra : rebase_source : 7eac06299e6bbc6ae84e21b263c105555a06e757
This commit is contained in:
parent
72de2a4acf
commit
3e2d95e5c0
22 changed files with 177 additions and 74 deletions
|
|
@ -101,23 +101,11 @@ browser/extensions/mortar/**
|
|||
browser/extensions/formautofill/phonenumberutils/PhoneNumberMetaData.jsm
|
||||
|
||||
# devtools/ exclusions
|
||||
devtools/client/canvasdebugger/**
|
||||
devtools/client/commandline/**
|
||||
devtools/client/debugger/**
|
||||
devtools/client/framework/**
|
||||
!devtools/client/framework/devtools.js
|
||||
!devtools/client/framework/devtools-browser.js
|
||||
!devtools/client/framework/selection.js
|
||||
!devtools/client/framework/target*
|
||||
!devtools/client/framework/toolbox*
|
||||
devtools/client/inspector/markup/test/doc_markup_events_*.html
|
||||
devtools/client/inspector/rules/test/doc_media_queries.html
|
||||
devtools/client/memory/test/chrome/*.html
|
||||
devtools/client/performance/components/test/test_jit_optimizations_01.html
|
||||
devtools/client/projecteditor/**
|
||||
devtools/client/responsive.html/test/browser/touch.html
|
||||
devtools/client/scratchpad/**
|
||||
devtools/client/shadereditor/**
|
||||
devtools/client/shared/*.jsm
|
||||
devtools/client/shared/components/reps/reps.js
|
||||
devtools/client/shared/components/reps/test/mochitest/*.html
|
||||
|
|
@ -154,6 +142,15 @@ devtools/shared/qrcode/tests/mochitest/test_decode.html
|
|||
devtools/shared/tests/mochitest/*.html
|
||||
devtools/shared/webconsole/test/test_*.html
|
||||
|
||||
# Soon to be removed
|
||||
devtools/client/commandline/**
|
||||
# Soon to be removed, the new/ directory is explicitly excluded below due to
|
||||
# also being an imported repository.
|
||||
devtools/client/debugger/**
|
||||
|
||||
# Ignore devtools imported repositories
|
||||
devtools/client/debugger/new/**
|
||||
|
||||
# Ignore devtools preferences files
|
||||
devtools/client/preferences/**
|
||||
devtools/startup/devtools-startup-prefs.js
|
||||
|
|
@ -168,6 +165,8 @@ devtools/shared/sourcemap/*
|
|||
devtools/shared/sprintfjs/*
|
||||
devtools/shared/qrcode/decoder/*
|
||||
devtools/shared/qrcode/encoder/*
|
||||
devtools/client/inspector/markup/test/lib_*
|
||||
devtools/client/jsonview/lib/require.js
|
||||
devtools/client/shared/demangle.js
|
||||
devtools/client/shared/source-map/*
|
||||
devtools/client/shared/vendor/*
|
||||
|
|
@ -176,18 +175,11 @@ devtools/client/sourceeditor/codemirror/**/*.js
|
|||
devtools/client/sourceeditor/tern/*
|
||||
devtools/client/sourceeditor/test/cm_mode_ruby.js
|
||||
devtools/client/sourceeditor/test/codemirror/*
|
||||
devtools/client/inspector/markup/test/lib_*
|
||||
devtools/client/jsonview/lib/require.js
|
||||
devtools/server/actors/utils/automation-timeline.js
|
||||
|
||||
# Ignore devtools files testing sourcemaps / code style
|
||||
devtools/client/debugger/test/mochitest/code_binary_search.js
|
||||
devtools/client/debugger/test/mochitest/code_binary_search_absolute.js
|
||||
devtools/client/debugger/test/mochitest/code_math.min.js
|
||||
devtools/client/debugger/test/mochitest/code_math_bogus_map.js
|
||||
devtools/client/debugger/test/mochitest/code_ugly*
|
||||
devtools/client/debugger/test/mochitest/code_worker-source-map.js
|
||||
devtools/client/framework/test/code_ugly*
|
||||
devtools/client/debugger/test/mochitest/code_*.js
|
||||
devtools/client/framework/test/code_*
|
||||
devtools/client/inspector/markup/test/events_bundle.js
|
||||
devtools/client/netmonitor/test/xhr_bundle.js
|
||||
devtools/client/webconsole/new-console-output/test/mochitest/code_bundle_nosource.js
|
||||
|
|
|
|||
|
|
@ -16,12 +16,122 @@ module.exports = {
|
|||
// XXX Bug 1230193. We're still working on enabling no-undef for these test
|
||||
// directories.
|
||||
"files": [
|
||||
"client/framework/test/**",
|
||||
"client/scratchpad/**",
|
||||
"server/tests/mochitest/**",
|
||||
"shared/tests/unit/**",
|
||||
],
|
||||
"rules": {
|
||||
"no-undef": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"client/framework/**",
|
||||
],
|
||||
"rules": {
|
||||
"no-return-assign": "off",
|
||||
"no-unused-vars": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"client/scratchpad/scratchpad-manager.jsm",
|
||||
"client/scratchpad/scratchpad.js",
|
||||
],
|
||||
"rules": {
|
||||
"camelcase": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"client/framework/**",
|
||||
"client/scratchpad/**",
|
||||
],
|
||||
"rules": {
|
||||
"consistent-return": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"client/framework/**",
|
||||
"client/scratchpad/**",
|
||||
],
|
||||
"rules": {
|
||||
"max-nested-callbacks": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"client/framework/**",
|
||||
"client/scratchpad/**",
|
||||
],
|
||||
"rules": {
|
||||
"max-len": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"client/scratchpad/test/browser_scratchpad_inspect.js",
|
||||
"client/scratchpad/test/browser_scratchpad_inspect_primitives.js",
|
||||
],
|
||||
"rules": {
|
||||
"no-labels": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"client/framework/**",
|
||||
"client/scratchpad/**",
|
||||
],
|
||||
"rules": {
|
||||
"mozilla/no-aArgs": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"client/framework/test/**",
|
||||
"client/scratchpad/**",
|
||||
],
|
||||
"rules": {
|
||||
"mozilla/var-only-at-top-level": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"client/framework/**",
|
||||
"client/scratchpad/**",
|
||||
],
|
||||
"rules": {
|
||||
"no-shadow": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"client/framework/**",
|
||||
"client/scratchpad/**",
|
||||
],
|
||||
"rules": {
|
||||
"strict": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
// Note: Bug 1403938 may be removing canvasdebugger, check before
|
||||
// doing more work on enabling these rules.
|
||||
"client/canvasdebugger/**",
|
||||
// Note: Bug 1342237 may be removing shadereditor, check before
|
||||
// doing more work on enabling these rules.
|
||||
"client/shadereditor/**",
|
||||
],
|
||||
"rules": {
|
||||
"consistent-return": "off",
|
||||
"max-len": "off",
|
||||
"mozilla/no-aArgs": "off",
|
||||
"mozilla/var-only-at-top-level": "off",
|
||||
"no-return-assign": "off",
|
||||
"no-shadow": "off",
|
||||
"no-undef": "off",
|
||||
"no-unused-vars": "off",
|
||||
"strict": "off",
|
||||
}
|
||||
}, {
|
||||
// For all head*.js files, turn off no-unused-vars at a global level
|
||||
"files": [
|
||||
"**/head*.js",
|
||||
],
|
||||
"rules": {
|
||||
"no-unused-vars": ["error", {"args": "none", "vars": "local"}],
|
||||
}
|
||||
}],
|
||||
"rules": {
|
||||
// These are the rules that have been configured so far to match the
|
||||
|
|
|
|||
|
|
@ -367,9 +367,8 @@ var CallsListView = extend(WidgetMethods, {
|
|||
let functionCall = callItem.attachment.actor;
|
||||
if (functionCall.isLoadedFromDisk) {
|
||||
display(functionCall.stack);
|
||||
}
|
||||
// ..otherwise we need to request the function call stack from the backend.
|
||||
else {
|
||||
} else {
|
||||
// ..otherwise we need to request the function call stack from the backend.
|
||||
callItem.attachment.actor.getDetails().then(fn => display(fn.stack));
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -306,12 +306,11 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
|
||||
if (actorCanStop) {
|
||||
await gFront.stopRecordingAnimationFrame();
|
||||
}
|
||||
// If actor does not have the method to stop recording (Fx39+),
|
||||
// manually call the record failure method. This will call a connection failure
|
||||
// on disconnect as a result of `gFront.recordAnimationFrame()` never resolving,
|
||||
// but this is better than it hanging when there is no requestAnimationFrame anyway.
|
||||
else {
|
||||
} else {
|
||||
// If actor does not have the method to stop recording (Fx39+),
|
||||
// manually call the record failure method. This will call a connection failure
|
||||
// on disconnect as a result of `gFront.recordAnimationFrame()` never resolving,
|
||||
// but this is better than it hanging when there is no requestAnimationFrame anyway.
|
||||
this._onRecordFailure();
|
||||
}
|
||||
|
||||
|
|
@ -371,9 +370,10 @@ var SnapshotsListView = extend(WidgetMethods, {
|
|||
console.error("Could not import recorded animation frame snapshot file.");
|
||||
return;
|
||||
}
|
||||
var data;
|
||||
try {
|
||||
let string = NetUtil.readInputStreamToString(inputStream, inputStream.available());
|
||||
var data = JSON.parse(string);
|
||||
data = JSON.parse(string);
|
||||
} catch (e) {
|
||||
console.error("Could not read animation frame snapshot file.");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ async function ifTestingSupported() {
|
|||
await removeTab(target.tab);
|
||||
|
||||
info("Start to estimate WebGL drawElements function.");
|
||||
var { target, front } = await initCanvasDebuggerBackend(WEBGL_DRAW_ELEMENTS);
|
||||
let result = await initCanvasDebuggerBackend(WEBGL_DRAW_ELEMENTS);
|
||||
target = result.target;
|
||||
front = result.front;
|
||||
|
||||
navigated = once(target, "navigate");
|
||||
|
||||
|
|
|
|||
|
|
@ -68,9 +68,10 @@ function ToolSidebar(tabbox, panel, uid, options = {}) {
|
|||
this._onTabBoxOverflow = this._onTabBoxOverflow.bind(this);
|
||||
this._onTabBoxUnderflow = this._onTabBoxUnderflow.bind(this);
|
||||
|
||||
try {
|
||||
this._width = Services.prefs.getIntPref("devtools.toolsidebar-width." + this._uid);
|
||||
} catch (e) {}
|
||||
let width = Services.prefs.getIntPref("devtools.toolsidebar-width." + this._uid, undefined);
|
||||
if (width) {
|
||||
this._width = width;
|
||||
}
|
||||
|
||||
if (!options.disableTelemetry) {
|
||||
this._telemetry = new Telemetry();
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ add_task(async function runTest() {
|
|||
return Promise.resolve(true);
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
// TODO: fixme.
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(function() {
|
||||
waitUntil(predicate, interval).then(() => resolve(true));
|
||||
}, interval);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
function log(msg) {
|
||||
let output = document.getElementById("output");
|
||||
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
output.innerHTML = msg;
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
function log(msg) {
|
||||
let output = document.getElementById("output");
|
||||
|
||||
// eslint-disable-next-line no-unsanitized/property
|
||||
output.innerHTML = msg;
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ function cleanUp(toolbox) {
|
|||
off(DebuggerClient, "connect", onDebuggerClientConnect);
|
||||
|
||||
toolbox.destroy().then(function() {
|
||||
// TODO: fixme.
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(() => {
|
||||
gBrowser.removeCurrentTab();
|
||||
executeSoon(function() {
|
||||
|
|
|
|||
|
|
@ -23,12 +23,8 @@ function test() {
|
|||
toolShortcuts.push(shortcut);
|
||||
|
||||
// Enable disabled tools
|
||||
let pref = definition.visibilityswitch, prefValue;
|
||||
try {
|
||||
prefValue = Services.prefs.getBoolPref(pref);
|
||||
} catch (e) {
|
||||
continue;
|
||||
}
|
||||
let pref = definition.visibilityswitch;
|
||||
let prefValue = Services.prefs.getBoolPref(pref, false);
|
||||
if (!prefValue) {
|
||||
modifiedPrefs.push(pref);
|
||||
Services.prefs.setBoolPref(pref, true);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
"use strict";
|
||||
|
||||
const l10n = require("gcli/l10n");
|
||||
const {Cu} = require("chrome");
|
||||
|
||||
exports.items = [{
|
||||
item: "command",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const {Cu} = require("chrome");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const promise = require("promise");
|
||||
const defer = require("devtools/shared/defer");
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@ const { extend } = require("devtools/shared/extend");
|
|||
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
|
||||
const {NetUtil} = require("resource://gre/modules/NetUtil.jsm");
|
||||
const {ScratchpadManager} = require("resource://devtools/client/scratchpad/scratchpad-manager.jsm");
|
||||
const {addDebuggerToGlobal} = require("resource://gre/modules/jsdebugger.jsm");
|
||||
const {OS} = require("resource://gre/modules/osfile.jsm");
|
||||
const {Reflect} = require("resource://gre/modules/reflect.jsm");
|
||||
|
||||
// Use privileged promise in panel documents to prevent having them to freeze
|
||||
// during toolbox destruction. See bug 1402779.
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const Promise = require("Promise");
|
||||
|
||||
XPCOMUtils.defineConstant(this, "SCRATCHPAD_CONTEXT_CONTENT", SCRATCHPAD_CONTEXT_CONTENT);
|
||||
|
|
@ -1079,22 +1079,22 @@ var Scratchpad = {
|
|||
*/
|
||||
_getUnicodeContent: function SP__getUnicodeContent(aContent, aCharsetArray) {
|
||||
let content = null,
|
||||
converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter),
|
||||
success = aCharsetArray.some(charset => {
|
||||
try {
|
||||
converter.charset = charset;
|
||||
content = converter.ConvertToUnicode(aContent);
|
||||
return true;
|
||||
} catch (e) {
|
||||
this.notificationBox.appendNotification(
|
||||
this.strings.formatStringFromName("importFromFile.convert.failed",
|
||||
[ charset ], 1),
|
||||
"file-import-convert-failed",
|
||||
null,
|
||||
this.notificationBox.PRIORITY_WARNING_HIGH,
|
||||
null);
|
||||
}
|
||||
});
|
||||
converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
aCharsetArray.some(charset => {
|
||||
try {
|
||||
converter.charset = charset;
|
||||
content = converter.ConvertToUnicode(aContent);
|
||||
return true;
|
||||
} catch (e) {
|
||||
this.notificationBox.appendNotification(
|
||||
this.strings.formatStringFromName("importFromFile.convert.failed",
|
||||
[ charset ], 1),
|
||||
"file-import-convert-failed",
|
||||
null,
|
||||
this.notificationBox.PRIORITY_WARNING_HIGH,
|
||||
null);
|
||||
}
|
||||
});
|
||||
return content;
|
||||
},
|
||||
|
||||
|
|
@ -1281,10 +1281,9 @@ var Scratchpad = {
|
|||
// It is not the most recent file. Remove it from the list, we add it as
|
||||
// the most recent farther down.
|
||||
filePaths.splice(pathIndex, 1);
|
||||
}
|
||||
// If we are not storing the file and the 'recent files'-list is full,
|
||||
// remove the oldest file from the list.
|
||||
else if (filesCount === maxRecent) {
|
||||
} else if (filesCount === maxRecent) {
|
||||
// If we are not storing the file and the 'recent files'-list is full,
|
||||
// remove the oldest file from the list.
|
||||
filePaths.shift();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ function testOpenInvalidState() {
|
|||
}
|
||||
|
||||
function testOpenTestFile() {
|
||||
let win = openScratchpad(function(win) {
|
||||
openScratchpad(function(win) {
|
||||
ok(win, "scratchpad opened for file open");
|
||||
try {
|
||||
win.Scratchpad.importFromFile(
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ var gFileName03 = "file03_ForBug651942.tmp";
|
|||
var gFileName04 = "file04_ForBug651942.tmp";
|
||||
|
||||
// Content for the temporary files.
|
||||
var gFileContent;
|
||||
var gFileContent01 = "hello.world.01('bug651942');";
|
||||
var gFileContent02 = "hello.world.02('bug651942');";
|
||||
var gFileContent03 = "hello.world.03('bug651942');";
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ function test() {
|
|||
}
|
||||
|
||||
function runTests() {
|
||||
let sp = gScratchpadWindow.Scratchpad;
|
||||
let doc = gScratchpadWindow.document;
|
||||
|
||||
let testData = [
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ var gFileName = "testFileForBug751744.tmp";
|
|||
// Content for the temporary file.
|
||||
var gFileContent = "/* this file is already saved */\n" +
|
||||
"function foo() { alert('bar') }";
|
||||
var gLength = gFileContent.length;
|
||||
|
||||
// Reference to the menu entry.
|
||||
var menu;
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ function openScratchpad(aReadyCallback, aOptions = {}) {
|
|||
*/
|
||||
function openTabAndScratchpad(aOptions = {}) {
|
||||
waitForExplicitFinish();
|
||||
// eslint-disable-next-line new-cap
|
||||
return new promise(resolve => {
|
||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
|
||||
let {selectedBrowser} = gBrowser;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const { Cc, Ci, Cu, Cr } = require("chrome");
|
||||
const promise = require("promise");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const { WebGLFront } = require("devtools/shared/fronts/webgl");
|
||||
|
|
@ -67,10 +66,10 @@ ShaderEditorPanel.prototype = {
|
|||
return this._destroyer;
|
||||
}
|
||||
|
||||
return this._destroyer = this.panelWin.shutdownShaderEditor().then(() => {
|
||||
return (this._destroyer = this.panelWin.shutdownShaderEditor().then(() => {
|
||||
// Destroy front to ensure packet handler is removed from client
|
||||
this.panelWin.gFront.destroy();
|
||||
this.emit("destroyed");
|
||||
});
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,13 +3,14 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
/* exported startupShaderEditor, shutdownShaderEditor */
|
||||
|
||||
const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
||||
const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
|
||||
const {SideMenuWidget} = require("resource://devtools/client/shared/widgets/SideMenuWidget.jsm");
|
||||
const promise = require("promise");
|
||||
const defer = require("devtools/shared/defer");
|
||||
const {Task} = require("devtools/shared/task");
|
||||
const Services = require("Services");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const Tooltip = require("devtools/client/shared/widgets/tooltip/Tooltip");
|
||||
const Editor = require("devtools/client/sourceeditor/editor");
|
||||
|
|
@ -20,6 +21,7 @@ const {WidgetMethods, setNamedTimeout} =
|
|||
|
||||
// Use privileged promise in panel documents to prevent having them to freeze
|
||||
// during toolbox destruction. See bug 1402779.
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const Promise = require("Promise");
|
||||
|
||||
// The panel's window global is an EventEmitter firing the following events:
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ async function test() {
|
|||
try {
|
||||
await generator();
|
||||
} catch (e) {
|
||||
handlError(e);
|
||||
handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -115,7 +115,8 @@ function ensurePixelIs(aFront, aPosition, aColor, aWaitFlag = false, aSelector =
|
|||
|
||||
if (aWaitFlag) {
|
||||
await aFront.waitForFrame();
|
||||
return ensurePixelIs(aFront, aPosition, aColor, aWaitFlag, aSelector);
|
||||
await ensurePixelIs(aFront, aPosition, aColor, aWaitFlag, aSelector);
|
||||
return;
|
||||
}
|
||||
|
||||
ok(false, "Expected pixel was not already shown at: " + aPosition.toSource());
|
||||
|
|
|
|||
Loading…
Reference in a new issue