1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix no-eq-null issues (#9205)

See [`no-eq-null`](https://eslint.org/docs/rules/no-eq-null) for more information.

This change enables `no-eq-null` and fixes the issues raised by the rule.
This commit is contained in:
Whymarrh Whitby 2020-08-12 20:32:44 -02:30 committed by GitHub
parent f8ebfc2f63
commit 548b0bbbd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 4 deletions

View File

@ -49,6 +49,7 @@ module.exports = {
'guard-for-in': 'error',
'no-case-declarations': 'error',
'no-empty': 'error',
'no-eq-null': 'error',
'no-loop-func': 'error',
'no-useless-catch': 'error',
'no-useless-concat': 'error',

View File

@ -60,7 +60,7 @@ const AssetListItem = ({
: null
const sendTokenButton = useMemo(() => {
if (tokenAddress == null) {
if (tokenAddress === null || tokenAddress === undefined) {
return null
}
return (

View File

@ -99,7 +99,7 @@ const converter = ({
}
if (fromCurrency !== toCurrency) {
if (conversionRate == null) {
if (conversionRate === null || conversionRate === undefined) {
throw new Error(`Converting from ${fromCurrency} to ${toCurrency} requires a conversionRate, but one was not provided`)
}
let rate = toBigNumber.dec(conversionRate)

View File

@ -56,7 +56,10 @@ export const getMessage = (localeCode, localeMessages, key, substitutions) => {
return part
}
const substituteIndex = Number(subMatch[1]) - 1
if (substitutions[substituteIndex] == null && !missingSubstitutionErrors[localeCode]?.[key]) {
if (
(substitutions[substituteIndex] === null || substitutions[substituteIndex] === undefined) &&
!missingSubstitutionErrors[localeCode]?.[key]
) {
if (!missingSubstitutionErrors[localeCode]) {
missingSubstitutionErrors[localeCode] = {}
}

View File

@ -99,7 +99,7 @@ export function useTransactionDisplayData (transactionGroup) {
// 3. Deposit
// 4. Site interaction
// 5. Approval
if (transactionCategory == null) {
if (transactionCategory === null || transactionCategory === undefined) {
category = TRANSACTION_CATEGORY_SIGNATURE_REQUEST
title = t('signatureRequest')
subtitle = origin