@copilotkit/react-ui 1.69.3 → 1.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { describe, it } from "vitest";
|
|
2
|
+
import { RuleTester } from "oxlint/plugins-dev";
|
|
3
|
+
import rule from "./no-single-arg-zod-record.mjs";
|
|
4
|
+
|
|
5
|
+
// oxlint's RuleTester relies on V8 APIs that only exist on Node >= 22, and
|
|
6
|
+
// throws at parse time on older runtimes. The CI unit matrix includes Node 20,
|
|
7
|
+
// so gate the RuleTester cases to supported runtimes. The lint rule itself is
|
|
8
|
+
// exercised on every Node version through `oxlint` in the lint job — this file
|
|
9
|
+
// only adds RuleTester-based unit coverage where the tester can run.
|
|
10
|
+
const ruleTesterSupported = Number(process.versions.node.split(".")[0]) >= 22;
|
|
11
|
+
|
|
12
|
+
if (ruleTesterSupported) {
|
|
13
|
+
RuleTester.describe = describe;
|
|
14
|
+
RuleTester.it = it;
|
|
15
|
+
|
|
16
|
+
const ruleTester = new RuleTester();
|
|
17
|
+
|
|
18
|
+
ruleTester.run("no-single-arg-zod-record", rule, {
|
|
19
|
+
valid: [
|
|
20
|
+
// Two-argument form is the correct, Zod 4-compatible shape.
|
|
21
|
+
"const s = z.record(z.string(), z.unknown());",
|
|
22
|
+
"const s = z.record(z.string(), z.number()).optional();",
|
|
23
|
+
// A single-argument `.record()` on something that isn't the `z` alias
|
|
24
|
+
// must not be flagged — this rule is scoped to Zod schemas.
|
|
25
|
+
"const m = cache.record(entry);",
|
|
26
|
+
],
|
|
27
|
+
invalid: [
|
|
28
|
+
// Single-argument form: fires and autofixes by inserting the key schema.
|
|
29
|
+
{
|
|
30
|
+
code: "const s = z.record(z.unknown());",
|
|
31
|
+
output: "const s = z.record(z.string(), z.unknown());",
|
|
32
|
+
errors: [{ messageId: "singleArgRecord" }],
|
|
33
|
+
},
|
|
34
|
+
// Chained `.optional()` still fixes the inner z.record call.
|
|
35
|
+
{
|
|
36
|
+
code: "const s = z.record(z.unknown()).optional();",
|
|
37
|
+
output: "const s = z.record(z.string(), z.unknown()).optional();",
|
|
38
|
+
errors: [{ messageId: "singleArgRecord" }],
|
|
39
|
+
},
|
|
40
|
+
// A spread argument cannot be safely rewritten — report without a fix.
|
|
41
|
+
{
|
|
42
|
+
code: "const s = z.record(...valueTypes);",
|
|
43
|
+
output: null,
|
|
44
|
+
errors: [{ messageId: "singleArgRecord" }],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
describe("no-single-arg-zod-record", () => {
|
|
50
|
+
it.skip("oxlint RuleTester requires Node >= 22; skipped on this runtime", () => {});
|
|
51
|
+
});
|
|
52
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkit/react-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.70.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"rehype-sanitize": "^6.0.0",
|
|
50
50
|
"remark-gfm": "^4.0.1",
|
|
51
51
|
"remark-math": "^6.0.0",
|
|
52
|
-
"@copilotkit/react-core": "1.
|
|
53
|
-
"@copilotkit/runtime-client-gql": "1.
|
|
54
|
-
"@copilotkit/shared": "1.
|
|
52
|
+
"@copilotkit/react-core": "1.70.0",
|
|
53
|
+
"@copilotkit/runtime-client-gql": "1.70.0",
|
|
54
|
+
"@copilotkit/shared": "1.70.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/react": "^19.1.0",
|
package/vitest.config.mjs
CHANGED