1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Merge pull request #7573 from whymarrh/eslint-no-confusing-arrow

Enable no-confusing-arrow rule for ESLint
This commit is contained in:
Dan Finlay 2019-12-04 10:23:57 -08:00 committed by GitHub
commit 6aa0bec751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 22 additions and 21 deletions

View File

@ -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,

View File

@ -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),

View File

@ -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 = {

View File

@ -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()

View File

@ -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'))

View File

@ -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'))

View File

@ -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'))

View File

@ -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'))

View File

@ -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', () => {

View File

@ -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

View File

@ -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

View File

@ -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(() => {

View File

@ -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)]
}

View File

@ -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) },
})
}