Bug 1589333 - Enable ESLint for all of devtools/client/shared/ (manual changes). r=Standard8,jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D50637

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Richard O. Gregory 2019-11-04 18:05:14 +00:00
parent e6f8e04a02
commit 8640fa2942
32 changed files with 91 additions and 28 deletions

View file

@ -56,9 +56,6 @@ browser/extensions/formautofill/phonenumberutils/PhoneNumberMetaData.jsm
# devtools/ exclusions
devtools/client/inspector/markup/test/doc_markup_events_*.html
devtools/client/performance/components/test/test_jit_optimizations_01.html
devtools/client/shared/test/*.html
devtools/client/shared/components/test/mochitest/*.html
!devtools/client/shared/components/test/mochitest/test_stack-trace.html
devtools/server/tests/browser/storage-*.html
!devtools/server/tests/browser/storage-unsecured-iframe.html
devtools/server/tests/browser/stylesheets-nested-iframes.html

View file

@ -75,6 +75,9 @@
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
const FUDGE_FACTOR = .5;
function aboutEq(a, b) {
dumpn(`Checking ${a} ~= ${b}`);
@ -93,7 +96,7 @@ window.onload = async function () {
const resizedA = [];
const resizedD = [];
const scene = ReactDOM.render([
ReactDOM.render([
dom.header({}, "header"),
dom.aside({className: "a"}, "A"),
GridElementWidthResizer({

View file

@ -76,6 +76,9 @@
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
const FUDGE_FACTOR = .5;
function aboutEq(a, b) {
dumpn(`Checking ${a} ~= ${b}`);
@ -94,7 +97,7 @@ window.onload = async function () {
const resizedA = [];
const resizedD = [];
const scene = ReactDOM.render([
ReactDOM.render([
dom.header({}, "header"),
dom.aside({className: "a"}, "A"),
GridElementWidthResizer({

View file

@ -24,6 +24,9 @@ Basic tests for the HSplitBox component.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
const FUDGE_FACTOR = .1;
function aboutEq(a, b) {
dumpn(`Checking ${a} ~= ${b}`);
@ -57,7 +60,7 @@ window.onload = async function () {
return el;
}
const box = await renderBox();
await renderBox();
// Test that we properly rendered our two panes.

View file

@ -22,6 +22,8 @@ Test that Accordion renders correctly.
"use strict";
/* global sinon */
window.onload = async function() {
try {
const { button, div } = require("devtools/client/shared/vendor/react-dom-factories");

View file

@ -21,6 +21,9 @@ with optional columns, unknown and non-URL sources.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -16,6 +16,9 @@ Test that the frame component reacts to source-map pref changse.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const Services = browserRequire("Services");

View file

@ -63,7 +63,7 @@ window.onload = function() {
const tree = ReactDOM.render(list, document.body);
const listEl = findRenderedDOMComponentWithClass(tree, "list");
const items = scryRenderedDOMComponentsWithTag(tree, "li");
scryRenderedDOMComponentsWithTag(tree, "li");
const defaultFocus = listEl.ownerDocument.body;
function blurEl(el) {
@ -250,7 +250,7 @@ window.onload = function() {
}];
for (const test of tests) {
const { action, condition, event, state, name } = test;
const { action, event, state, name } = test;
is(listEl, findRenderedDOMComponentWithClass(tree, "list"), "Sanity check");

View file

@ -21,6 +21,9 @@ Test for Notification Box. The test is checking:
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -17,6 +17,9 @@ Test for Notification Box. The test is checking:
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -17,6 +17,9 @@ Test for Notification Box. The test is checking:
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
@ -29,7 +32,7 @@ window.onload = async function () {
const notificationNode = ReactDOM.findDOMNode(notificationBox);
let buttonCallbackExecuted = false;
var buttons = [{
const buttons = [{
label: "Button1",
callback: () => {
buttonCallbackExecuted = true;

View file

@ -85,7 +85,6 @@ window.onload = async function () {
},
onChange: () => null,
});
const { refs } = component;
async function testSearchBoxWithAutocomplete() {
ok(!$(".devtools-autocomplete-popup"), "Autocomplete list not visible");

View file

@ -16,6 +16,9 @@ Test sidebar toggle button
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
const SidebarToggle = browserRequire("devtools/client/shared/components/SidebarToggle.js");

View file

@ -16,6 +16,9 @@ Test tabs accessibility.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -21,6 +21,9 @@ Test all-tabs menu.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -35,7 +35,7 @@ window.onload = function() {
const TreeView =
browserRequire("devtools/client/shared/components/tree/TreeView");
const props = {
const _props = {
...TEST_TREE_VIEW_INTERFACE,
renderValue: props => {
return (props.value === "C" ?
@ -47,7 +47,7 @@ window.onload = function() {
);
},
};
const treeView = React.createElement(TreeView, props);
const treeView = React.createElement(TreeView, _props);
const tree = ReactDOM.render(treeView, document.body);
const treeViewEl = findRenderedDOMComponentWithClass(tree, "treeTable");
const rows = scryRenderedDOMComponentsWithClass(tree, "treeRow");
@ -251,7 +251,7 @@ window.onload = function() {
}];
for (const test of tests) {
const { action, condition, event, state, name } = test;
const { action, event, state, name } = test;
info(name);
if (event) {

View file

@ -74,7 +74,7 @@ window.onload = function() {
}];
for (const test of tests) {
const { action, condition, event, state, name } = test;
const { action, event, state, name } = test;
info(name);
if (event) {
@ -98,6 +98,7 @@ window.onload = function() {
if (label === "C") {
return ["hide"];
}
return [];
}
}
};

View file

@ -17,6 +17,9 @@ depth.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -16,6 +16,9 @@ Test that collapsed subtrees aren't rendered.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -16,6 +16,9 @@ Test Tree's autoExpandDepth.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -16,6 +16,9 @@ Test that we only render visible tree items.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
function getSpacerHeights() {

View file

@ -17,6 +17,9 @@ Test that arrows get the open attribute when their item's children are expanded.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -18,6 +18,9 @@ other inputs.
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -17,6 +17,9 @@ Test that when an item in the Tree component is expanded or collapsed the approp
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -17,6 +17,9 @@ Test that when an item in the Tree component is expanded or collapsed the approp
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
@ -32,7 +35,7 @@ window.onload = async function () {
return ReactDOM.render(Tree(treeProps), window.document.body);
}
const tree = renderTree({ focused: "A" });
renderTree({ focused: "A" });
isRenderedTree(document.body.textContent, [
"A:true",

View file

@ -29,6 +29,9 @@ Test that when an item in the Tree component is focused by arrow key, the view i
<pre id="test">
<script src="head.js" type="application/javascript"></script>
<script type="application/javascript">
'use strict'
window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");

View file

@ -29,7 +29,6 @@ window.onload = async function() {
Simulate,
findRenderedDOMComponentWithClass,
findRenderedDOMComponentWithTag,
scryRenderedDOMComponentsWithTag,
} = browserRequire("devtools/client/shared/vendor/react-dom-test-utils");
const Tree = createFactory(
browserRequire("devtools/client/shared/components/VirtualizedTree"));
@ -209,7 +208,7 @@ window.onload = async function() {
}];
for (const test of tests) {
const { action, condition, event, props, name } = test;
const { action, event, props, name } = test;
info(name);
if (event) {
@ -225,6 +224,7 @@ window.onload = async function() {
if (test.activeElement) {
const expected = typeof test.activeElement === "string" ?
els[test.activeElement] : test.activeElement;
// eslint-disable-next-line no-debugger
if (document.activeElement!==expected) {debugger;}
is(document.activeElement, expected, "Focus is set correctly.");
}

View file

@ -36,8 +36,6 @@ window.onload = async function () {
try {
const ReactDOM = browserRequire("devtools/client/shared/vendor/react-dom");
const { createFactory } = browserRequire("devtools/client/shared/vendor/react");
const { Simulate } =
browserRequire("devtools/client/shared/vendor/react-dom-test-utils");
const Tree =
createFactory(browserRequire("devtools/client/shared/components/VirtualizedTree"));

View file

@ -16,6 +16,7 @@
window.addEventListener("load", function() {
function initialSetup(event) {
// eslint-disable-next-line no-debugger
debugger;
const button = document.querySelector("button");
button.onclick = clickHandler;

View file

@ -20,6 +20,7 @@
function initialSetup(event) {
const button = document.getElementById("initialSetup");
button.removeEventListener("click", initialSetup);
// eslint-disable-next-line no-debugger
debugger;
}
@ -27,24 +28,24 @@
window.foobar = "clicker";
}
function handleEventClick() {
function HandleEventClick() {
const button = document.getElementById("handleEventClick");
// Create a long prototype chain to test for weird edge cases.
button.addEventListener("click", Object.create(Object.create(this)));
}
handleEventClick.prototype.handleEvent = function() {
window.foobar = "handleEventClick";
HandleEventClick.prototype.handleEvent = function() {
window.foobar = "HandleEventClick";
};
function boundHandleEventClick() {
function BoundHandleEventClick() {
const button = document.getElementById("boundHandleEventClick");
this.handleEvent = this.handleEvent.bind(this);
button.addEventListener("click", this);
}
boundHandleEventClick.prototype.handleEvent = function() {
window.foobar = "boundHandleEventClick";
BoundHandleEventClick.prototype.handleEvent = function() {
window.foobar = "BoundHandleEventClick";
};
const button = document.getElementById("clicker");
@ -52,8 +53,8 @@
const boundClicker = clicker.bind(this).bind(this).bind(this);
button.addEventListener("click", boundClicker);
new handleEventClick();
new boundHandleEventClick();
new HandleEventClick();
new BoundHandleEventClick();
const initButton = document.getElementById("initialSetup");
initButton.addEventListener("click", initialSetup);

View file

@ -13,7 +13,10 @@
<script type="text/javascript">
"use strict";
/* exported runDebuggerStatement */
function runDebuggerStatement() {
// eslint-disable-next-line no-debugger
debugger;
}
</script>

View file

@ -8,10 +8,11 @@
<script type="text/javascript">
"use strict";
/* exported initialSetup */
function initialSetup(event) {
// eslint-disable-next-line no-debugger
debugger;
}
window.addEventListener("load", function() {});
</script>
</head>