Skip to content
  • Sponsor facebook/create-react-app

  • Notifications You must be signed in to change notification settings
  • Fork 27k

Commit 9b22817

Browse files
authoredMay 15, 2017
[Internal] Warn for missing brackets (#2151)
* Warn for missing braces * Overlay, too
1 parent 75fc094 commit 9b22817

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed
 

‎.eslintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"rules": {
1313
"no-console": "off",
14-
"strict": ["error", "global"]
14+
"strict": ["error", "global"],
15+
"curly": "warn"
1516
}
1617
}

‎packages/react-dev-utils/ansiHTML.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ function ansiHTML(txt) {
8282
if (color != null) {
8383
result += '<span style="color: #' + color + ';">' + part + '</span>';
8484
} else {
85-
if (fg != null) console.log('Missing color mapping: ', fg);
85+
if (fg != null) {
86+
console.log('Missing color mapping: ', fg);
87+
}
8688
result += '<span>' + part + '</span>';
8789
}
8890
if (_index < contentParts.length - 1) {
+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"extends": "react-app"
2+
"extends": "react-app",
3+
"rules": {
4+
"curly": "warn"
5+
}
36
}

‎packages/react-error-overlay/src/utils/mapper.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ async function map(
1717
const files: string[] = [];
1818
frames.forEach(frame => {
1919
const { fileName } = frame;
20-
if (fileName == null) return;
20+
if (fileName == null) {
21+
return;
22+
}
2123
if (files.indexOf(fileName) !== -1) {
2224
return;
2325
}

‎packages/react-error-overlay/src/utils/unmapper.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ async function unmap(
6767
}))
6868
.sort((a, b) => {
6969
const s = Math.sign(a.seps - b.seps);
70-
if (s !== 0) return s;
70+
if (s !== 0) {
71+
return s;
72+
}
7173
return Math.sign(a.penalties - b.penalties);
7274
});
7375
if (source.length < 1 || lineNumber == null) {

0 commit comments

Comments
 (0)
Please sign in to comment.