-
Notifications
You must be signed in to change notification settings - Fork 4
Enable type aware linting #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables type-aware linting with oxlint using TypeScript-ESLint rules. The primary focus is on creating Zod schemas for PocketBase API responses to ensure type safety and automatic validation, while also making necessary adjustments to comply with the stricter linting rules.
- Replaced interfaces with Zod schemas for all PocketBase types to enable validation
- Added type-aware linting configuration with oxlint and disabled specific rules for test files
- Removed generic type parameters from functions to simplify the type system
Reviewed Changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
src/types/pocketbase-schema.type.ts |
Converted interfaces to Zod schemas with strict field type validation |
src/types/pocketbase-entry.type.ts |
Replaced interface with Zod schema using passthrough for additional fields |
src/types/pocketbase-api-response.type.ts |
Added new Zod schemas for PocketBase API responses (error, list, login) |
src/utils/get-superuser-token.ts |
Added response parsing with Zod schemas |
src/schema/get-remote-schema.ts |
Added response validation using Zod schemas |
src/loader/fetch-*.ts |
Removed generic type parameters and added response validation |
src/loader/cleanup-entries.ts |
Added response validation and improved type safety |
package.json |
Added oxlint-tsgolint dependency and type-aware flags |
.oxlintrc.json |
Added type-aware linting rules and disabled unsafe TypeScript rules for tests |
f1554cc
to
8e06367
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-review done ✔️
Warning
Not ready to merge yet. oxc VsCode extension does not yet handle ignoring linter warnings.
Changes
Summary:
This PR enables type-aware linting rules with oxlint using
tsgolint
. In addition there were a few adjustments needed to comply with our strict ruleset. This mainly boiled down to create zod schemas for every PocketBase API response, which automatically parses and validates the responses to be typesafe in addition to providing types for these responses.Issues
Testing
Code Quality
Documentation is updated if neededBreaking Changes
Are there any breaking changes?
Migration notes:
Should not be breaking, every existing test still works as expected. Though I'll test this in my own repository and leave it on
next
for other developers to beta-test these changes.