From edc3223d5d0e012a81b70a829847ca34c05a83c5 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Sun, 14 May 2017 19:05:09 -0400 Subject: [PATCH 1/2] Warn for missing braces --- .eslintrc | 3 ++- packages/react-dev-utils/ansiHTML.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.eslintrc b/.eslintrc index d4e6d47749e..44a504e4080 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,6 +11,7 @@ }, "rules": { "no-console": "off", - "strict": ["error", "global"] + "strict": ["error", "global"], + "curly": "warn" } } diff --git a/packages/react-dev-utils/ansiHTML.js b/packages/react-dev-utils/ansiHTML.js index 3e192e66f0f..c4e850736ac 100644 --- a/packages/react-dev-utils/ansiHTML.js +++ b/packages/react-dev-utils/ansiHTML.js @@ -82,7 +82,9 @@ function ansiHTML(txt) { if (color != null) { result += '' + part + ''; } else { - if (fg != null) console.log('Missing color mapping: ', fg); + if (fg != null) { + console.log('Missing color mapping: ', fg); + } result += '' + part + ''; } if (_index < contentParts.length - 1) { From f48179771b1d2d513d7af28c90918bd51037d4d7 Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Sun, 14 May 2017 19:07:17 -0400 Subject: [PATCH 2/2] Overlay, too --- packages/react-error-overlay/.eslintrc | 5 ++++- packages/react-error-overlay/src/utils/mapper.js | 4 +++- packages/react-error-overlay/src/utils/unmapper.js | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/react-error-overlay/.eslintrc b/packages/react-error-overlay/.eslintrc index 5e603ecd193..9dadba0d985 100644 --- a/packages/react-error-overlay/.eslintrc +++ b/packages/react-error-overlay/.eslintrc @@ -1,3 +1,6 @@ { - "extends": "react-app" + "extends": "react-app", + "rules": { + "curly": "warn" + } } diff --git a/packages/react-error-overlay/src/utils/mapper.js b/packages/react-error-overlay/src/utils/mapper.js index 17a6bd1c439..3dbb642a11f 100644 --- a/packages/react-error-overlay/src/utils/mapper.js +++ b/packages/react-error-overlay/src/utils/mapper.js @@ -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; } diff --git a/packages/react-error-overlay/src/utils/unmapper.js b/packages/react-error-overlay/src/utils/unmapper.js index bf6e5917dfc..d165c249324 100644 --- a/packages/react-error-overlay/src/utils/unmapper.js +++ b/packages/react-error-overlay/src/utils/unmapper.js @@ -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) {