Skip to content

Commit c431947

Browse files
committed
Revert "fix: remove @typescript-eslint/no-redundant-type-constituents directives (#407)"
This reverts commit 6133e50.
1 parent c0c3613 commit c431947

11 files changed

Lines changed: 24 additions & 7 deletions

File tree

jest.config.packages.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ module.exports = {
8888
moduleNameMapper: {
8989
'^@metamask/(.+)$': [
9090
'<rootDir>/../$1/src',
91-
// While still unclear why, adding the line below seems to fix the @typescript-eslint/no-redundant-type-constituents errors throughout the monorepo
92-
'<rootDir>/packages/$1/src',
9391
// Some @metamask/* packages we are referencing aren't in this monorepo,
9492
// so in that case use their published versions
9593
'<rootDir>/../../node_modules/@metamask/$1',

packages/keyring-api/src/api/keyring.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
2+
// This rule seems to be triggering a false positive on the `KeyringAccount`.
3+
14
import type { AccountId, JsonRpcRequest } from '@metamask/keyring-utils';
25
import type { Json } from '@metamask/utils';
36

packages/keyring-api/src/api/v2/wrapper/keyring-account-registry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export class KeyringAccountRegistry<
2222
* @param accountId - The account ID to look up.
2323
* @returns The KeyringAccount, or undefined if not found.
2424
*/
25+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
2526
get(accountId: AccountId): KeyringAccountType | undefined {
2627
return this.#accountById.get(accountId);
2728
}
@@ -42,6 +43,7 @@ export class KeyringAccountRegistry<
4243
* @param address - The address to look up.
4344
* @returns The account ID, or undefined if not found.
4445
*/
46+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
4547
getAccountId(address: string): AccountId | undefined {
4648
return this.#idByAddress.get(address);
4749
}

packages/keyring-api/src/events.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
2+
// FIXME: This rule seems to be triggering a false positive on the `KeyringEvents`.
3+
14
import {
25
exactOptional,
36
object,

packages/keyring-internal-api/src/eth/EthKeyring.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
2+
13
import type {
24
KeyringExecutionContext,
35
EthBaseTransaction,

packages/keyring-internal-api/src/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
2+
/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */
3+
// FIXME: Those rules seem to be triggering a false positive on the `InternalAccountStructs`
4+
// and `InternalAccountTypes`.
5+
16
import {
27
BtcAccountType,
38
EthAccountType,

packages/keyring-snap-bridge/src/SnapKeyring.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */
2+
// This rule seems to be triggering a false positive. Possibly eslint is not
3+
// inferring the `EthMethod`, `BtcMethod`, and `InternalAccount` types correctly.
4+
15
import type { TypedTransaction } from '@ethereumjs/tx';
26
import { TransactionFactory } from '@ethereumjs/tx';
37
import type { TypedDataV1, TypedMessage } from '@metamask/eth-sig-util';

packages/keyring-snap-bridge/src/account.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ export function assertKeyringAccount<
9191
* @returns A valid transformed `KeyringAccount`.
9292
*/
9393
export function transformAccount(
94+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
9495
accountToTransform: KeyringAccountV1 | KeyringAccount,
9596
): KeyringAccount {
9697
// To keep the retro-compatibility with older keyring-api versions, we identify the account's

packages/keyring-snap-bridge/src/migrations/v1.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
* @returns True if the account is v1, false otherwise.
2626
*/
2727
export function isAccountV1(
28+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
2829
account: KeyringAccountV1 | KeyringAccount,
2930
): boolean {
3031
return is(account, KeyringAccountV1Struct);

packages/keyring-snap-client/src/KeyringClient.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ export class KeyringClient implements Keyring {
157157
async resolveAccountAddress(
158158
scope: CaipChainId,
159159
request: JsonRpcRequest,
160+
// FIXME: eslint is complaning about `ResolvedAccountAddress` being `any`, so disable this for now:
161+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
160162
): Promise<ResolvedAccountAddress | null> {
161163
return strictMask(
162164
await this.send({

0 commit comments

Comments
 (0)