mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #7573 from whymarrh/eslint-no-confusing-arrow
Enable no-confusing-arrow rule for ESLint
This commit is contained in:
commit
6aa0bec751
@ -72,6 +72,7 @@
|
||||
"no-caller": 2,
|
||||
"no-class-assign": 2,
|
||||
"no-cond-assign": 2,
|
||||
"no-confusing-arrow": 2,
|
||||
"no-const-assign": 2,
|
||||
"no-control-regex": 2,
|
||||
"no-debugger": 2,
|
||||
|
@ -17,8 +17,8 @@ module.exports = {
|
||||
|
||||
// functions that handle normalizing of that key in txParams
|
||||
const normalizers = {
|
||||
from: (from, LowerCase = true) => LowerCase ? addHexPrefix(from).toLowerCase() : addHexPrefix(from),
|
||||
to: (to, LowerCase = true) => LowerCase ? addHexPrefix(to).toLowerCase() : addHexPrefix(to),
|
||||
from: (from, LowerCase = true) => (LowerCase ? addHexPrefix(from).toLowerCase() : addHexPrefix(from)),
|
||||
to: (to, LowerCase = true) => (LowerCase ? addHexPrefix(to).toLowerCase() : addHexPrefix(to)),
|
||||
nonce: nonce => addHexPrefix(nonce),
|
||||
value: value => addHexPrefix(value),
|
||||
data: data => addHexPrefix(data),
|
||||
|
@ -30,7 +30,7 @@ describe('#createPendingNonceMiddleware', function () {
|
||||
|
||||
describe('#createPendingTxMiddleware', function () {
|
||||
let returnUndefined = true
|
||||
const getPendingTransactionByHash = () => returnUndefined ? undefined : txMetaStub
|
||||
const getPendingTransactionByHash = () => (returnUndefined ? undefined : txMetaStub)
|
||||
const address = '0xF231D46dD78806E1DD93442cf33C7671f8538748'
|
||||
const pendingTxMiddleware = createPendingTxMiddleware({ getPendingTransactionByHash })
|
||||
const spec = {
|
||||
|
@ -141,7 +141,7 @@ describe('GasModalPageContainer Component', function () {
|
||||
fetchBasicGasAndTimeEstimates={propsMethodSpies.fetchBasicGasAndTimeEstimates}
|
||||
fetchGasEstimates={propsMethodSpies.fetchGasEstimates}
|
||||
/>
|
||||
), { context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } })
|
||||
), { context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } })
|
||||
const { tabsComponent } = renderTabsWrapperTester.find(PageContainer).props()
|
||||
assert.equal(tabsComponent, 'mockTabs')
|
||||
GasModalPageContainer.prototype.renderTabs.restore()
|
||||
|
@ -44,7 +44,7 @@ describe('TransactionActivityLog Component', () => {
|
||||
onRetry={() => {}}
|
||||
primaryTransactionStatus="confirmed"
|
||||
/>,
|
||||
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
|
||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper.hasClass('transaction-activity-log'))
|
||||
@ -92,7 +92,7 @@ describe('TransactionActivityLog Component', () => {
|
||||
primaryTransactionStatus="pending"
|
||||
isEarliestNonce
|
||||
/>,
|
||||
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
|
||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper.hasClass('transaction-activity-log'))
|
||||
@ -141,7 +141,7 @@ describe('TransactionActivityLog Component', () => {
|
||||
primaryTransactionStatus="pending"
|
||||
isEarliestNonce={false}
|
||||
/>,
|
||||
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
|
||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper.hasClass('transaction-activity-log'))
|
||||
|
@ -24,7 +24,7 @@ describe('TransactionBreakdown Component', () => {
|
||||
transaction={transaction}
|
||||
className="test-class"
|
||||
/>,
|
||||
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
|
||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper.hasClass('transaction-breakdown'))
|
||||
|
@ -13,7 +13,7 @@ describe('TransactionBreakdownRow Component', () => {
|
||||
>
|
||||
Test
|
||||
</TransactionBreakdownRow>,
|
||||
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
|
||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper.hasClass('transaction-breakdown-row'))
|
||||
@ -29,7 +29,7 @@ describe('TransactionBreakdownRow Component', () => {
|
||||
>
|
||||
<Button onClick={() => {}} >Button</Button>
|
||||
</TransactionBreakdownRow>,
|
||||
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
|
||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper.hasClass('transaction-breakdown-row'))
|
||||
|
@ -33,7 +33,7 @@ describe('TransactionListItemDetails Component', () => {
|
||||
<TransactionListItemDetails
|
||||
transactionGroup={transactionGroup}
|
||||
/>,
|
||||
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
|
||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper.hasClass('transaction-list-item-details'))
|
||||
@ -72,7 +72,7 @@ describe('TransactionListItemDetails Component', () => {
|
||||
transactionGroup={transactionGroup}
|
||||
showSpeedUp
|
||||
/>,
|
||||
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
|
||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper.hasClass('transaction-list-item-details'))
|
||||
@ -104,7 +104,7 @@ describe('TransactionListItemDetails Component', () => {
|
||||
<TransactionListItemDetails
|
||||
transactionGroup={transactionGroup}
|
||||
/>,
|
||||
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
|
||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper.hasClass('transaction-list-item-details'))
|
||||
@ -139,7 +139,7 @@ describe('TransactionListItemDetails Component', () => {
|
||||
<TransactionListItemDetails
|
||||
transactionGroup={transactionGroup}
|
||||
/>,
|
||||
{ context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } }
|
||||
{ context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } }
|
||||
)
|
||||
|
||||
assert.ok(wrapper.hasClass('transaction-list-item-details'))
|
||||
|
@ -15,7 +15,7 @@ const historySpies = {
|
||||
push: sinon.spy(),
|
||||
}
|
||||
|
||||
const t = (str1, str2) => str2 ? str1 + str2 : str1
|
||||
const t = (str1, str2) => (str2 ? str1 + str2 : str1)
|
||||
const metricsEvent = () => ({})
|
||||
|
||||
describe('TransactionViewBalance Component', () => {
|
||||
|
@ -353,7 +353,7 @@ function quartiles (data) {
|
||||
}
|
||||
|
||||
function inliersByIQR (data, prop) {
|
||||
const { lowerQuartile, upperQuartile } = quartiles(data.map(d => prop ? d[prop] : d))
|
||||
const { lowerQuartile, upperQuartile } = quartiles(data.map(d => (prop ? d[prop] : d)))
|
||||
const IQR = upperQuartile - lowerQuartile
|
||||
const lowerBound = lowerQuartile - 1.5 * IQR
|
||||
const upperBound = upperQuartile + 1.5 * IQR
|
||||
|
@ -40,10 +40,10 @@ const casedContractMap = Object.keys(contractMap).reduce((acc, base) => {
|
||||
}, {})
|
||||
|
||||
let customNonceValue = ''
|
||||
const customNonceMerge = txData => customNonceValue ? ({
|
||||
const customNonceMerge = txData => (customNonceValue ? ({
|
||||
...txData,
|
||||
customNonceValue,
|
||||
}) : txData
|
||||
}) : txData)
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const { toAddress: propsToAddress, customTxParamsData, match: { params = {} } } = ownProps
|
||||
|
@ -26,7 +26,7 @@ describe('SendHeader Component', function () {
|
||||
history={historySpies}
|
||||
titleKey="mockTitleKey"
|
||||
/>
|
||||
), { context: { t: (str1, str2) => str2 ? str1 + str2 : str1 } })
|
||||
), { context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) } })
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -331,7 +331,7 @@ function estimateGasPriceFromRecentBlocks (recentBlocks) {
|
||||
return parseInt(next, 16) < parseInt(currentLowest, 16) ? next : currentLowest
|
||||
})
|
||||
})
|
||||
.sort((a, b) => parseInt(a, 16) > parseInt(b, 16) ? 1 : -1)
|
||||
.sort((a, b) => (parseInt(a, 16) > parseInt(b, 16) ? 1 : -1))
|
||||
|
||||
return lowestPrices[Math.floor(lowestPrices.length / 2)]
|
||||
}
|
||||
|
@ -2,6 +2,6 @@ import { shallow } from 'enzyme'
|
||||
|
||||
export default function (jsxComponent) {
|
||||
return shallow(jsxComponent, {
|
||||
context: { t: (str1, str2) => str2 ? str1 + str2 : str1 },
|
||||
context: { t: (str1, str2) => (str2 ? str1 + str2 : str1) },
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user