MetaMask / MetaMask/metamask-extension
[P2] selectors: extract shield + onboarding toggle selectors
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
**Parent Epic:** [#44566 — `selectors.js` decomposition](https://github.com/MetaMask/metamask-extension/issues/44566)
**Source:** `ui/selectors/selectors.js`
**Size:** S
---
## Problem
Shield entry-modal cluster (6: `getShowShieldEntryModal`, `getPendingShieldCohort*`, `getModalTypeForShieldEntryModal`, …) and onboarding toggles (3: `getExternalServicesOnboardingToggleState`, `getBackupAndSyncOnboardingToggleState`, `getIsMultiRpcOnboarding`).
## Solution
Fold shield selectors into the existing `ui/selectors/shield/` and onboarding into `ui/selectors/onboarding/` (extend existing dirs — avoid micro-modules).
Migration seam (no barrel): repoint every site importing the moved selectors to `ui/selectors/` directly (a `ts-morph` codemod that splits any `../selectors` barrel imports into per-module imports) and delete them from `selectors.js` in the same PR — no re-export facade, per the no-barrel-files convention.
## Acceptance Criteria
- [ ] Shield/onboarding selectors moved into their existing modules; imports repointed directly to the module (no barrel). Tests green.
Contributor guide
Research direction
Start in ui/selectors/selectors.js and inspect the existing ui/selectors/shield/ and ui/selectors/onboarding/ modules. Search for imports of the listed selectors, then review the ts-morph codemod approach for splitting barrel imports. Done means the selectors live in the existing domain modules, all imports point directly to them, selectors.js no longer contains them, and tests are green.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, tooling
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100