Flagsmith / Flagsmith/flagsmith
Remove legacy ErrorMessage.js and consolidate imports
- Dominant language
- Python
- Stars
- 6.6k
- Forks
- 567
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 121
Description
## Problem
The legacy class-based `web/components/ErrorMessage.js` coexists with its modern TypeScript replacement at `web/components/messages/ErrorMessage.tsx`.
- **33 files** import from `components/ErrorMessage` (absolute path, resolves to the legacy `.js` file)
- **1 file** imports from `components/messages/ErrorMessage` (absolute path, the TS replacement)
- **5 files** use relative imports (`./ErrorMessage` or `./messages/ErrorMessage`)
Total: **39 files** referencing ErrorMessage across the codebase.
> **Note:** The equivalent `SuccessMessage.js` duplication was already resolved in PR #6873.
## Proposed Fix
**Option A (minimal diff):** Delete `ErrorMessage.js`, create `ErrorMessage.tsx` as a re-export shim:
```tsx
export { default } from 'components/messages/ErrorMessage'
```
**Option B (clean but large):** Delete `ErrorMessage.js`, update all 38 imports to `components/messages/ErrorMessage`.
The TypeScript `ErrorMessage` has the same props as the legacy version, so it is a drop-in replacement.
## Acceptance Criteria
- [ ] `web/components/ErrorMessage.js` is deleted
- [ ] All consumers resolve to the TypeScript `ErrorMessage.tsx`
- [ ] `npm run typecheck` passes
- [ ] No runtime errors when triggering error messages
---
Part of the Design System Audit (#6606) · Epic: #6882
Contributor guide
Assessment
This issue has not been assessed yet.