@samitouri / QOS-React-2 / commits / 776d1c69b9

Lint fixes

Stephanie Ding committed Sep 11, 2019 at 08:11 UTC 776d1c69b91aafe59027fbf51b8a07d8c7596e78
2 files changed +13 -11
packages/react-devtools-extensions/src/injectGlobalHook.js
+8 -5
@@ -32,14 +32,17 @@ window.addEventListener('message', function(evt) {
32 };
33 chrome.runtime.sendMessage(lastDetectionResult);
34
35 - // Inject the backend. This is done in the content script to avoid CSP
36 - // and Trusted Types violations, since content scripts can modify the DOM
37 - // and are not subject to the page's policies
35 + // Inject the backend. This is done in the content script to avoid CSP
36 + // and Trusted Types violations, since content scripts can modify the DOM
37 + // and are not subject to the page's policies.
38 } else if (evt.data.source === 'react-devtools-inject-backend') {
39 // the prototype stuff is in case document.createElement has been modified
40 - var script = document.constructor.prototype.createElement.call(document, 'script');
40 + const script = document.constructor.prototype.createElement.call(
41 + document,
42 + 'script',
43 + );
44 script.src = chrome.runtime.getURL('build/backend.js');
42 - script.charset = "utf-8";
45 + script.charset = 'utf-8';
46 document.documentElement.appendChild(script);
47 script.parentNode.removeChild(script);
48 }
packages/react-devtools-extensions/src/main.js
+5 -6
@@ -4,7 +4,6 @@ import {createElement} from 'react';
4 import {unstable_createRoot as createRoot, flushSync} from 'react-dom';
5 import Bridge from 'react-devtools-shared/src/bridge';
6 import Store from 'react-devtools-shared/src/devtools/store';
7 -import inject from './inject';
7 import {
8 createViewElementSource,
9 getBrowserName,
@@ -136,12 +135,12 @@ function createPanelIfReactLoaded() {
135 // Initialize the backend only once the Store has been initialized.
136 // Otherwise the Store may miss important initial tree op codes.
137 chrome.devtools.inspectedWindow.eval(
139 - `window.postMessage({ source: 'react-devtools-inject-backend' });`,
140 - function(response, error) {
141 - if (error) {
142 - console.log(error);
138 + `window.postMessage({ source: 'react-devtools-inject-backend' });`,
139 + function(response, evalError) {
140 + if (evalError) {
141 + console.log(evalError);
142 }
144 - }
143 + },
144 );
145
146 const viewElementSourceFunction = createViewElementSource(