Skip to content

Commit 088c41a

Browse files
authored
chore: upgrade eslint (#36)
1 parent 3a84a35 commit 088c41a

File tree

159 files changed

+7906
-13175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+7906
-13175
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"tabWidth": 4,
3+
"useTabs": false,
4+
"printWidth": 120,
5+
"singleQuote": true
6+
}

NEW-FEATURES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
- Cross-field comparison (for read and mutations)
2-
- Computed fields
1+
- Cross-field comparison (for read and mutations)
2+
- Computed fields

README.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424

2525
ZenStack is a TypeScript database toolkit for developing full-stack or backend Node.js/Bun applications. It provides a unified data modeling and access solution with the following features:
2626

27-
- A modern schema-first ORM that's compatible with [Prisma](https://github.com/prisma/prisma)'s schema and API
28-
- Versatile data access APIs: high-level (Prisma-style) ORM queries + low-level ([Kysely](https://github.com/kysely-org/kysely)) query builder
29-
- Built-in access control and data validation
30-
- Advanced data modeling patterns like [polymorphism](https://zenstack.dev/blog/polymorphism)
31-
- Designed for extensibility and flexibility: plugins, life-cycle hooks, etc.
32-
- Automatic CRUD web APIs with adapters for popular frameworks
33-
- Automatic [TanStack Query](https://github.com/TanStack/query) hooks for easy CRUD from the frontend
27+
- A modern schema-first ORM that's compatible with [Prisma](https://github.com/prisma/prisma)'s schema and API
28+
- Versatile data access APIs: high-level (Prisma-style) ORM queries + low-level ([Kysely](https://github.com/kysely-org/kysely)) query builder
29+
- Built-in access control and data validation
30+
- Advanced data modeling patterns like [polymorphism](https://zenstack.dev/blog/polymorphism)
31+
- Designed for extensibility and flexibility: plugins, life-cycle hooks, etc.
32+
- Automatic CRUD web APIs with adapters for popular frameworks
33+
- Automatic [TanStack Query](https://github.com/TanStack/query) hooks for easy CRUD from the frontend
3434

3535
# What's new with V3
3636

@@ -83,10 +83,10 @@ Then create a `zenstack` folder and a `schema.zmodel` file in it.
8383

8484
ZenStack uses a DSL named ZModel to model different aspects of database:
8585

86-
- Tables and fields
87-
- Validation rules (coming soon)
88-
- Access control policies (coming soon)
89-
- ...
86+
- Tables and fields
87+
- Validation rules (coming soon)
88+
- Access control policies (coming soon)
89+
- ...
9090

9191
ZModel is a super set of [Prisma Schema Language](https://www.prisma.io/docs/orm/prisma-schema/overview), i.e., every valid Prisma schema is a valid ZModel.
9292

@@ -288,9 +288,7 @@ client.$use({
288288
async onQuery({ model, operation, proceed, queryArgs }) {
289289
const start = Date.now();
290290
const result = await proceed(queryArgs);
291-
console.log(
292-
`[cost] ${model} ${operation} took ${Date.now() - start}ms`
293-
);
291+
console.log(`[cost] ${model} ${operation} took ${Date.now() - start}ms`);
294292
return result;
295293
},
296294
});
@@ -365,19 +363,19 @@ client.$use({
365363

366364
ZenStack v3 delegates database schema migration to Prisma. The CLI provides Prisma CLI wrappers for managing migrations.
367365

368-
- Sync schema to dev database and create a migration record:
366+
- Sync schema to dev database and create a migration record:
369367

370368
```bash
371369
npx zenstack migrate dev
372370
```
373371

374-
- Deploy new migrations:
372+
- Deploy new migrations:
375373

376374
```bash
377375
npx zenstack migrate deploy
378376
```
379377

380-
- Reset dev database
378+
- Reset dev database
381379

382380
```bash
383381
npx zenstack migrate reset

TODO.md

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,80 @@
11
## V3 Alpha Todo
22

3-
- [ ] Infra
4-
- [ ] Dependency injection
5-
- [ ] CLI
6-
- [x] generate
7-
- [x] migrate
8-
- [x] info
9-
- [x] init
10-
- [ ] ORM
11-
- [x] Create
12-
- [x] Input validation
13-
- [x] Simple create
14-
- [x] Nested create
15-
- [x] Relation connection
16-
- [x] Create many
17-
- [x] ID generation
18-
- [x] CreateManyAndReturn
19-
- [x] Find
20-
- [x] Input validation
21-
- [x] Field selection
22-
- [x] Omit
23-
- [x] Counting relation
24-
- [x] Pagination
25-
- [x] Skip and limit
26-
- [x] Cursor
27-
- [x] Filtering
28-
- [x] Unique fields
29-
- [x] Scalar fields
30-
- [x] Relation fields
31-
- [x] Sort
32-
- [x] Scalar fields
33-
- [x] Relation fields
34-
- [x] Relation inclusion
35-
- [x] Filtering
36-
- [x] Sorting
37-
- [x] Pagination
38-
- [x] Distinct
39-
- [ ] JSON filtering
40-
- [x] Update
41-
- [x] Input validation
42-
- [x] Top-level
43-
- [x] Nested to-many
44-
- [x] Nested to-one
45-
- [x] Incremental update for numeric fields
46-
- [x] Array update
47-
- [x] Upsert
48-
- [ ] Implement with "on conflict"
49-
- [x] Delete
50-
- [x] Aggregation
51-
- [x] Count
52-
- [x] Aggregate
53-
- [x] Group by
54-
- [ ] Extensions
55-
- [x] Query builder API
56-
- [x] Computed fields
57-
- [ ] Prisma client extension
58-
- [ ] Misc
59-
- [x] JSDoc for CRUD methods
60-
- [x] Cache validation schemas
61-
- [x] Compound ID
62-
- [ ] Cross field comparison
63-
- [x] Many-to-many relation
64-
- [ ] Empty AND/OR/NOT behavior
65-
- [?] Logging
66-
- [ ] Error system
67-
- [x] Custom table name
68-
- [x] Custom field name
69-
- [ ] Implement changesets
70-
- [ ] Polymorphism
71-
- [ ] Validation
72-
- [ ] Access Policy
73-
- [ ] Short-circuit pre-create check for scalar-field only policies
74-
- [ ] Inject "replace into"
75-
- [ ] Inject "on conflict do update"
76-
- [x] Migration
77-
- [ ] Databases
78-
- [x] SQLite
79-
- [x] PostgreSQL
80-
- [ ] Multi-schema
3+
- [ ] Infra
4+
- [ ] Dependency injection
5+
- [ ] CLI
6+
- [x] generate
7+
- [x] migrate
8+
- [x] info
9+
- [x] init
10+
- [ ] ORM
11+
- [x] Create
12+
- [x] Input validation
13+
- [x] Simple create
14+
- [x] Nested create
15+
- [x] Relation connection
16+
- [x] Create many
17+
- [x] ID generation
18+
- [x] CreateManyAndReturn
19+
- [x] Find
20+
- [x] Input validation
21+
- [x] Field selection
22+
- [x] Omit
23+
- [x] Counting relation
24+
- [x] Pagination
25+
- [x] Skip and limit
26+
- [x] Cursor
27+
- [x] Filtering
28+
- [x] Unique fields
29+
- [x] Scalar fields
30+
- [x] Relation fields
31+
- [x] Sort
32+
- [x] Scalar fields
33+
- [x] Relation fields
34+
- [x] Relation inclusion
35+
- [x] Filtering
36+
- [x] Sorting
37+
- [x] Pagination
38+
- [x] Distinct
39+
- [ ] JSON filtering
40+
- [x] Update
41+
- [x] Input validation
42+
- [x] Top-level
43+
- [x] Nested to-many
44+
- [x] Nested to-one
45+
- [x] Incremental update for numeric fields
46+
- [x] Array update
47+
- [x] Upsert
48+
- [ ] Implement with "on conflict"
49+
- [x] Delete
50+
- [x] Aggregation
51+
- [x] Count
52+
- [x] Aggregate
53+
- [x] Group by
54+
- [ ] Extensions
55+
- [x] Query builder API
56+
- [x] Computed fields
57+
- [ ] Prisma client extension
58+
- [ ] Misc
59+
- [x] JSDoc for CRUD methods
60+
- [x] Cache validation schemas
61+
- [x] Compound ID
62+
- [ ] Cross field comparison
63+
- [x] Many-to-many relation
64+
- [ ] Empty AND/OR/NOT behavior
65+
- [?] Logging
66+
- [ ] Error system
67+
- [x] Custom table name
68+
- [x] Custom field name
69+
- [ ] Implement changesets
70+
- [ ] Polymorphism
71+
- [ ] Validation
72+
- [ ] Access Policy
73+
- [ ] Short-circuit pre-create check for scalar-field only policies
74+
- [ ] Inject "replace into"
75+
- [ ] Inject "on conflict do update"
76+
- [x] Migration
77+
- [ ] Databases
78+
- [x] SQLite
79+
- [x] PostgreSQL
80+
- [ ] Multi-schema

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"watch": "turbo run watch build",
99
"lint": "turbo run lint",
1010
"test": "turbo run test",
11+
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
1112
"publish-all": "pnpm --filter \"./packages/**\" -r publish --tag next",
1213
"publish-preview": "pnpm --filter \"./packages/**\" -r publish --tag next --force --registry https://preview.registry.zenstack.dev/",
1314
"unpublish-preview": "pnpm --filter \"./packages/**\" -r --shell-mode exec -- npm unpublish -f --registry https://preview.registry.zenstack.dev/ \"\\$PNPM_PACKAGE_NAME\""
@@ -16,16 +17,17 @@
1617
"author": "",
1718
"license": "MIT",
1819
"devDependencies": {
20+
"@eslint/js": "^9.29.0",
1921
"@swc/core": "^1.12.5",
2022
"@types/node": "^20.17.24",
21-
"@typescript-eslint/eslint-plugin": "~7.3.1",
22-
"@typescript-eslint/parser": "~7.3.1",
23-
"eslint": "~8.57.1",
23+
"eslint": "~9.29.0",
2424
"npm-run-all": "^4.1.5",
25+
"prettier": "^3.5.3",
2526
"tsup": "^8.5.0",
2627
"tsx": "^4.20.3",
2728
"turbo": "^2.5.4",
2829
"typescript": "catalog:",
30+
"typescript-eslint": "^8.34.1",
2931
"vitest": "^3.2.4"
3032
},
3133
"pnpm": {

packages/cli/eslint.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import config from '@zenstackhq/eslint-config/base.js';
2+
3+
/** @type {import("eslint").Linter.Config} */
4+
export default config;

packages/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@zenstackhq/runtime": "workspace:*",
5050
"@zenstackhq/testtools": "workspace:*",
5151
"@zenstackhq/typescript-config": "workspace:*",
52+
"@zenstackhq/eslint-config": "workspace:*",
5253
"better-sqlite3": "^11.8.1",
5354
"tmp": "^0.2.3"
5455
}

packages/cli/src/actions/action-utils.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function getSchemaFile(file?: string) {
1717
return './schema.zmodel';
1818
} else {
1919
throw new CliError(
20-
'Schema file not found in default locations ("./zenstack/schema.zmodel" or "./schema.zmodel").'
20+
'Schema file not found in default locations ("./zenstack/schema.zmodel" or "./schema.zmodel").',
2121
);
2222
}
2323
}
@@ -35,11 +35,7 @@ export async function loadSchemaDocument(schemaFile: string) {
3535
}
3636

3737
export function handleSubProcessError(err: unknown) {
38-
if (
39-
err instanceof Error &&
40-
'status' in err &&
41-
typeof err.status === 'number'
42-
) {
38+
if (err instanceof Error && 'status' in err && typeof err.status === 'number') {
4339
process.exit(err.status);
4440
} else {
4541
process.exit(1);

0 commit comments

Comments
 (0)