MetaMask / MetaMask/metamask-extension

Replace deprecated constants with enums

Open Beginner friendly
#18,714 20 comments 0 reactions 0 assignees View on GitHub
good first issue team-design-system
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

### Description
We are currently in the process of migrating to TypeScript. To help reduce tech debt and move the needle closer to a type strict extension it would be great to replace the deprecated design system constant instances with their enum equivalent for all components.

This is a massive undertaking by itself and creating a single PR would be too large. Smaller PRs can be submitted against this issue to ensure easier review and gradual improvements. **A PR can be as small as 1 file or as large as 3.**

#### Deprecated consts and their enum replacements

- `DISPLAY` => `Display`
- `FLEX_DIRECTION` => `FlexDirection`
- `FLEX_WRAP` => `FlexWrap`
- `BLOCK_SIZES` => `BlockSize`
- `SEVERITIES` => `Severity`
- `TEXT_ALIGN` => `TextAlign`
- `TEXT_TRANSFORM` => `TextTransform`
- `FONT_WEIGHT` => `FontWeight`
- `OVERFLOW_WRAP` => `OverflowWrap`
- `FONT_STYLE` => `FontStyle`

An example of this would be to swap

```jsx
import {
TEXT_ALIGN,
DISPLAY,
FLEX_DIRECTION,
FLEX_WRAP,
} from '../../../helpers/constants/design-system';

```

with

```jsx
import {
TextAlign,
Display,
FlexDirection,
FlexWrap,
} from '../../../helpers/constants/design-system';

```

### Technical Details
- Replace constants with their enum equivalent

### Acceptance Criteria
- PRs contain no more than **3 files** this will ensure the PR is easy to review and merged sooner
- Before / After screenshots of the UI to show no visual regressions
- CI tests for jest, linting, and e2e pass

### Difficulty: Beginner

Good first issue for: External contributors who are familiar with running the extension locally, have knowledge of Jest tests, linting, and are proficient at searching a code base.

Contributor guide

Open the contributing guide

Research direction

Start by searching component files for imports and usages of the deprecated constants from helpers/constants/design-system. Replace usages with the listed enum names and values, keeping the change within three files. Capture before and after UI screenshots, then run the relevant Jest, linting, and end-to-end checks to confirm completion.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.