Add `react/no-unused-prop-types` ESLint rule (#7655)
* Add `react/no-unused-prop-types` rule All detected unused prop types have been removed. I have attempted to ensure these props are no longer passed in either. * Update handling of props to avoid false positive lint errors These cases were detected by `react/no-unused-prop-types` as being unused props, even though they were used. These minor adjustments prevent them from being flagged as errors. * Update unit tests Many of these tests were just checking that specific props were passed from containers or to a child component. These were deleted, as I can't imagine how they'd be useful. * Disable `react/no-unused-prop-types` in `componentWillReceiveProps The rule `react/no-unused-prop-types` doesn't seem to be detecting props used within `UNSAFE_componentWillReceiveProps`. The two cases have been disabled temporarily until we can replace these unsafe lifecycle functions.feature/default_network_editable
parent
265d253f09
commit
49a525b9f8
@ -1,20 +0,0 @@ |
||||
import assert from 'assert' |
||||
import { mapDispatchToProps } from '../confirm-transaction-base.container' |
||||
|
||||
describe('Confirm Transaction Base Container', () => { |
||||
it('should map dispatch to props correctly', () => { |
||||
const props = mapDispatchToProps(() => 'mockDispatch') |
||||
|
||||
assert.ok(typeof props.updateCustomNonce === 'function') |
||||
assert.ok(typeof props.clearConfirmTransaction === 'function') |
||||
assert.ok(typeof props.clearSend === 'function') |
||||
assert.ok(typeof props.showTransactionConfirmedModal === 'function') |
||||
assert.ok(typeof props.showCustomizeGasModal === 'function') |
||||
assert.ok(typeof props.updateGasAndCalculate === 'function') |
||||
assert.ok(typeof props.showRejectTransactionsConfirmationModal === 'function') |
||||
assert.ok(typeof props.cancelTransaction === 'function') |
||||
assert.ok(typeof props.cancelAllTransactions === 'function') |
||||
assert.ok(typeof props.sendTransaction === 'function') |
||||
assert.ok(typeof props.setMetaMetricsSendCount === 'function') |
||||
}) |
||||
}) |
@ -1,53 +0,0 @@ |
||||
import assert from 'assert' |
||||
import { mapStateToProps, mapDispatchToProps } from '../advanced-tab.container' |
||||
|
||||
const defaultState = { |
||||
appState: { |
||||
warning: null, |
||||
}, |
||||
metamask: { |
||||
featureFlags: { |
||||
sendHexData: false, |
||||
advancedInlineGas: false, |
||||
}, |
||||
preferences: { |
||||
autoLogoutTimeLimit: 0, |
||||
showFiatInTestnets: false, |
||||
useNativeCurrencyAsPrimaryCurrency: true, |
||||
}, |
||||
threeBoxSyncingAllowed: false, |
||||
threeBoxDisabled: false, |
||||
useNonceField: false, |
||||
}, |
||||
} |
||||
|
||||
describe('AdvancedTab Container', () => { |
||||
it('should map state to props correctly', () => { |
||||
const props = mapStateToProps(defaultState) |
||||
const expected = { |
||||
warning: null, |
||||
sendHexData: false, |
||||
advancedInlineGas: false, |
||||
showFiatInTestnets: false, |
||||
autoLogoutTimeLimit: 0, |
||||
threeBoxSyncingAllowed: false, |
||||
threeBoxDisabled: false, |
||||
useNonceField: false, |
||||
} |
||||
|
||||
assert.deepEqual(props, expected) |
||||
}) |
||||
|
||||
it('should map dispatch to props correctly', () => { |
||||
const props = mapDispatchToProps(() => 'mockDispatch') |
||||
|
||||
assert.ok(typeof props.setHexDataFeatureFlag === 'function') |
||||
assert.ok(typeof props.setRpcTarget === 'function') |
||||
assert.ok(typeof props.displayWarning === 'function') |
||||
assert.ok(typeof props.showResetAccountConfirmationModal === 'function') |
||||
assert.ok(typeof props.setAdvancedInlineGasFeatureFlag === 'function') |
||||
assert.ok(typeof props.setShowFiatConversionOnTestnetsPreference === 'function') |
||||
assert.ok(typeof props.setAutoLogoutTimeLimit === 'function') |
||||
assert.ok(typeof props.setUseNonceField === 'function') |
||||
}) |
||||
}) |
Loading…
Reference in new issue