Commit graph

10 commits

Author SHA1 Message Date
Christian Fehmer
5ab7bfb438
refactor: move themes list to typescript (@fehmer) (#6489)
Co-authored-by: fehmer <3728838+fehmer@users.noreply.github.com>
2025-05-05 13:30:09 +02:00
Jack
b257a52f41
impr: add fallback and migrate to parsejsonwithschema (@miodec) (#6518)
!nuf
2025-05-03 12:14:35 +02:00
Jack
e06f7f41cf
refactor: add trycatch util (@miodec) (#6492)
Adds trycatch util to cleanup try catch code.
2025-04-26 21:24:39 +02:00
Jack
cac8835c77
chore: add oxlint (@miodec) (#6455)
Use oxlint for general linting to provide much quicker feedback. Keep
eslint for type-aware rules. Fully switch to oxlint once it supports
type-aware.
2025-04-16 17:18:50 +02:00
Jack
01dee3fe15 feat: leaderboards remake, weekly xp leaderboards (@miodec) (#6250) 2025-02-12 16:34:03 +01:00
Christian Fehmer
a2d91f2a73
refactor: better detection of ZodError (@fehmer) (#6258) 2025-02-11 20:16:09 +01:00
Christian Fehmer
12e150072b
fix: fix error handling in parseWithSchema (@fehmer) (#6229)
`instanceof ZodError` is not working if the code is packaged as a module
for unknown reason. Found while adding tests for the url-handler in
#6207.
2025-02-04 11:08:46 +01:00
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
Christian Fehmer
353fc14b4e
refactor: move parseJsonWithSchema to utils package (@fehmer) (#6109) 2024-12-22 18:04:12 +01:00
Jack
1509a675b8
refactor: move common util functions to a package (@miodec) (#5894)
Also moves esbuild to a package.
2024-09-20 11:54:14 +02:00