Skip to content

Commit 5d28e89

Browse files
authored
Organizing zod-plugin directories (#2921)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - Chores - Use src-based entry points for bundling/types and align metadata resolution with project layout. - Broaden lint ignore patterns to cover generated/dist and coverage folders. - Tests - Point test setup and test imports to source entry points for consistency. - Expand test discovery to include nested test files. - Refactor - Standardized internal module resolution across the codebase. No user-facing behavior changes. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 93a4759 commit 5d28e89

File tree

13 files changed

+24
-22
lines changed

13 files changed

+24
-22
lines changed

eslint.config.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { builtinModules } from "node:module";
1111
const cwd = dirname(fileURLToPath(import.meta.url));
1212
const ezDir = join(cwd, "express-zod-api");
1313
const migrationDir = join(cwd, "migration");
14+
const pluginDir = join(cwd, "zod-plugin");
1415

1516
const importConcerns = [
1617
{
@@ -175,13 +176,7 @@ export default tsPlugin.config(
175176
prettierRules,
176177
{
177178
name: "globally/ignored",
178-
ignores: [
179-
"express-zod-api/dist/",
180-
"express-zod-api/coverage/",
181-
"migration/dist",
182-
"compat-test/sample.ts",
183-
"zod-plugin/dist",
184-
],
179+
ignores: ["**/dist/", "**/coverage/", "compat-test/sample.ts"],
185180
},
186181
{
187182
name: "globally/disabled",
@@ -210,6 +205,18 @@ export default tsPlugin.config(
210205
],
211206
},
212207
},
208+
{
209+
name: "source/plugin",
210+
files: ["zod-plugin/src/*.ts"],
211+
rules: {
212+
"allowed/dependencies": ["error", { packageDir: pluginDir }],
213+
"no-restricted-syntax": [
214+
"warn",
215+
...importConcerns,
216+
...performanceConcerns,
217+
],
218+
},
219+
},
213220
{
214221
name: "source/migration",
215222
files: ["migration/index.ts"],
@@ -240,12 +247,7 @@ export default tsPlugin.config(
240247
},
241248
{
242249
name: "tests/all",
243-
files: [
244-
"express-zod-api/tests/*.ts",
245-
"express-zod-api/vitest.setup.ts",
246-
"migration/*.spec.ts",
247-
"zod-plugin/*.spec.ts",
248-
],
250+
files: ["**/tests/*.ts", "**/vitest.setup.ts", "**/*.spec.ts"],
249251
rules: {
250252
"@typescript-eslint/no-explicit-any": "off",
251253
"@typescript-eslint/no-empty-object-type": "warn",
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

zod-plugin/runtime.ts renamed to zod-plugin/src/runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { globalRegistry, z } from "zod";
2-
import { name } from "./package.json";
2+
import { name } from "../package.json";
33
import { setBrand } from "./brand";
44
import { remap } from "./remap";
55

zod-plugin/brand.spec.ts renamed to zod-plugin/tests/brand.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from "zod";
2-
import { brandProperty, getBrand, setBrand } from "./brand";
3-
import * as packer from "./packer";
2+
import { brandProperty, getBrand, setBrand } from "../src/brand";
3+
import * as packer from "../src/packer";
44

55
describe("Brand", () => {
66
describe("brandProperty", () => {

zod-plugin/index.spec.ts renamed to zod-plugin/tests/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { z } from "zod";
2-
import * as entrypoint from "./index";
2+
import * as entrypoint from "../src";
33

44
describe("Entrypoint", () => {
55
test("Augmentation", () => {

zod-plugin/packer.spec.ts renamed to zod-plugin/tests/packer.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { z } from "zod";
2-
import { pack, unpack } from "./packer";
2+
import { pack, unpack } from "../src";
33

44
describe("Packer", () => {
55
describe("pack()", () => {

0 commit comments

Comments
 (0)