monkeytype/packages
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
..
contracts chore: bump eslint version 2025-01-21 11:50:09 +01:00
esbuild-config chore: bump eslint version 2025-01-21 11:50:09 +01:00
eslint-config refactor: enable no-unsafe-member-access (@miodec) (#5887) 2024-09-18 12:56:52 +02:00
funbox chore: bump eslint version 2025-01-21 11:50:09 +01:00
release chore: bump eslint version 2025-01-21 11:50:09 +01:00
typescript-config refactor: restructure project to a true monorepo (#5626) 2024-07-22 15:08:11 +02:00
util refactor: replace JSON.parse with parseJsonWithSchema (@dev-mohit06) (#6207) 2025-02-03 23:45:57 +01:00