Skip to content

Commit 3d3ecec

Browse files
committed
lint internal events
1 parent 20cb256 commit 3d3ecec

File tree

6 files changed

+35
-23
lines changed

6 files changed

+35
-23
lines changed

internal/helpers/jest.config.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
export default {
22
preset: "ts-jest",
33
testEnvironment: "node",
4-
testMatch: ["**/src/__tests__/**/*.ts?(x)", "**/src/?(*.)+(spec|test).ts?(x)"],
4+
testMatch: [
5+
"**/src/__tests__/**/*.ts?(x)",
6+
"**/src/?(*.)+(spec|test).ts?(x)",
7+
],
58
collectCoverageFrom: ["src/**/*.ts"],
69
coveragePathIgnorePatterns: ["/node_modules/", "__tests__"],
710
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
811
transform: {
9-
"^.+\\.tsx?$": ["ts-jest", { }]
10-
}
12+
"^.+\\.tsx?$": ["ts-jest", {}],
13+
},
1114
};

internal/helpers/src/__tests__/id-ref.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@ describe("idRef", () => {
1212

1313
// Should validate UUIDs like the original schema's domainId
1414
expect(() => refField.parse("not-a-uuid")).toThrow();
15-
expect(() => refField.parse("123e4567-e89b-12d3-a456-426614174000")).not.toThrow();
15+
expect(() =>
16+
refField.parse("123e4567-e89b-12d3-a456-426614174000"),
17+
).not.toThrow();
1618
});
1719

1820
it("should add reference metadata", () => {
1921
const refField = idRef(TestSchema, "domainId", "TestEntity");
2022

2123
expect(refField).toBeDefined();
2224
expect(z.globalRegistry.has(refField)).toBe(true);
23-
expect(z.globalRegistry.get(refField)).toEqual(expect.objectContaining({
24-
title: "TestEntity ID Reference",
25-
description: "Reference to a TestEntity by its unique identifier",
26-
}));
25+
expect(z.globalRegistry.get(refField)).toEqual(
26+
expect.objectContaining({
27+
title: "TestEntity ID Reference",
28+
description: "Reference to a TestEntity by its unique identifier",
29+
}),
30+
);
2731
});
2832

2933
it("should use custom ID field name when provided", () => {
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import { z } from 'zod';
1+
import { z } from "zod";
22

33
/**
44
* Deployment / execution environment identifier.
55
* Intentionally liberal; constrain in callers as needed.
66
*/
7-
export const $Environment = z.string().meta({
8-
title: 'Environment',
9-
description: 'The environment in which the configuration has effect',
10-
examples: ['dev', 'int', 'prod'],
7+
const $Environment = z.string().meta({
8+
title: "Environment",
9+
description: "The environment in which the configuration has effect",
10+
examples: ["dev", "int", "prod"],
1111
});
12+
13+
export default $Environment;

internal/helpers/src/id-ref.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,19 @@ import { z } from "zod";
2424
// Overload for when a specific ID field is provided
2525
export function idRef<
2626
T extends z.ZodObject<Record<string, z.ZodTypeAny>>,
27-
K extends keyof T["shape"] & string
27+
K extends keyof T["shape"] & string,
2828
>(schema: T, idFieldName: K, entityName?: string): T["shape"][K];
2929

3030
// Overload for when using the default "domainId" field
3131
export function idRef<
3232
T extends z.ZodObject<Record<string, z.ZodTypeAny>> & {
33-
shape: { domainId: z.ZodTypeAny }
34-
}
35-
>(schema: T, idFieldName?: undefined, entityName?: string): T["shape"]["domainId"];
33+
shape: { domainId: z.ZodTypeAny };
34+
},
35+
>(
36+
schema: T,
37+
idFieldName?: undefined,
38+
entityName?: string,
39+
): T["shape"]["domainId"];
3640

3741
// Implementation
3842
export function idRef<

internal/helpers/src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*/
55

66
// Export all helpers
7-
export * from './version';
8-
export * from './environment';
7+
export * from "./version";
8+
export { default as $Environment } from "./environment";
99
export * from "./id-ref";
10-
export * from "../../events/src/domain/domain-base";

internal/helpers/src/version.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { z } from 'zod';
1+
import { z } from "zod";
22

33
/**
44
* Semantic version (major.minor.patch) with numeric segments only.
55
* Branded for nominal typing.
66
*/
77
export const $Version = z
88
.string()
9-
.regex(/^[0-9]+\.[0-9]+\.[0-9]+$/)
10-
.brand('Version');
9+
.regex(/^\d+\.\d+\.\d+$/)
10+
.brand("Version");
1111

1212
export type Version = z.infer<typeof $Version>;

0 commit comments

Comments
 (0)