MetaMask / MetaMask/metamask-mobile

Limit @ts-expect-error usage to <150 instances

Open
#11,240 0 comments 0 reactions 0 assignees View on GitHub
team-mobile-platform
Dominant language
TypeScript
Stars
3k
Forks
1.7k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

### What is this about?

@ts-expect-error is a comment that is used to suppress Typescript errors. We usually use it for cases where types aren't readily available. However, there are also many areas in the app where it can be replaced with correct types. To keep our workflow flexible without the usage getting out of hand, the proposal here is to add either a pre-commit hook or CI quality gate that limits the usage of the comment to less than 150 instances. If the threshold is exceeded, devs will have to proactively fix types to pass their PR.

### Scenario

_No response_

### Design

_No response_

### Technical Details

- Add pre-commit and/or CI quality gate (fitness function) for limiting ts-expect-error usage to less than 150

### Threat Modeling Framework

_No response_

### Acceptance Criteria

- PRs should fail when ts-expect-error usage exceeds 150
- PRs should pass when ts-expect-error usage is under 150

### Stakeholder review needed before the work gets merged

- [ ] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)

### References

_No response_

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are identified in the issue. Start by locating the repository's pre-commit and CI configuration, then identify how TypeScript sources are counted; done means PRs fail above 150 @ts-expect-error instances and pass below 150.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ci-cd, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.