diff --git a/scripts/build.copy-workers.mjs b/scripts/build.copy-workers.mjs index 22be97875..51bd3cd7c 100644 --- a/scripts/build.copy-workers.mjs +++ b/scripts/build.copy-workers.mjs @@ -9,6 +9,8 @@ await cp( filter: (source) => extname(source) !== '.map' }, (err) => { + // TODO: Remove ESLint exception and use nullish checks + // eslint-disable-next-line local-rules/use-nullish-checks if (err === null) { return; } diff --git a/scripts/build.tokens.ckerc20.mjs b/scripts/build.tokens.ckerc20.mjs index 6cc73f8c0..71d54291f 100755 --- a/scripts/build.tokens.ckerc20.mjs +++ b/scripts/build.tokens.ckerc20.mjs @@ -4,7 +4,7 @@ import { AnonymousIdentity } from '@dfinity/agent'; import { CkETHOrchestratorCanister } from '@dfinity/cketh'; import { IcrcLedgerCanister } from '@dfinity/ledger-icrc'; import { Principal } from '@dfinity/principal'; -import { createAgent, fromNullable, isNullish, jsonReplacer } from '@dfinity/utils'; +import { createAgent, fromNullable, isNullish, jsonReplacer, nonNullish } from '@dfinity/utils'; import { existsSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; @@ -74,7 +74,7 @@ const buildOrchestratorInfo = async (orchestratorId) => { const assertUniqueTokenSymbol = Object.values(tokens).find((value) => value.length > 1); - if (assertUniqueTokenSymbol !== undefined) { + if (nonNullish(assertUniqueTokenSymbol)) { throw new Error( `More than one pair of ledger and index canisters were used for the token symbol ${assertUniqueTokenSymbol}.` ); diff --git a/src/frontend/src/icp-eth/services/cketh.services.ts b/src/frontend/src/icp-eth/services/cketh.services.ts index 0e04a7e88..2568f56c3 100644 --- a/src/frontend/src/icp-eth/services/cketh.services.ts +++ b/src/frontend/src/icp-eth/services/cketh.services.ts @@ -23,6 +23,7 @@ export const loadCkEthMinterInfo = async ({ const minterInfoInStore = get(ckEthMinterInfoStore); // We try to load only once per session the helpers (ckETH and ckErc20) contract addresses + // eslint-disable-next-line local-rules/use-nullish-checks -- We want to check for not-undefined values but null is allowed if (minterInfoInStore?.[tokenId] !== undefined) { return; } diff --git a/src/frontend/src/lib/utils/route.utils.ts b/src/frontend/src/lib/utils/route.utils.ts index d52b3ae57..769e37242 100644 --- a/src/frontend/src/lib/utils/route.utils.ts +++ b/src/frontend/src/lib/utils/route.utils.ts @@ -1,3 +1,5 @@ +import { nonNullish } from '@dfinity/utils'; + /** * Update browser URL. To be use only for really particular use case that do not include navigation and loading data. */ @@ -15,6 +17,6 @@ export const replaceHistory = (url: URL) => { * Source: https://stackoverflow.com/a/6825002/5404186 */ const supportsHistory = (): boolean => - window.history !== undefined && + nonNullish(window.history) && 'pushState' in window.history && typeof window.history.pushState !== 'undefined';