MetaMask / MetaMask/eslint-config

Enforce usage of `@ts-expect-error` over `@ts-ignore`

Open
#280 0 comments 0 reactions 0 assignees View on GitHub
team-wallet-framework
Dominant language
JavaScript
Stars
12
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Occasionally it is useful when converting a codebase to TypeScript to allow TypeScript errors, such as in [this case for `eth-ledger-bridge-keyring`](https://github.com/MetaMask/eth-ledger-bridge-keyring/pull/174/files#diff-d2f48c5e8947f0b6f3613eb10f2311f922a9dc3662ddc55001639dd4aa5b9722R614). The default configuration for the [`ban-ts-comment`](https://typescript-eslint.io/rules/ban-ts-comment) rule bans `@ts-ignore` and allows `@ts-expect-error` with a description. There's nothing wrong with this; however, I am not sure how many people know about this tag. I've seen people try to use `@ts-ignore` and then get around the lint violation by pairing it with an `eslint-disable` comment. While we can't prevent this, I think we can make the lint violation error more useful. I propose that we enable the [`prefer-ts-expect-error`](https://typescript-eslint.io/rules/prefer-ts-expect-error) rule.

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the shared ESLint configuration and identify where the TypeScript rules are enabled. Enable prefer-ts-expect-error, then verify that the lint output guides users from @ts-ignore toward @ts-expect-error and that the existing configuration checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, typescript
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.