monkeytype/frontend
Mohit Paddhariya 3510ea9760
refactor: replace JSON.parse with parseJsonWithSchema (@dev-mohit06) (#6207)
## Description
Replaces raw JSON parsing with schema-based validation across frontend
TypeScript files to improve type safety and error handling.

### Scope of Changes
- Updated JSON parsing in:
  - `account.ts`
  - `import-export-settings.ts`
  - `analytics-controller.ts`
  - `local-storage-with-schema.ts`
  - `url-handler.ts`
  - `commandline/lists.ts`
  - `test/wikipedia.ts`

- Added schema in `test/custom-text.ts`:
  ```typescript
  export const customTextDataSchema = z.object({
    text: z.array(z.string()),
    mode: CustomTextModeSchema,
    limit: z.object({ 
      value: z.number(), 
      mode: CustomTextLimitModeSchema 
    }),
    pipeDelimiter: z.boolean(),
  });
  ```

### Benefits
- Enhanced runtime type safety
- More robust error handling
- Consistent JSON parsing approach

### Checks
- [x] Follows Conventional Commits
- [x] Includes GitHub username
- [ ] Adding quotes? (N/A)
- [ ] Adding language/theme? (N/A)

---------

Co-authored-by: Miodec <jack@monkeytype.com>
2025-02-03 23:45:57 +01:00
..
__tests__ test: fix tests being broken in 2025 2025-01-02 14:29:38 +01:00
docker
scripts refactor: move funboxes to a shared package (@miodec) (#6063) 2024-12-04 16:11:07 +01:00
src refactor: replace JSON.parse with parseJsonWithSchema (@dev-mohit06) (#6207) 2025-02-03 23:45:57 +01:00
static feat(layout): add focal (@rbscholtus) (#6196) 2025-02-03 15:06:40 +01:00
.eslintrc.cjs
.firebaserc_example
firebase.json
gulpfile.js
knip.json
package.json chore: upgrade to vite 6 (@miodec) (#6214) 2025-01-27 14:16:57 +01:00
tsconfig.json refactor: remove global type namespaces (@miodec) (#5907) 2024-09-23 15:34:16 +02:00
vite.config.dev.js
vite.config.js
vite.config.prod.js fix: offline mode not working 2025-01-15 00:06:58 +01:00
vitest.config.js refactor: move funboxes to a shared package (@miodec) (#6063) 2024-12-04 16:11:07 +01:00