Skip to content

Commit aa994d2

Browse files
committedNov 7, 2024·
chore: add no-prototype-builtins ESLint rule as it became part of recommended in ESLint9
1 parent 5e33e3a commit aa994d2

File tree

6 files changed

+18
-8
lines changed

6 files changed

+18
-8
lines changed
 

‎.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ module.exports = {
6363
'no-irregular-whitespace': 'error',
6464
'no-constant-binary-expression': 'error',
6565
'no-empty': 'error',
66+
'no-prototype-builtins': 'error',
6667
'@typescript-eslint/no-empty-object-type': 'off',
6768
'@typescript-eslint/no-require-imports': 'off',
6869
'@typescript-eslint/prefer-ts-expect-error': 'error',

‎packages/suite/src/components/wallet/WalletLayout/AccountsMenu/AccountsList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const AccountsList = ({ onItemClick }: AccountListProps) => {
4949
searchString || coinFilter
5050
? list.filter(account => {
5151
const { key, accountType, symbol, index } = account;
52-
const accountLabel = accountLabels.hasOwnProperty(key)
52+
const accountLabel = Object.prototype.hasOwnProperty.call(accountLabels, key)
5353
? accountLabels[key]
5454
: getDefaultAccountLabel({ accountType, symbol, index });
5555

‎suite-common/suite-utils/src/comparison.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ export const isChanged = (prev?: any, current?: any, filter?: { [k: string]: str
3030
for (let i = 0; i < currentKeys.length; i++) {
3131
const key = currentKeys[i];
3232

33-
if (filter && filter.hasOwnProperty(key) && prev[key] && current[key]) {
33+
if (
34+
filter &&
35+
Object.prototype.hasOwnProperty.call(filter, key) &&
36+
prev[key] &&
37+
current[key]
38+
) {
3439
const prevFiltered = {};
3540
const currentFiltered = {};
3641
for (let i2 = 0; i2 < filter[key].length; i2++) {

‎suite-common/wallet-config/src/utils.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const getNetworkFeatures = (symbol: NetworkSymbol): NetworkFeature[] =>
5151
export const getCoingeckoId = (symbol: NetworkSymbol) => networks[symbol].coingeckoId;
5252

5353
export const isNetworkSymbol = (symbol: NetworkSymbol | string): symbol is NetworkSymbol =>
54-
networks.hasOwnProperty(symbol);
54+
Object.prototype.hasOwnProperty.call(networks, symbol);
5555

5656
/**
5757
* Get network object by symbol as a generic `Network` type.
@@ -67,7 +67,8 @@ export const isAccountOfNetwork = (
6767
network: Network,
6868
accountType: string,
6969
): accountType is AccountType =>
70-
network.accountTypes.hasOwnProperty(accountType) || accountType === 'normal';
70+
Object.prototype.hasOwnProperty.call(network.accountTypes, accountType) ||
71+
accountType === 'normal';
7172

7273
export const getNetworkByCoingeckoId = (coingeckoId: string) =>
7374
networksCollection.find(n => n.coingeckoId === coingeckoId);

‎suite-common/wallet-utils/src/fiatRatesUtils.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,17 @@ const combineFiatRates = (fiatRates: RatesByTimestamps, accountRates: RatesByTim
4747
for (const fiatRate in accountRates) {
4848
const fiatRateKey = fiatRate as FiatRateKey;
4949

50-
if (accountRates.hasOwnProperty(fiatRateKey)) {
50+
if (Object.prototype.hasOwnProperty.call(accountRates, fiatRateKey)) {
5151
if (!fiatRates[fiatRateKey]) {
5252
fiatRates[fiatRateKey] = accountRates[fiatRateKey];
5353
} else {
5454
for (const timestampRate in accountRates[fiatRateKey]) {
5555
const timestamp = timestampRate as unknown as Timestamp;
5656
if (
57-
accountRates[fiatRateKey].hasOwnProperty(timestamp) &&
57+
Object.prototype.hasOwnProperty.call(
58+
accountRates[fiatRateKey],
59+
timestamp,
60+
) &&
5861
!fiatRates[fiatRateKey][timestamp]
5962
) {
6063
fiatRates[fiatRateKey][timestamp] = accountRates[fiatRateKey][timestamp];
@@ -70,7 +73,7 @@ export const buildHistoricRatesFromStorage = (storageHistoricRates: RatesByTimes
7073

7174
storageHistoricRates.forEach(fiatRates => {
7275
for (const fiatRate in fiatRates) {
73-
if (fiatRates.hasOwnProperty(fiatRate)) {
76+
if (Object.prototype.hasOwnProperty.call(fiatRates, fiatRate)) {
7477
const fiatRateKey = fiatRate as FiatRateKey;
7578

7679
if (!historicFiatRates[fiatRateKey]) {

‎suite-native/module-connect-popup/src/hooks/useConnectParseParams.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const useConnectParseParams = (url: ParsedURL): UseConnectParseParamsType
3131
typeof queryParams?.params !== 'string' ||
3232
typeof queryParams?.method !== 'string' ||
3333
typeof queryParams?.callback !== 'string' ||
34-
!TrezorConnect.hasOwnProperty(queryParams?.method)
34+
!Object.prototype.hasOwnProperty.call(TrezorConnect, queryParams?.method)
3535
) {
3636
return { parseParamsError: TypedError('Method_InvalidParameter') };
3737
}

0 commit comments

Comments
 (0)
Please sign in to comment.