Skip to content

Commit ab29a88

Browse files
malwilleypmmmwh
authored andcommitted
fix: remove all es6 syntax
(cherry picked from commit a3010fc)
1 parent 7bc3dfb commit ab29a88

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

src/overlay/components/CompileErrorTrace.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const ansiHTML = require('ansi-html');
2-
const { Html5Entities } = require('html-entities');
2+
const Html5Entities = require('html-entities').Html5Entities;
33
const theme = require('../theme');
44
const formatFilename = require('../utils/formatFilename');
55

src/overlay/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ function handleRuntimeError(error) {
326326
}
327327

328328
module.exports = Object.freeze({
329-
clearCompileError,
330-
clearRuntimeErrors,
331-
handleRuntimeError,
332-
showCompileError,
333-
showRuntimeErrors,
329+
clearCompileError: clearCompileError,
330+
clearRuntimeErrors: clearRuntimeErrors,
331+
handleRuntimeError: handleRuntimeError,
332+
showCompileError: showCompileError,
333+
showRuntimeErrors: showRuntimeErrors,
334334
});

src/runtime/ErrorOverlayEntry.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* global __resourceQuery, __react_refresh_error_overlay__, __react_refresh_init_socket__ */
22

3-
const {
4-
error: registerErrorHandler,
5-
unhandledRejection: registerUnhandledRejectionHandler,
6-
} = require('./errorEventHandlers');
3+
const errorEventHandlers = require('./errorEventHandlers');
74
const formatWebpackErrors = require('./formatWebpackErrors');
85

6+
const registerErrorHandler = errorEventHandlers.error;
7+
const registerUnhandledRejectionHandler = errorEventHandlers.unhandledRejection;
8+
99
// Setup error states
1010
let isHotReload = false;
1111
let hasRuntimeErrors = false;

src/runtime/formatWebpackErrors.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ function formatMessage(message) {
2121

2222
// Strip Webpack-added headers off errors/warnings
2323
// https://github.com/webpack/webpack/blob/master/lib/ModuleError.js
24-
lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line));
24+
lines = lines.filter(function (line) {
25+
return !/Module [A-z ]+\(from/.test(line);
26+
});
2527

2628
// Remove leading newline
2729
if (lines.length > 2 && lines[1].trim() === '') {
2830
lines.splice(1, 1);
2931
}
3032

3133
// Remove duplicated newlines
32-
lines = lines.filter(
33-
(line, index, arr) => index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim()
34-
);
34+
lines = lines.filter(function (line, index, arr) {
35+
return index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim();
36+
});
3537

3638
// Clean up the file name
3739
lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, '$1');

src/runtime/refreshUtils.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function getReactRefreshBoundarySignature(moduleExports) {
2727
return signature;
2828
}
2929

30-
for (const key in moduleExports) {
30+
for (let key in moduleExports) {
3131
if (key === '__esModule') {
3232
continue;
3333
}
@@ -143,7 +143,7 @@ function isReactRefreshBoundary(module) {
143143

144144
let hasExports = false;
145145
let areAllExportsComponents = true;
146-
for (const key in moduleExports) {
146+
for (let key in moduleExports) {
147147
hasExports = true;
148148

149149
// This is the ES Module indicator flag set by Webpack
@@ -185,7 +185,7 @@ function registerExportsForReactRefresh(module) {
185185
return;
186186
}
187187

188-
for (const key in moduleExports) {
188+
for (let key in moduleExports) {
189189
// Skip registering the Webpack ES Module indicator
190190
if (key === '__esModule') {
191191
continue;
@@ -225,10 +225,10 @@ function shouldInvalidateReactRefreshBoundary(prevModule, nextModule) {
225225
}
226226

227227
module.exports = Object.freeze({
228-
createHotDisposeCallback,
229-
createHotErrorHandler,
228+
createHotDisposeCallback: createHotDisposeCallback,
229+
createHotErrorHandler: createHotErrorHandler,
230230
enqueueUpdate: createDebounceUpdate(),
231-
isReactRefreshBoundary,
232-
shouldInvalidateReactRefreshBoundary,
233-
registerExportsForReactRefresh,
231+
isReactRefreshBoundary: isReactRefreshBoundary,
232+
shouldInvalidateReactRefreshBoundary: shouldInvalidateReactRefreshBoundary,
233+
registerExportsForReactRefresh: registerExportsForReactRefresh,
234234
});

0 commit comments

Comments
 (0)