Skip to content

Commit

Permalink
[Internal] Warn for missing brackets (facebook#2151)
Browse files Browse the repository at this point in the history
* Warn for missing braces

* Overlay, too
  • Loading branch information
Timer authored and romaindso committed Jul 10, 2017
1 parent 942b320 commit 08352bc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"rules": {
"no-console": "off",
"strict": ["error", "global"]
"strict": ["error", "global"],
"curly": "warn"
}
}
4 changes: 3 additions & 1 deletion packages/react-dev-utils/ansiHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ function ansiHTML(txt) {
if (color != null) {
result += '<span style="color: #' + color + ';">' + part + '</span>';
} else {
if (fg != null) console.log('Missing color mapping: ', fg);
if (fg != null) {
console.log('Missing color mapping: ', fg);
}
result += '<span>' + part + '</span>';
}
if (_index < contentParts.length - 1) {
Expand Down
5 changes: 4 additions & 1 deletion packages/react-error-overlay/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "react-app"
"extends": "react-app",
"rules": {
"curly": "warn"
}
}
4 changes: 3 additions & 1 deletion packages/react-error-overlay/src/utils/mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ async function map(
const files: string[] = [];
frames.forEach(frame => {
const { fileName } = frame;
if (fileName == null) return;
if (fileName == null) {
return;
}
if (files.indexOf(fileName) !== -1) {
return;
}
Expand Down
4 changes: 3 additions & 1 deletion packages/react-error-overlay/src/utils/unmapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ async function unmap(
}))
.sort((a, b) => {
const s = Math.sign(a.seps - b.seps);
if (s !== 0) return s;
if (s !== 0) {
return s;
}
return Math.sign(a.penalties - b.penalties);
});
if (source.length < 1 || lineNumber == null) {
Expand Down

0 comments on commit 08352bc

Please sign in to comment.