Skip to content

Commit 5c0cccf

Browse files
committed
Fix some eslint warnings
1 parent de8e9b6 commit 5c0cccf

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

packages/react-error-overlay/src/containers/CompileErrorContainer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type Props = {|
2727
class CompileErrorContainer extends PureComponent<Props, void> {
2828
render() {
2929
const { error, openInEditor } = this.props;
30-
const errLoc = parseCompileError(error);
30+
const errLoc: ?ErrorLocation = parseCompileError(error);
3131
return (
3232
<ErrorOverlay>
3333
<Header headerText="Failed to compile" />

packages/react-error-overlay/src/utils/parseCompileError.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export type ErrorLocation = {|
66
lineNumber: number,
77
|};
88

9-
const filePathRegex = /^\.(\/[^\/\n ]+)+\.[^\/\n ]+$/;
9+
const filePathRegex = /^\.(\/[^/\n ]+)+\.[^/\n ]+$/;
1010

1111
const lineNumberRegexes = [
1212
// Babel syntax errors
@@ -28,7 +28,9 @@ function parseCompileError(message: string): ?ErrorLocation {
2828

2929
for (let i = 0; i < lines.length; i++) {
3030
const line: string = Anser.ansiToText(lines[i]).trim();
31-
if (!line) continue;
31+
if (!line) {
32+
continue;
33+
}
3234

3335
if (!fileName && line.match(filePathRegex)) {
3436
fileName = line;
@@ -38,13 +40,15 @@ function parseCompileError(message: string): ?ErrorLocation {
3840
while (k < lineNumberRegexes.length) {
3941
const match: ?Array<string> = line.match(lineNumberRegexes[k]);
4042
if (match) {
41-
lineNumber = parseInt(match[1]);
43+
lineNumber = parseInt(match[1], 10);
4244
break;
4345
}
4446
k++;
4547
}
4648

47-
if (fileName && lineNumber) break;
49+
if (fileName && lineNumber) {
50+
break;
51+
}
4852
}
4953

5054
return fileName && lineNumber ? { fileName, lineNumber } : null;

0 commit comments

Comments
 (0)