From da5a48869c5175edc7ddf76c44792115b5c54151 Mon Sep 17 00:00:00 2001 From: Greg Tatum Date: Fri, 20 Jul 2018 04:38:41 -0500 Subject: [PATCH] Add the eslint rule "react/jsx-curly-brace-presence" (#1146) --- .eslintrc.js | 1 + src/components/app/MenuButtons.js | 27 +++---- src/components/app/ZipFileViewer.js | 2 +- src/components/calltree/CallTree.js | 2 +- src/components/flame-graph/FlameGraph.js | 2 +- src/components/marker-table/ContextMenu.js | 2 +- src/components/marker-table/index.js | 2 +- src/components/shared/CallNodeContextMenu.js | 2 +- src/components/timeline/Thread.js | 2 +- src/components/timeline/ThreadContextMenu.js | 2 +- .../__snapshots__/MenuButtons.test.js.snap | 72 +++++++------------ 11 files changed, 48 insertions(+), 68 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 304f8dba15..51b79046b8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -37,6 +37,7 @@ module.exports = { 'react/no-redundant-should-component-update': 'error', 'react/no-this-in-sfc': 'error', 'react/no-typos': 'error', + "react/jsx-curly-brace-presence": ['error', { "props": 'never', "children": 'never' }], // `no-unused-prop-types` is buggy when we use destructuring parameters in // functions as it misunderstands them as functional components. // See https://github.com/yannickcr/eslint-plugin-react/issues/1561 diff --git a/src/components/app/MenuButtons.js b/src/components/app/MenuButtons.js index ca3fdb25a6..9b92655b57 100644 --- a/src/components/app/MenuButtons.js +++ b/src/components/app/MenuButtons.js @@ -42,17 +42,20 @@ require('./MenuButtons.css'); const PrivacyNotice = () => (
-

{`You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information:`}

+

+ You’re about to upload your profile publicly where anyone will be able to + access it. To better diagnose performance problems profiles include the + following information: +

-

{`To view all the information you can download the full profile to a file and open the - json structure with a text editor.`}

+

+ To view all the information you can download the full profile to a file + and open the json structure with a text editor. +

{`By default, the URLs of all network requests will be removed while sharing the profile but keeping the URLs may help to identify the problems. Please select the checkbox @@ -101,7 +104,7 @@ const ProfileSharingButton = ({ panel={

diff --git a/src/components/app/ZipFileViewer.js b/src/components/app/ZipFileViewer.js index 6971473a7b..111e99a8bc 100644 --- a/src/components/app/ZipFileViewer.js +++ b/src/components/app/ZipFileViewer.js @@ -280,7 +280,7 @@ class ZipFileViewer extends React.PureComponent { selectedNodeId={selectedZipFileIndex} expandedNodeIds={expandedZipFileIndexes} ref={this._takeTreeViewRef} - contextMenuId={'MarkersContextMenu'} + contextMenuId="MarkersContextMenu" rowHeight={30} indentWidth={15} onEnterKey={this._onEnterKey} diff --git a/src/components/calltree/CallTree.js b/src/components/calltree/CallTree.js index 2d7cf66e50..a5e9ec9973 100644 --- a/src/components/calltree/CallTree.js +++ b/src/components/calltree/CallTree.js @@ -194,7 +194,7 @@ class CallTreeComponent extends PureComponent { highlightRegExp={searchStringsRegExp} disableOverscan={disableOverscan} ref={this._takeTreeViewRef} - contextMenuId={'CallNodeContextMenu'} + contextMenuId="CallNodeContextMenu" maxNodeDepth={callNodeMaxDepth} icons={this.props.icons} rowHeight={16} diff --git a/src/components/flame-graph/FlameGraph.js b/src/components/flame-graph/FlameGraph.js index 8cdcb8c6f6..cd0fe6c5ba 100644 --- a/src/components/flame-graph/FlameGraph.js +++ b/src/components/flame-graph/FlameGraph.js @@ -104,7 +104,7 @@ class FlameGraph extends React.PureComponent { {threadName} { render() { return ( - + Set selection start time here diff --git a/src/components/marker-table/index.js b/src/components/marker-table/index.js index 85153c5208..a1ca3b8272 100644 --- a/src/components/marker-table/index.js +++ b/src/components/marker-table/index.js @@ -185,7 +185,7 @@ class MarkerTable extends PureComponent { selectedNodeId={selectedMarker} expandedNodeIds={this._expandedNodeIds} ref={this._takeTreeViewRef} - contextMenuId={'MarkersContextMenu'} + contextMenuId="MarkersContextMenu" rowHeight={16} indentWidth={10} /> diff --git a/src/components/shared/CallNodeContextMenu.js b/src/components/shared/CallNodeContextMenu.js index eaf1f90d88..f699bd2c16 100644 --- a/src/components/shared/CallNodeContextMenu.js +++ b/src/components/shared/CallNodeContextMenu.js @@ -471,7 +471,7 @@ class CallNodeContextMenu extends PureComponent { return ( diff --git a/src/components/timeline/Thread.js b/src/components/timeline/Thread.js index 6af2c94500..50eb4ba164 100644 --- a/src/components/timeline/Thread.js +++ b/src/components/timeline/Thread.js @@ -178,7 +178,7 @@ class TimelineThread extends PureComponent { style={style} > { ); return ( - + {threads.length <= 1 ? null : (

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -57,8 +56,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons 1`] = `

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile @@ -243,8 +241,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons 1`] = ` className="privacyNotice" >

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -258,8 +255,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons 1`] = `

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile @@ -391,8 +387,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons 2`] = ` className="privacyNotice" >

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -406,8 +401,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons 2`] = `

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile @@ -592,8 +586,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons 2`] = ` className="privacyNotice" >

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -607,8 +600,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons 2`] = `

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile @@ -740,8 +732,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo className="privacyNotice" >

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -755,8 +746,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile @@ -941,8 +931,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo className="privacyNotice" >

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -956,8 +945,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile @@ -1089,8 +1077,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo className="privacyNotice" >

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -1104,8 +1091,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile @@ -1290,8 +1276,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo className="privacyNotice" >

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -1305,8 +1290,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile @@ -1438,8 +1422,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo className="privacyNotice" >

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -1453,8 +1436,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile @@ -1639,8 +1621,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo className="privacyNotice" >

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -1654,8 +1635,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile @@ -1787,8 +1767,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo className="privacyNotice" >

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -1802,8 +1781,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile @@ -1988,8 +1966,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo className="privacyNotice" >

- You’re about to upload your profile publicly where anyone will be able to access it. - To better diagnose performance problems profiles include the following information: + You’re about to upload your profile publicly where anyone will be able to access it. To better diagnose performance problems profiles include the following information:

  • @@ -2003,8 +1980,7 @@ exports[`app/MenuButtons renders the MenuButtons buttons with profile.meta.netwo

- To view all the information you can download the full profile to a file and open the - json structure with a text editor. + To view all the information you can download the full profile to a file and open the json structure with a text editor.

By default, the URLs of all network requests will be removed while sharing the profile