@nadicodeai/ui 12.1.37 → 12.1.39

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.
@@ -8,6 +8,7 @@ import { drawerOwnsItsEdges } from "./rules/drawer-owns-its-edges.js";
8
8
  import { iconControlAccessibleName } from "./rules/icon-control-accessible-name.js";
9
9
  import { noAppFeatureComponent } from "./rules/no-app-feature-component.js";
10
10
  import { noBarePageNavigation } from "./rules/no-bare-page-navigation.js";
11
+ import { noStoreCast } from "./rules/no-store-cast.js";
11
12
  import { noElevatedEdge } from "./rules/no-elevated-edge.js";
12
13
  import { noExistenceOnlyAssertion } from "./rules/no-existence-only-assertion.js";
13
14
  import { noNestedOverlay } from "./rules/no-nested-overlay.js";
@@ -121,6 +122,7 @@ const plugin = {
121
122
  "icon-control-accessible-name": iconControlAccessibleName,
122
123
  "no-app-feature-component": noAppFeatureComponent,
123
124
  "no-bare-page-navigation": noBarePageNavigation,
125
+ "no-store-cast": noStoreCast,
124
126
  "no-elevated-edge": noElevatedEdge,
125
127
  "no-existence-only-assertion": noExistenceOnlyAssertion,
126
128
  "no-deprecated-zod-api": noDeprecatedZodApi,
@@ -0,0 +1,46 @@
1
+ /*
2
+ * A test hands the subject the store methods it calls, as an object typed by
3
+ * the subject's own parameter. `as PortalStore` (or `as unknown as
4
+ * PortalStore`) turns a partial object into the whole 227-method store: the
5
+ * compiler then checks nothing about the methods the fake does implement, and a
6
+ * subject that grows a call reaches `undefined` at run time instead of failing
7
+ * to compile. Narrow the subject's parameter to the capability it uses
8
+ * (`Pick<SomePersistence, "a" | "b">`), then build the fake as that type.
9
+ */
10
+
11
+ export const noStoreCast = {
12
+ meta: {
13
+ type: "problem",
14
+ docs: {
15
+ description:
16
+ "Disallow casting a partial object to the whole store in a test; type the subject by the store methods it calls and build the fake as that type",
17
+ },
18
+ schema: [
19
+ {
20
+ type: "object",
21
+ properties: { types: { type: "array", items: { type: "string" } } },
22
+ additionalProperties: false,
23
+ },
24
+ ],
25
+ messages: {
26
+ storeCast:
27
+ '`as {{name}}` hides which store methods this fake implements, so the compiler checks none of them. Type the subject\'s store parameter as the methods it calls (`Pick<SomePersistence, "a" | "b">`) and build the fake as `Parameters<typeof subject>[0]`.',
28
+ },
29
+ },
30
+
31
+ create(context) {
32
+ const names = new Set(context.options[0]?.types ?? ["PortalStore"]);
33
+ return {
34
+ TSAsExpression(node) {
35
+ const type = node.typeAnnotation;
36
+ if (
37
+ type.type === "TSTypeReference" &&
38
+ type.typeName.type === "Identifier" &&
39
+ names.has(type.typeName.name)
40
+ ) {
41
+ context.report({ node, messageId: "storeCast", data: { name: type.typeName.name } });
42
+ }
43
+ },
44
+ };
45
+ },
46
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nadicodeai/ui",
3
- "version": "12.1.37",
3
+ "version": "12.1.39",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -77,14 +77,14 @@
77
77
  "@assistant-ui/react": "0.15.21",
78
78
  "@assistant-ui/react-markdown": "0.14.16",
79
79
  "@base-ui/react": "^1.8.0",
80
- "@nadicodeai/design-system": "12.1.37",
80
+ "@nadicodeai/design-system": "12.1.39",
81
81
  "class-variance-authority": "^0.7.1",
82
82
  "clsx": "^2.1.1",
83
83
  "cmdk": "^1.1.1",
84
84
  "date-fns": "^4.4.0",
85
85
  "embla-carousel-react": "^8.6.0",
86
86
  "input-otp": "^1.5.0",
87
- "lucide-react": "1.47.0",
87
+ "lucide-react": "1.48.0",
88
88
  "motion": "^13.4.0",
89
89
  "next-themes": "^0.4.6",
90
90
  "react-day-picker": "^10.0.1",