From f1384e75225d3bbcf7adf1c413b46c9fce03250c Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 18 Nov 2019 11:38:47 -0330 Subject: [PATCH] Disable unnecessary curly braces in JSX (#7454) --- .eslintrc | 1 + .../unit/ui/app/components/token-cell.spec.js | 10 +++---- .../account-details.component.js | 2 +- .../confirm-detail-row.component.test.js | 14 +++++----- .../app/dropdowns/tests/menu.test.js | 8 +++--- .../tests/network-dropdown-icon.test.js | 6 ++-- .../advanced-tab-content-component.test.js | 8 +++--- .../gas-modal-page-container.component.js | 2 +- ...gas-modal-page-container-component.test.js | 12 ++++---- .../confirm-remove-account.component.js | 2 +- .../loading-network-error.component.js | 2 +- .../metametrics-opt-in-modal.component.js | 6 ++-- .../modals/qr-scanner/qr-scanner.component.js | 10 +++---- .../app/sidebars/sidebar.component.js | 4 +-- .../sidebars/tests/sidebars-component.test.js | 4 +-- .../tests/button-group-component.test.js | 6 ++-- .../page-container-footer.component.test.js | 6 ++-- .../page-container-header.component.test.js | 6 ++-- .../confirm-deploy-contract.component.js | 2 +- .../confirm-send-ether.component.js | 2 +- .../metametrics-opt-in.component.js | 6 ++-- .../tests/account-list-item-component.test.js | 6 ++-- .../tests/add-recipient-component.test.js | 4 +-- .../amount-max-button.component.js | 2 +- .../tests/amount-max-button-component.test.js | 6 ++-- .../send-amount-row.component.js | 2 +- .../tests/send-amount-row-component.test.js | 14 +++++----- .../send-dropdown-list.component.js | 2 +- .../send-dropdown-list-component.test.js | 4 +-- .../test/gas-fee-display.component.test.js | 6 ++-- .../send-gas-row/send-gas-row.component.js | 2 +- .../tests/send-gas-row-component.test.js | 6 ++-- .../send-hex-data-row.component.js | 2 +- .../send-row-error-message-component.test.js | 2 +- .../tests/send-row-wrapper-component.test.js | 12 ++++---- .../tests/send-footer-component.test.js | 28 +++++++++---------- .../tests/send-header-component.test.js | 2 +- .../pages/send/tests/send-component.test.js | 26 ++++++++--------- .../pages/send/to-autocomplete.component.js | 12 ++++---- .../add-contact/add-contact.component.js | 2 +- .../edit-contact/edit-contact.component.js | 2 +- 41 files changed, 131 insertions(+), 130 deletions(-) diff --git a/.eslintrc b/.eslintrc index d6af718f4..32379e857 100644 --- a/.eslintrc +++ b/.eslintrc @@ -148,6 +148,7 @@ "operator-linebreak": [2, "after", { "overrides": { "?": "ignore", ":": "ignore" } }], "padded-blocks": "off", "quotes": [2, "single", {"avoidEscape": true, "allowTemplateLiterals": true}], + "react/jsx-curly-brace-presence": [2, { "props": "never", "children": "never" }], "react/no-deprecated": 0, "react/default-props-match-prop-types": 2, "semi": [2, "never"], diff --git a/test/unit/ui/app/components/token-cell.spec.js b/test/unit/ui/app/components/token-cell.spec.js index 23e76c418..5deafd8d7 100644 --- a/test/unit/ui/app/components/token-cell.spec.js +++ b/test/unit/ui/app/components/token-cell.spec.js @@ -37,12 +37,12 @@ describe('Token Cell', () => { wrapper = mount( ) diff --git a/ui/app/components/app/account-details/account-details.component.js b/ui/app/components/app/account-details/account-details.component.js index ecf2f9428..55078cee0 100644 --- a/ui/app/components/app/account-details/account-details.component.js +++ b/ui/app/components/app/account-details/account-details.component.js @@ -76,7 +76,7 @@ export default class AccountDetails extends Component { diff --git a/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js b/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js index 95ca8144a..4ef866630 100644 --- a/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js +++ b/ui/app/components/app/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js @@ -14,15 +14,15 @@ describe('Confirm Detail Row Component', function () { beforeEach(() => { wrapper = shallow( ) }) diff --git a/ui/app/components/app/dropdowns/tests/menu.test.js b/ui/app/components/app/dropdowns/tests/menu.test.js index 9f5f13f00..ce7f1877f 100644 --- a/ui/app/components/app/dropdowns/tests/menu.test.js +++ b/ui/app/components/app/dropdowns/tests/menu.test.js @@ -11,7 +11,7 @@ describe('Dropdown Menu Components', () => { beforeEach(() => { wrapper = shallow( - + ) }) @@ -29,9 +29,9 @@ describe('Dropdown Menu Components', () => { beforeEach(() => { wrapper = shallow( ) diff --git a/ui/app/components/app/dropdowns/tests/network-dropdown-icon.test.js b/ui/app/components/app/dropdowns/tests/network-dropdown-icon.test.js index 67b192c11..ecc00a0fd 100644 --- a/ui/app/components/app/dropdowns/tests/network-dropdown-icon.test.js +++ b/ui/app/components/app/dropdowns/tests/network-dropdown-icon.test.js @@ -8,10 +8,10 @@ describe('Network Dropdown Icon', () => { beforeEach(() => { wrapper = shallow() }) diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js b/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js index 7ed5b8e03..218b63763 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/tests/advanced-tab-content-component.test.js @@ -21,10 +21,10 @@ describe('AdvancedTabContent Component', function () { wrapper = shallow({sendAmount}
- {this.context.t('transactionFee')} + {this.context.t('transactionFee')} {transactionFee}
diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-component.test.js b/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-component.test.js index 0a3efc490..4cfb1c447 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-component.test.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/tests/gas-modal-page-container-component.test.js @@ -74,9 +74,9 @@ describe('GasModalPageContainer Component', function () { customGasLimit={54321} gasPriceButtonGroupProps={mockGasPriceButtonGroupProps} infoRowProps={mockInfoRowProps} - currentTimeEstimate={'1 min 31 sec'} - customGasPriceInHex={'mockCustomGasPriceInHex'} - customGasLimitInHex={'mockCustomGasLimitInHex'} + currentTimeEstimate="1 min 31 sec" + customGasPriceInHex="mockCustomGasPriceInHex" + customGasLimitInHex="mockCustomGasLimitInHex" insufficientBalance={false} disableSave={false} />) @@ -195,9 +195,9 @@ describe('GasModalPageContainer Component', function () { customGasLimit={54321} gasPriceButtonGroupProps={mockGasPriceButtonGroupProps} infoRowProps={mockInfoRowProps} - currentTimeEstimate={'1 min 31 sec'} - customGasPriceInHex={'mockCustomGasPriceInHex'} - customGasLimitInHex={'mockCustomGasLimitInHex'} + currentTimeEstimate="1 min 31 sec" + customGasPriceInHex="mockCustomGasPriceInHex" + customGasLimitInHex="mockCustomGasLimitInHex" insufficientBalance={false} disableSave={false} hideBasic={true} diff --git a/ui/app/components/app/modals/confirm-remove-account/confirm-remove-account.component.js b/ui/app/components/app/modals/confirm-remove-account/confirm-remove-account.component.js index f35fb85a0..7fe79be5b 100644 --- a/ui/app/components/app/modals/confirm-remove-account/confirm-remove-account.component.js +++ b/ui/app/components/app/modals/confirm-remove-account/confirm-remove-account.component.js @@ -48,7 +48,7 @@ export default class ConfirmRemoveAccount extends Component { diff --git a/ui/app/components/app/modals/loading-network-error/loading-network-error.component.js b/ui/app/components/app/modals/loading-network-error/loading-network-error.component.js index 44f71e4b2..6cac4942f 100644 --- a/ui/app/components/app/modals/loading-network-error/loading-network-error.component.js +++ b/ui/app/components/app/modals/loading-network-error/loading-network-error.component.js @@ -12,7 +12,7 @@ const LoadingNetworkError = (props, context) => { submitText={t('tryAgain')} > ) diff --git a/ui/app/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.component.js b/ui/app/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.component.js index 1bf7c21b5..6f3225382 100644 --- a/ui/app/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.component.js +++ b/ui/app/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.component.js @@ -102,7 +102,7 @@ export default class MetaMetricsOptInModal extends Component { hideModal() }) }} - cancelText={'No Thanks'} + cancelText="No Thanks" hideCancel={false} onSubmit={() => { setParticipateInMetaMetrics(true) @@ -118,8 +118,8 @@ export default class MetaMetricsOptInModal extends Component { hideModal() }) }} - submitText={'I agree'} - submitButtonType={'confirm'} + submitText="I agree" + submitButtonType="confirm" disabled={false} />
diff --git a/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js b/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js index afeaef0da..7accf0e58 100644 --- a/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js +++ b/ui/app/components/app/modals/qr-scanner/qr-scanner.component.js @@ -142,14 +142,14 @@ export default class QrScanner extends Component { renderVideo () { return ( -
+
) } @@ -172,12 +172,12 @@ export default class QrScanner extends Component {
- +
{ title }
-
+
{msg}
{ this.renderVideo() }
-
+
{this.state.msg}
diff --git a/ui/app/components/app/sidebars/sidebar.component.js b/ui/app/components/app/sidebars/sidebar.component.js index e532ba7e5..484b87e4b 100644 --- a/ui/app/components/app/sidebars/sidebar.component.js +++ b/ui/app/components/app/sidebars/sidebar.component.js @@ -34,9 +34,9 @@ export default class Sidebar extends Component { const { transaction = {} } = sidebarProps switch (type) { case WALLET_VIEW_SIDEBAR: - return + return case 'customize-gas': - return
+ return
default: return null } diff --git a/ui/app/components/app/sidebars/tests/sidebars-component.test.js b/ui/app/components/app/sidebars/tests/sidebars-component.test.js index e2daea9b6..5f6657dde 100644 --- a/ui/app/components/app/sidebars/tests/sidebars-component.test.js +++ b/ui/app/components/app/sidebars/tests/sidebars-component.test.js @@ -19,8 +19,8 @@ describe('Sidebar Component', function () { wrapper = shallow() }) diff --git a/ui/app/components/ui/button-group/tests/button-group-component.test.js b/ui/app/components/ui/button-group/tests/button-group-component.test.js index f2e512445..663d86c74 100644 --- a/ui/app/components/ui/button-group/tests/button-group-component.test.js +++ b/ui/app/components/ui/button-group/tests/button-group-component.test.js @@ -12,9 +12,9 @@ sinon.spy(ButtonGroup.prototype, 'handleButtonClick') sinon.spy(ButtonGroup.prototype, 'renderButtons') const mockButtons = [ - , - , - , + , + , + , ] describe('ButtonGroup Component', function () { diff --git a/ui/app/components/ui/page-container/page-container-footer/tests/page-container-footer.component.test.js b/ui/app/components/ui/page-container/page-container-footer/tests/page-container-footer.component.test.js index 64efabab0..84c1ddeb5 100644 --- a/ui/app/components/ui/page-container/page-container-footer/tests/page-container-footer.component.test.js +++ b/ui/app/components/ui/page-container/page-container-footer/tests/page-container-footer.component.test.js @@ -14,10 +14,10 @@ describe('Page Footer', () => { wrapper = shallow() }) diff --git a/ui/app/components/ui/page-container/page-container-header/tests/page-container-header.component.test.js b/ui/app/components/ui/page-container/page-container-header/tests/page-container-header.component.test.js index 59304b2bd..1e055d4d4 100644 --- a/ui/app/components/ui/page-container/page-container-header/tests/page-container-header.component.test.js +++ b/ui/app/components/ui/page-container/page-container-header/tests/page-container-header.component.test.js @@ -16,9 +16,9 @@ describe('Page Container Header', () => { showBackButton = {true} onBackButtonClick = {onBackButtonClick} backButtonStyles = {style} - title = {'Test Title'} - subtitle = {'Test Subtitle'} - tabs = {'Test Tab'} + title = "Test Title" + subtitle = "Test Subtitle" + tabs = "Test Tab" onClose = {onClose} />) }) diff --git a/ui/app/pages/confirm-deploy-contract/confirm-deploy-contract.component.js b/ui/app/pages/confirm-deploy-contract/confirm-deploy-contract.component.js index c90ccc917..2bb2b8156 100644 --- a/ui/app/pages/confirm-deploy-contract/confirm-deploy-contract.component.js +++ b/ui/app/pages/confirm-deploy-contract/confirm-deploy-contract.component.js @@ -56,7 +56,7 @@ export default class ConfirmDeployContract extends Component { render () { return ( ) diff --git a/ui/app/pages/confirm-send-ether/confirm-send-ether.component.js b/ui/app/pages/confirm-send-ether/confirm-send-ether.component.js index 68280f624..6bc252dbb 100644 --- a/ui/app/pages/confirm-send-ether/confirm-send-ether.component.js +++ b/ui/app/pages/confirm-send-ether/confirm-send-ether.component.js @@ -30,7 +30,7 @@ export default class ConfirmSendEther extends Component { return ( this.handleEdit(confirmTransactionData)} /> diff --git a/ui/app/pages/first-time-flow/metametrics-opt-in/metametrics-opt-in.component.js b/ui/app/pages/first-time-flow/metametrics-opt-in/metametrics-opt-in.component.js index bb187d634..ad1ffbf42 100644 --- a/ui/app/pages/first-time-flow/metametrics-opt-in/metametrics-opt-in.component.js +++ b/ui/app/pages/first-time-flow/metametrics-opt-in/metametrics-opt-in.component.js @@ -104,7 +104,7 @@ export default class MetaMetricsOptIn extends Component { }) }) }} - cancelText={'No Thanks'} + cancelText="No Thanks" hideCancel={false} onSubmit={() => { setParticipateInMetaMetrics(true) @@ -137,8 +137,8 @@ export default class MetaMetricsOptIn extends Component { }) }) }} - submitText={'I agree'} - submitButtonType={'primary'} + submitText="I agree" + submitButtonType="primary" disabled={false} />
diff --git a/ui/app/pages/send/account-list-item/tests/account-list-item-component.test.js b/ui/app/pages/send/account-list-item/tests/account-list-item-component.test.js index bec88402d..5a2bd5638 100644 --- a/ui/app/pages/send/account-list-item/tests/account-list-item-component.test.js +++ b/ui/app/pages/send/account-list-item/tests/account-list-item-component.test.js @@ -25,10 +25,10 @@ describe('AccountListItem Component', function () { beforeEach(() => { wrapper = shallow( +
{this.context.t('max')} diff --git a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js index f986b26bb..30ef4c678 100644 --- a/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js +++ b/ui/app/pages/send/send-content/send-amount-row/amount-max-button/tests/amount-max-button-component.test.js @@ -19,13 +19,13 @@ describe('AmountMaxButton Component', function () { beforeEach(() => { wrapper = shallow(, { context: { t: str => str + '_t', diff --git a/ui/app/pages/send/send-content/send-amount-row/send-amount-row.component.js b/ui/app/pages/send/send-content/send-amount-row/send-amount-row.component.js index 10e90c419..495de58b5 100644 --- a/ui/app/pages/send/send-content/send-amount-row/send-amount-row.component.js +++ b/ui/app/pages/send/send-content/send-amount-row/send-amount-row.component.js @@ -108,7 +108,7 @@ export default class SendAmountRow extends Component { {gasTotal && } { this.renderInput() } diff --git a/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js b/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js index 62e0676db..bfc0f7e64 100644 --- a/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js +++ b/ui/app/pages/send/send-content/send-amount-row/tests/send-amount-row-component.test.js @@ -26,17 +26,17 @@ describe('SendAmountRow Component', function () { beforeEach(() => { wrapper = shallow( + ? : null } diff --git a/ui/app/pages/send/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js b/ui/app/pages/send/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js index b92dd4dfe..bc6c97586 100644 --- a/ui/app/pages/send/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js +++ b/ui/app/pages/send/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js @@ -25,7 +25,7 @@ describe('SendDropdownList Component', function () { ]} closeDropdown={propsMethodSpies.closeDropdown} onSelect={propsMethodSpies.onSelect} - activeAddress={'mockAddress2'} + activeAddress="mockAddress2" />, { context: { t: str => str + '_t' } }) }) @@ -39,7 +39,7 @@ describe('SendDropdownList Component', function () { it('should return check icon if the passed addresses are the same', () => { assert.deepEqual( wrapper.instance().getListItemIcon('mockAccount0', 'mockAccount0'), - + ) }) diff --git a/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js b/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js index eedd43221..a77d68c97 100644 --- a/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js +++ b/ui/app/pages/send/send-content/send-gas-row/gas-fee-display/test/gas-fee-display.component.test.js @@ -17,9 +17,9 @@ describe('GasFeeDisplay Component', function () { beforeEach(() => { wrapper = shallow(, {context: {t: str => str + '_t'}}) diff --git a/ui/app/pages/send/send-content/send-gas-row/send-gas-row.component.js b/ui/app/pages/send/send-content/send-gas-row/send-gas-row.component.js index ed064695e..a770cb55e 100644 --- a/ui/app/pages/send/send-content/send-gas-row/send-gas-row.component.js +++ b/ui/app/pages/send/send-content/send-gas-row/send-gas-row.component.js @@ -152,7 +152,7 @@ export default class SendGasRow extends Component { { this.renderContent() } diff --git a/ui/app/pages/send/send-content/send-gas-row/tests/send-gas-row-component.test.js b/ui/app/pages/send/send-content/send-gas-row/tests/send-gas-row-component.test.js index 0cbc92621..956c330ee 100644 --- a/ui/app/pages/send/send-content/send-gas-row/tests/send-gas-row-component.test.js +++ b/ui/app/pages/send/send-content/send-gas-row/tests/send-gas-row-component.test.js @@ -19,10 +19,10 @@ describe('SendGasRow Component', function () { beforeEach(() => { wrapper = shallow(