From b0890b6b32a10c0cddd9f4482d4d5bf5db8bcdcb Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Mon, 18 Nov 2019 19:53:41 -0330 Subject: [PATCH] Enforce a single boolean attr notation in JSX (#7465) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This changeset enables the ESLint rule enforcing a single notation for boolean attributes in JSX—explictly setting the value to `true` is no longer allowed (as it was never needed).[1] From the docs for JSX:[2] > If you pass no value for a prop, it defaults to `true`. [1]:https://github.com/yannickcr/eslint-plugin-react/blob/80935658/docs/rules/jsx-boolean-value.md [2]:https://reactjs.org/docs/jsx-in-depth.html#props-default-to-true I have chosen to use this default as it the most consistent with HTML (a la `checked` and `disabled`). --- .eslintrc | 1 + ui/app/components/app/app-header/app-header.component.js | 4 ++-- ui/app/components/app/dropdowns/tests/menu.test.js | 2 +- .../tests/advanced-tab-content-component.test.js | 4 ++-- .../basic-tab-content/basic-tab-content.component.js | 2 +- .../gas-modal-page-container.component.js | 2 +- .../tests/gas-modal-page-container-component.test.js | 2 +- ui/app/components/app/modal/tests/modal.component.test.js | 2 +- .../tests/transaction-activity-log.component.test.js | 2 +- .../tests/transaction-list-item-details.component.test.js | 2 +- .../transaction-view-balance.component.js | 4 ++-- .../user-preferenced-currency-display.component.test.js | 2 +- .../currency-input/tests/currency-input.component.test.js | 2 +- .../ui/metafox-logo/tests/metafox-logo.component.test.js | 2 +- .../tests/page-container-header.component.test.js | 2 +- ui/app/pages/confirm-approve/confirm-approve.component.js | 4 ++-- .../confirm-transaction-base.component.js | 2 +- ui/app/pages/create-account/create-account.component.js | 6 +++--- ui/app/pages/create-account/new-account.component.js | 4 ++-- .../send/account-list-item/account-list-item.component.js | 4 ++-- .../send-content/send-gas-row/send-gas-row.component.js | 2 +- .../send/send-content/tests/send-content-component.test.js | 2 +- .../send/send-footer/tests/send-footer-component.test.js | 4 ++-- ui/app/pages/send/tests/send-component.test.js | 2 +- ui/app/pages/send/to-autocomplete.component.js | 2 +- .../contact-list-tab/edit-contact/edit-contact.component.js | 2 +- 26 files changed, 35 insertions(+), 34 deletions(-) diff --git a/.eslintrc b/.eslintrc index 2082d1ec5..08d8aeb9d 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-boolean-value": 2, "react/jsx-curly-brace-presence": [2, { "props": "never", "children": "never" }], "react/jsx-equals-spacing": 2, "react/no-deprecated": 0, diff --git a/ui/app/components/app/app-header/app-header.component.js b/ui/app/components/app/app-header/app-header.component.js index 7bf7a39bd..e1bc0cf24 100644 --- a/ui/app/components/app/app-header/app-header.component.js +++ b/ui/app/components/app/app-header/app-header.component.js @@ -71,7 +71,7 @@ export default class AppHeader extends PureComponent { ) @@ -92,7 +92,7 @@ export default class AppHeader extends PureComponent { className={classnames('app-header', { 'app-header--back-drop': isUnlocked })}>
history.push(DEFAULT_ROUTE)} />
diff --git a/ui/app/components/app/dropdowns/tests/menu.test.js b/ui/app/components/app/dropdowns/tests/menu.test.js index c98a829ec..6413c0c2c 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( - + ) }) 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 218b63763..05075f3ba 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 @@ -26,9 +26,9 @@ describe('AdvancedTabContent Component', function () { timeRemaining="21500" transactionFee="$0.25" insufficientBalance={false} - customPriceIsSafe={true} + customPriceIsSafe isSpeedUp={false} - isEthereumNetwork={true} + isEthereumNetwork />) }) diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js b/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js index 931611460..c804abe3a 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/basic-tab-content/basic-tab-content.component.js @@ -23,7 +23,7 @@ export default class BasicTabContent extends Component { {!gasPriceButtonGroupProps.loading ? : diff --git a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js index cfabf02b9..f405cb7b9 100644 --- a/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js +++ b/ui/app/components/app/gas-customization/gas-modal-page-container/gas-modal-page-container.component.js @@ -204,7 +204,7 @@ export default class GasModalPageContainer extends Component { }} submitText={this.context.t('save')} headerCloseText={this.context.t('close')} - hideCancel={true} + hideCancel />
) 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 4cfb1c447..3e416db49 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 @@ -200,7 +200,7 @@ describe('GasModalPageContainer Component', function () { customGasLimitInHex="mockCustomGasLimitInHex" insufficientBalance={false} disableSave={false} - hideBasic={true} + hideBasic />) const renderTabsResult = wrapper.instance().renderTabs() diff --git a/ui/app/components/app/modal/tests/modal.component.test.js b/ui/app/components/app/modal/tests/modal.component.test.js index 5922177a6..9e964860c 100644 --- a/ui/app/components/app/modal/tests/modal.component.test.js +++ b/ui/app/components/app/modal/tests/modal.component.test.js @@ -110,7 +110,7 @@ describe('Modal Component', () => { cancelText="Cancel" onSubmit={handleSubmit} submitText="Submit" - submitDisabled={true} + submitDisabled headerText="My Header" onClose={handleCancel} /> diff --git a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js index b070b76ea..6625a46a9 100644 --- a/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js +++ b/ui/app/components/app/transaction-activity-log/tests/transaction-activity-log.component.test.js @@ -90,7 +90,7 @@ describe('TransactionActivityLog Component', () => { onCancel={() => {}} onRetry={() => {}} primaryTransactionStatus="pending" - isEarliestNonce={true} + isEarliestNonce />, { context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } } ) diff --git a/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js b/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js index 85bd073e5..69360fec6 100644 --- a/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js +++ b/ui/app/components/app/transaction-list-item-details/tests/transaction-list-item-details.component.test.js @@ -70,7 +70,7 @@ describe('TransactionListItemDetails Component', () => { const wrapper = shallow( , { context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } } ) diff --git a/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js b/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js index feb701dbe..73905574e 100644 --- a/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js +++ b/ui/app/components/app/transaction-view-balance/transaction-view-balance.component.js @@ -53,7 +53,7 @@ export default class TransactionViewBalance extends PureComponent { value={balance} type={PRIMARY} ethNumberOfDecimals={4} - hideTitle={true} + hideTitle /> { balanceIsCached ? * : null @@ -69,7 +69,7 @@ export default class TransactionViewBalance extends PureComponent { value={balance} type={SECONDARY} ethNumberOfDecimals={4} - hideTitle={true} + hideTitle /> ) } diff --git a/ui/app/components/app/user-preferenced-currency-display/tests/user-preferenced-currency-display.component.test.js b/ui/app/components/app/user-preferenced-currency-display/tests/user-preferenced-currency-display.component.test.js index 51b2a3c4f..122115477 100644 --- a/ui/app/components/app/user-preferenced-currency-display/tests/user-preferenced-currency-display.component.test.js +++ b/ui/app/components/app/user-preferenced-currency-display/tests/user-preferenced-currency-display.component.test.js @@ -18,7 +18,7 @@ describe('UserPreferencedCurrencyDisplay Component', () => { it('should pass all props to the CurrencyDisplay child component', () => { const wrapper = shallow( diff --git a/ui/app/components/ui/currency-input/tests/currency-input.component.test.js b/ui/app/components/ui/currency-input/tests/currency-input.component.test.js index 6d4612e3c..43fa65d3a 100644 --- a/ui/app/components/ui/currency-input/tests/currency-input.component.test.js +++ b/ui/app/components/ui/currency-input/tests/currency-input.component.test.js @@ -130,7 +130,7 @@ describe('CurrencyInput Component', () => { fiatSuffix="USD" nativeSuffix="ETH" useFiat - hideFiat={true} + hideFiat nativeCurrency="ETH" currentCurrency="usd" conversionRate={231.06} diff --git a/ui/app/components/ui/metafox-logo/tests/metafox-logo.component.test.js b/ui/app/components/ui/metafox-logo/tests/metafox-logo.component.test.js index c794a004f..015416b97 100644 --- a/ui/app/components/ui/metafox-logo/tests/metafox-logo.component.test.js +++ b/ui/app/components/ui/metafox-logo/tests/metafox-logo.component.test.js @@ -16,7 +16,7 @@ describe('MetaFoxLogo', () => { it('does not set icon height and width when unsetIconHeight is true', () => { const wrapper = mount( - + ) assert.equal(wrapper.find('img.app-header__metafox-logo--icon').prop('width'), null) 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 456e6aec7..5328451e9 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 @@ -13,7 +13,7 @@ describe('Page Container Header', () => { onClose = sinon.spy() wrapper = shallow(} - hideSenderToRecipient={true} + hideSenderToRecipient customTxParamsData={customPermissionAmount ? getCustomTxParamsData(data, { customPermissionAmount, tokenAmount, decimals }) : null diff --git a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js index 0b46fe9c9..44b49d697 100644 --- a/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js +++ b/ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js @@ -261,7 +261,7 @@ export default class ConfirmTransactionBase extends Component { customGasPrice={customGas.gasPrice} customGasLimit={customGas.gasLimit} insufficientBalance={insufficientBalance} - customPriceIsSafe={true} + customPriceIsSafe isSpeedUp={false} /> : null diff --git a/ui/app/pages/create-account/create-account.component.js b/ui/app/pages/create-account/create-account.component.js index 973cb2f3e..aa05af975 100644 --- a/ui/app/pages/create-account/create-account.component.js +++ b/ui/app/pages/create-account/create-account.component.js @@ -47,17 +47,17 @@ export default class CreateAccountPage extends Component {
diff --git a/ui/app/pages/create-account/new-account.component.js b/ui/app/pages/create-account/new-account.component.js index 8f3e89f27..6dc6419b5 100644 --- a/ui/app/pages/create-account/new-account.component.js +++ b/ui/app/pages/create-account/new-account.component.js @@ -58,13 +58,13 @@ export default class NewAccountCreateForm extends Component {
diff --git a/ui/app/pages/send/account-list-item/account-list-item.component.js b/ui/app/pages/send/account-list-item/account-list-item.component.js index e6cca39b9..20ced2f09 100644 --- a/ui/app/pages/send/account-list-item/account-list-item.component.js +++ b/ui/app/pages/send/account-list-item/account-list-item.component.js @@ -83,7 +83,7 @@ export default class AccountListItem extends Component { { balanceIsCached ? * : null @@ -94,7 +94,7 @@ export default class AccountListItem extends Component { ) } 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 a770cb55e..378038f55 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 @@ -130,7 +130,7 @@ export default class SendGasRow extends Component { customGasPrice={gasPrice} customGasLimit={gasLimit} insufficientBalance={insufficientBalance} - customPriceIsSafe={true} + customPriceIsSafe isSpeedUp={false} /> { this.renderAdvancedOptionsButton() } diff --git a/ui/app/pages/send/send-content/tests/send-content-component.test.js b/ui/app/pages/send/send-content/tests/send-content-component.test.js index 479db9c18..203b9a6d4 100644 --- a/ui/app/pages/send/send-content/tests/send-content-component.test.js +++ b/ui/app/pages/send/send-content/tests/send-content-component.test.js @@ -16,7 +16,7 @@ describe('SendContent Component', function () { beforeEach(() => { wrapper = shallow( , { context: { t: str => str + '_t' } } ) diff --git a/ui/app/pages/send/send-footer/tests/send-footer-component.test.js b/ui/app/pages/send/send-footer/tests/send-footer-component.test.js index b2cf4b310..e1dd0d631 100644 --- a/ui/app/pages/send/send-footer/tests/send-footer-component.test.js +++ b/ui/app/pages/send/send-footer/tests/send-footer-component.test.js @@ -29,7 +29,7 @@ describe('SendFooter Component', function () { addToAddressBookIfNew={propsMethodSpies.addToAddressBookIfNew} amount="mockAmount" clearSend={propsMethodSpies.clearSend} - disabled={true} + disabled editingTransactionId="mockEditingTransactionId" errors={{}} from={ { address: 'mockAddress', balance: 'mockBalance' } } @@ -186,7 +186,7 @@ describe('SendFooter Component', function () { addToAddressBookIfNew={propsMethodSpies.addToAddressBookIfNew} amount="mockAmount" clearSend={propsMethodSpies.clearSend} - disabled={true} + disabled editingTransactionId="mockEditingTransactionId" errors={{}} from={ { address: 'mockAddress', balance: 'mockBalance' } } diff --git a/ui/app/pages/send/tests/send-component.test.js b/ui/app/pages/send/tests/send-component.test.js index 2676aa430..d5b43bbe4 100644 --- a/ui/app/pages/send/tests/send-component.test.js +++ b/ui/app/pages/send/tests/send-component.test.js @@ -58,7 +58,7 @@ describe('Send Component', function () { recentBlocks={['mockBlock']} selectedAddress="mockSelectedAddress" selectedToken="mockSelectedToken" - showHexData={true} + showHexData tokenBalance="mockTokenBalance" tokenContract="mockTokenContract" updateAndSetGasLimit={propsMethodSpies.updateAndSetGasLimit} diff --git a/ui/app/pages/send/to-autocomplete.component.js b/ui/app/pages/send/to-autocomplete.component.js index 252fa09c4..bb27537db 100644 --- a/ui/app/pages/send/to-autocomplete.component.js +++ b/ui/app/pages/send/to-autocomplete.component.js @@ -61,7 +61,7 @@ export default class ToAutoComplete extends Component { }} icon={this.getListItemIcon(account.address, to)} displayBalance={false} - displayAddress={true} + displayAddress /> ))}
diff --git a/ui/app/pages/settings/contact-list-tab/edit-contact/edit-contact.component.js b/ui/app/pages/settings/contact-list-tab/edit-contact/edit-contact.component.js index 218b13cdb..9373cbe6b 100644 --- a/ui/app/pages/settings/contact-list-tab/edit-contact/edit-contact.component.js +++ b/ui/app/pages/settings/contact-list-tab/edit-contact/edit-contact.component.js @@ -100,7 +100,7 @@ export default class EditContact extends PureComponent { onChange={e => this.setState({ newMemo: e.target.value })} fullWidth margin="dense" - multiline={true} + multiline rows={3} classes={{ inputMultiline: 'address-book__view-contact__text-area',