Skip to content

Commit ba7e498

Browse files
chore: fix only zod/v4 rule to point to right file
The last refactor moved exports around and now that the UserSchema is in config/userConfig.ts, the eslint rule needed updating as well.
1 parent ff9e123 commit ba7e498

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

eslint-rules/enforce-zod-v4.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
import path from "path";
33

44
// The file that is allowed to import from zod/v4
5-
const configFilePath = path.resolve(import.meta.dirname, "../src/common/config.ts");
6-
const schemasFilePath = path.resolve(import.meta.dirname, "../src/common/schemas.ts");
5+
const configFilePath = path.resolve(import.meta.dirname, "../src/common/config/userConfig.ts");
76

87
// Ref: https://eslint.org/docs/latest/extend/custom-rules
98
export default {

eslint-rules/enforce-zod-v4.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ const ruleTester = new RuleTester({
1515
});
1616

1717
describe("enforce-zod-v4", () => {
18-
it("should allow zod/v4 imports in config.ts", () => {
18+
it("should allow zod/v4 imports in userConfig.ts", () => {
1919
ruleTester.run("enforce-zod-v4", rule, {
2020
valid: [
2121
{
22-
filename: resolve("src/common/config.ts"),
22+
filename: resolve("src/common/config/userConfig.ts"),
2323
code: 'import { z } from "zod/v4";\n',
2424
},
2525
{
26-
filename: resolve("src/common/config.ts"),
26+
filename: resolve("src/common/config/userConfig.ts"),
2727
code: 'import * as z from "zod/v4";\n',
2828
},
2929
{
30-
filename: resolve("src/common/config.ts"),
30+
filename: resolve("src/common/config/userConfig.ts"),
3131
code: 'import type { ZodType } from "zod/v4";\n',
3232
},
3333
],
@@ -63,7 +63,7 @@ describe("enforce-zod-v4", () => {
6363
code: 'import { something } from "some-package";\n',
6464
},
6565
{
66-
filename: resolve("src/common/config.ts"),
66+
filename: resolve("src/common/config/userConfig.ts"),
6767
code: 'import path from "path";\n',
6868
},
6969
{
@@ -127,7 +127,7 @@ describe("enforce-zod-v4", () => {
127127
ruleTester.run("enforce-zod-v4", rule, {
128128
valid: [
129129
{
130-
filename: resolve("src/common/config.ts"),
130+
filename: resolve("src/common/config/userConfig.ts"),
131131
code: `import { z } from "zod/v4";
132132
import path from "path";
133133
import type { UserConfig } from "./types.js";

src/common/config/userConfig.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// eslint-disable-next-line enforce-zod-v4/enforce-zod-v4
21
import { z as z4 } from "zod/v4";
32
import { type CliOptions } from "@mongosh/arg-parser";
43
import { type ConfigFieldMeta, commaSeparatedToArray, getExportsPath, getLogPath } from "./configUtils.js";

0 commit comments

Comments
 (0)