@kutur-kit/oxc 0.1.0-alpha.7 → 0.1.0-alpha.8

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.
Files changed (139) hide show
  1. package/README.md +69 -21
  2. package/dist/app.d.ts +16 -0
  3. package/dist/app.d.ts.map +1 -0
  4. package/dist/app.js +17 -0
  5. package/dist/app.js.map +1 -0
  6. package/dist/base.d.ts.map +1 -1
  7. package/dist/base.js +5 -1
  8. package/dist/base.js.map +1 -1
  9. package/dist/effect-ui-stylex/class.d.ts +2 -0
  10. package/dist/effect-ui-stylex/class.d.ts.map +1 -0
  11. package/dist/effect-ui-stylex/class.js +109 -0
  12. package/dist/effect-ui-stylex/class.js.map +1 -0
  13. package/dist/effect-ui-stylex/components.d.ts +30 -0
  14. package/dist/effect-ui-stylex/components.d.ts.map +1 -0
  15. package/dist/effect-ui-stylex/components.js +175 -0
  16. package/dist/effect-ui-stylex/components.js.map +1 -0
  17. package/dist/effect-ui-stylex/condition-key.d.ts.map +1 -0
  18. package/dist/{foldkit-stylex → effect-ui-stylex}/condition-key.js +7 -41
  19. package/dist/effect-ui-stylex/condition-key.js.map +1 -0
  20. package/dist/effect-ui-stylex/hover-gate.d.ts.map +1 -0
  21. package/dist/effect-ui-stylex/hover-gate.js.map +1 -0
  22. package/dist/effect-ui-stylex/internal-import.d.ts +2 -0
  23. package/dist/effect-ui-stylex/internal-import.d.ts.map +1 -0
  24. package/dist/effect-ui-stylex/internal-import.js +29 -0
  25. package/dist/effect-ui-stylex/internal-import.js.map +1 -0
  26. package/dist/effect-ui-stylex/layers.d.ts +14 -0
  27. package/dist/effect-ui-stylex/layers.d.ts.map +1 -0
  28. package/dist/effect-ui-stylex/layers.js +118 -0
  29. package/dist/effect-ui-stylex/layers.js.map +1 -0
  30. package/dist/effect-ui-stylex/look-level.d.ts +2 -0
  31. package/dist/effect-ui-stylex/look-level.d.ts.map +1 -0
  32. package/dist/effect-ui-stylex/look-level.js +83 -0
  33. package/dist/effect-ui-stylex/look-level.js.map +1 -0
  34. package/dist/effect-ui-stylex/modules.d.ts +36 -0
  35. package/dist/effect-ui-stylex/modules.d.ts.map +1 -0
  36. package/dist/effect-ui-stylex/modules.js +97 -0
  37. package/dist/effect-ui-stylex/modules.js.map +1 -0
  38. package/dist/effect-ui-stylex/parts.d.ts +17 -0
  39. package/dist/effect-ui-stylex/parts.d.ts.map +1 -0
  40. package/dist/effect-ui-stylex/parts.js +66 -0
  41. package/dist/effect-ui-stylex/parts.js.map +1 -0
  42. package/dist/effect-ui-stylex/raw-part.d.ts +2 -0
  43. package/dist/effect-ui-stylex/raw-part.d.ts.map +1 -0
  44. package/dist/effect-ui-stylex/raw-part.js +90 -0
  45. package/dist/effect-ui-stylex/raw-part.js.map +1 -0
  46. package/dist/effect-ui-stylex/state-attributes.d.ts +8 -0
  47. package/dist/effect-ui-stylex/state-attributes.d.ts.map +1 -0
  48. package/dist/effect-ui-stylex/state-attributes.js +141 -0
  49. package/dist/effect-ui-stylex/state-attributes.js.map +1 -0
  50. package/dist/effect-ui-stylex/state-key.d.ts +2 -0
  51. package/dist/effect-ui-stylex/state-key.d.ts.map +1 -0
  52. package/dist/effect-ui-stylex/state-key.js +103 -0
  53. package/dist/effect-ui-stylex/state-key.js.map +1 -0
  54. package/dist/effect-ui-stylex/subpath.d.ts +10 -0
  55. package/dist/effect-ui-stylex/subpath.d.ts.map +1 -0
  56. package/dist/effect-ui-stylex/subpath.js +53 -0
  57. package/dist/effect-ui-stylex/subpath.js.map +1 -0
  58. package/dist/effect-ui-stylex.d.ts +23 -0
  59. package/dist/effect-ui-stylex.d.ts.map +1 -0
  60. package/dist/{foldkit-stylex.js → effect-ui-stylex.js} +10 -9
  61. package/dist/effect-ui-stylex.js.map +1 -0
  62. package/dist/{foldkit-stylex.json → effect-ui-stylex.json} +7 -6
  63. package/dist/plugin.d.ts.map +1 -1
  64. package/dist/plugin.js +18 -12
  65. package/dist/plugin.js.map +1 -1
  66. package/dist/rules/imports.d.ts +5 -6
  67. package/dist/rules/imports.d.ts.map +1 -1
  68. package/dist/rules/imports.js +18 -14
  69. package/dist/rules/imports.js.map +1 -1
  70. package/dist/rules/module-sources.d.ts +33 -0
  71. package/dist/rules/module-sources.d.ts.map +1 -0
  72. package/dist/rules/module-sources.js +139 -0
  73. package/dist/rules/module-sources.js.map +1 -0
  74. package/dist/rules/no-suppression-directives.js +3 -3
  75. package/dist/rules/no-suppression-directives.js.map +1 -1
  76. package/dist/rules/scope.d.ts +3 -1
  77. package/dist/rules/scope.d.ts.map +1 -1
  78. package/dist/rules/scope.js.map +1 -1
  79. package/dist/vendor/anti-slop/rules/no-runtime-typeof.js +1 -1
  80. package/dist/vendor/anti-slop/rules/no-runtime-typeof.js.map +1 -1
  81. package/package.json +11 -7
  82. package/src/app.ts +19 -0
  83. package/src/base.ts +5 -1
  84. package/src/effect-ui-stylex/class.ts +140 -0
  85. package/src/effect-ui-stylex/components.ts +184 -0
  86. package/src/{foldkit-stylex → effect-ui-stylex}/condition-key.ts +6 -52
  87. package/src/effect-ui-stylex/internal-import.ts +32 -0
  88. package/src/effect-ui-stylex/layers.ts +161 -0
  89. package/src/effect-ui-stylex/look-level.ts +99 -0
  90. package/src/effect-ui-stylex/modules.ts +115 -0
  91. package/src/effect-ui-stylex/parts.ts +89 -0
  92. package/src/effect-ui-stylex/raw-part.ts +110 -0
  93. package/src/effect-ui-stylex/state-attributes.ts +140 -0
  94. package/src/effect-ui-stylex/state-key.ts +147 -0
  95. package/src/effect-ui-stylex/subpath.ts +65 -0
  96. package/src/{foldkit-stylex.ts → effect-ui-stylex.ts} +9 -8
  97. package/src/plugin.ts +18 -12
  98. package/src/rules/imports.ts +22 -15
  99. package/src/rules/module-sources.ts +179 -0
  100. package/src/rules/no-suppression-directives.ts +3 -3
  101. package/src/rules/scope.ts +1 -1
  102. package/src/vendor/anti-slop/UPSTREAM.md +2 -0
  103. package/src/vendor/anti-slop/rules/no-runtime-typeof.ts +1 -1
  104. package/dist/foldkit-stylex/attributes.d.ts +0 -2
  105. package/dist/foldkit-stylex/attributes.d.ts.map +0 -1
  106. package/dist/foldkit-stylex/attributes.js +0 -191
  107. package/dist/foldkit-stylex/attributes.js.map +0 -1
  108. package/dist/foldkit-stylex/components.d.ts +0 -12
  109. package/dist/foldkit-stylex/components.d.ts.map +0 -1
  110. package/dist/foldkit-stylex/components.js +0 -41
  111. package/dist/foldkit-stylex/components.js.map +0 -1
  112. package/dist/foldkit-stylex/condition-key.d.ts.map +0 -1
  113. package/dist/foldkit-stylex/condition-key.js.map +0 -1
  114. package/dist/foldkit-stylex/hover-gate.d.ts.map +0 -1
  115. package/dist/foldkit-stylex/hover-gate.js.map +0 -1
  116. package/dist/foldkit-stylex/styles.d.ts +0 -2
  117. package/dist/foldkit-stylex/styles.d.ts.map +0 -1
  118. package/dist/foldkit-stylex/styles.js +0 -131
  119. package/dist/foldkit-stylex/styles.js.map +0 -1
  120. package/dist/foldkit-stylex/unstyled-view.d.ts +0 -2
  121. package/dist/foldkit-stylex/unstyled-view.d.ts.map +0 -1
  122. package/dist/foldkit-stylex/unstyled-view.js +0 -94
  123. package/dist/foldkit-stylex/unstyled-view.js.map +0 -1
  124. package/dist/foldkit-stylex/vite.d.ts +0 -2
  125. package/dist/foldkit-stylex/vite.d.ts.map +0 -1
  126. package/dist/foldkit-stylex/vite.js +0 -26
  127. package/dist/foldkit-stylex/vite.js.map +0 -1
  128. package/dist/foldkit-stylex.d.ts +0 -22
  129. package/dist/foldkit-stylex.d.ts.map +0 -1
  130. package/dist/foldkit-stylex.js.map +0 -1
  131. package/src/foldkit-stylex/attributes.ts +0 -282
  132. package/src/foldkit-stylex/components.ts +0 -41
  133. package/src/foldkit-stylex/styles.ts +0 -170
  134. package/src/foldkit-stylex/unstyled-view.ts +0 -121
  135. package/src/foldkit-stylex/vite.ts +0 -29
  136. /package/dist/{foldkit-stylex → effect-ui-stylex}/condition-key.d.ts +0 -0
  137. /package/dist/{foldkit-stylex → effect-ui-stylex}/hover-gate.d.ts +0 -0
  138. /package/dist/{foldkit-stylex → effect-ui-stylex}/hover-gate.js +0 -0
  139. /package/src/{foldkit-stylex → effect-ui-stylex}/hover-gate.ts +0 -0
package/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # @kutur-kit/oxc
2
2
 
3
- Oxlint and Oxfmt presets for TypeScript, with optional Effect and `@kutur-kit/foldkit-stylex` rules.
3
+ Oxlint and Oxfmt presets for TypeScript, with optional Effect and `@kutur-kit/effect-ui-stylex` rules.
4
4
 
5
- | Export | Required tools |
6
- | ----------------- | ----------------------------------- |
7
- | `/base` | `oxlint`, `tsrs` |
8
- | `/effect` | `oxlint`, `@effect/tsgo`, `tsrs` |
9
- | `/format` | `oxfmt` |
10
- | `/anti-slop` | `oxlint` |
11
- | `/foldkit-stylex` | `oxlint`, `@stylexjs/eslint-plugin` |
5
+ | Export | Required tools |
6
+ | ------------------- | ----------------------------------- |
7
+ | `/base` | `oxlint`, `tsrs` |
8
+ | `/effect` | `oxlint`, `@effect/tsgo`, `tsrs` |
9
+ | `/format` | `oxfmt` |
10
+ | `/anti-slop` | `oxlint` |
11
+ | `/app` | `oxlint` |
12
+ | `/effect-ui-stylex` | `oxlint`, `@stylexjs/eslint-plugin` |
12
13
 
13
14
  Type-aware rules run on [tsrs](https://github.com/oxc-project/tsrs).
14
15
 
@@ -42,26 +43,46 @@ In test files (`*.test.*`, `*.spec.*`, `test/**` and `tests/**`), `/effect` also
42
43
 
43
44
  `/anti-slop` is optional and includes the generic and Effect rules from [anti-slop](https://github.com/dmmulroy/anti-slop), and `kit/comment-prose` (see [Prose](#prose)).
44
45
 
45
- ### @kutur-kit/foldkit-stylex
46
+ `/app` is optional and is for application code. It reports every type assertion (`value as T` and `<T>value`) and every `@ts-expect-error`, `@ts-ignore` and `@ts-nocheck` comment; `as const` and `satisfies` pass. Decode a value of unknown shape with a schema, or narrow it with a type guard. Extend it after `/base` or `/effect`, for the files of the app:
46
47
 
47
- `/foldkit-stylex` checks what the types of `@kutur-kit/foldkit-stylex` cannot see:
48
+ ```ts
49
+ import app from "@kutur-kit/oxc/app";
50
+ import effect from "@kutur-kit/oxc/effect";
51
+ import { defineConfig } from "oxlint";
52
+
53
+ export default defineConfig({
54
+ extends: [effect, app],
55
+ options: { typeAware: true, maxWarnings: 0 },
56
+ });
57
+ ```
58
+
59
+ A library whose generic API needs an assertion keeps `/base`, with `/anti-slop` to ask each one for a comment that says why it is safe.
60
+
61
+ `/base` reports a `switch` over a union that misses a member, and a `default` on one that names them all: the `default` would hide a member added later.
62
+
63
+ ### @kutur-kit/effect-ui-stylex
64
+
65
+ `/effect-ui-stylex` checks what the types of `@kutur-kit/effect-ui-stylex` cannot see:
48
66
 
49
- - a second Class on an element, or a Class or Style that replaces a @foldkit/ui part's, on a bundle `toView` hands out or `DragAndDropStyle.draggable` returns, or in a `*Attributes` view input;
50
- - a @foldkit/ui view used unstyled, in place of the theme's namespace, such as `Listbox` from `@kutur-kit/foldkit-stylex-theme/listbox`, or a view wrapped with `XStyle.view` for a look of your own;
51
- - StyleX condition keys that never match or that rank differently than written, such as `:focus-visible` or `:has(:focus-visible)` next to `:hover` or `:user-invalid`;
52
- - `:hover` styles outside `@media (hover: hover)`, which touch browsers keep after a tap;
53
- - `createTheme`, `--fks-*` tokens set on an element, theme overrides without `satisfies ThemeOverrides`, styles objects annotated or cast with `as`, and arrays of them annotated, cast or typed as a parameter;
54
- - StyleX's own Vite plugin.
67
+ | Rule | Reports |
68
+ | ------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
69
+ | `kit/effect-ui-class` | `.class(...)`, `.attr("class", ...)` or `.attrs(stylex.attrs(...))` chained on a drawn element, or set on the element a drawn function is given: either replaces a class. On any element, a second call that sets its class. |
70
+ | `kit/effect-ui-raw-part` | In the `view` of a component of `@kutur-kit/effect-ui-stylex`, a part applied to a bare element where the library has a drawn function, as `dialog.popup(h.div)`, and a `trigger` or `close` on a bare element in place of a `Button`. |
71
+ | `kit/effect-ui-state-key` | A StyleX key on a data attribute that effect/ui/kit does not write, one with conditions under it, and two on one property that one element can match. |
72
+ | `kit/effect-ui-stylex-condition-key` | A bare attribute key; a media query that never matches; `:focus-visible` or `:has(:focus-visible)` next to a key that outranks it. |
73
+ | `kit/effect-ui-stylex-hover-gate` | A `:hover` style outside `@media (hover: hover)`, which touch browsers keep after a tap. |
74
+ | `kit/effect-ui-internal-import` | An import of a module under an `internal` directory of effect/ui, such as `effect/ui/kit/internal/focus`, or of a file of the effect package, such as `effect/dist/ui/kit/Dialog.js`. |
75
+ | `kit/effect-ui-stylex-subpath` | An import of a file under the `src` or `dist` of `@kutur-kit/effect-ui-stylex`, through the package or by a path into it. The message names the module to import where the package exports the file. |
55
76
 
56
77
  It also turns on StyleX's ESLint rules. Each message names the fix. Add `@stylexjs/eslint-plugin` to your `devDependencies` beside Oxlint, then extend the preset in `oxlint.config.ts`:
57
78
 
58
79
  ```ts
59
80
  import effect from "@kutur-kit/oxc/effect";
60
- import foldkitStylex from "@kutur-kit/oxc/foldkit-stylex";
81
+ import effectUiStylex from "@kutur-kit/oxc/effect-ui-stylex";
61
82
  import { defineConfig } from "oxlint";
62
83
 
63
84
  export default defineConfig({
64
- extends: [effect, foldkitStylex],
85
+ extends: [effect, effectUiStylex],
65
86
  options: { typeAware: true, maxWarnings: 0 },
66
87
  });
67
88
  ```
@@ -70,13 +91,40 @@ Or in `.oxlintrc.json`, which extends configs by path:
70
91
 
71
92
  ```json
72
93
  {
73
- "extends": ["./node_modules/@kutur-kit/oxc/dist/foldkit-stylex.json"]
94
+ "extends": ["./node_modules/@kutur-kit/oxc/dist/effect-ui-stylex.json"]
74
95
  }
75
96
  ```
76
97
 
77
- The rules recognise `sx`, the `XStyle` namespaces, StyleX, Effect and @foldkit/ui by their imports, named, aliased or as a namespace, and read each file on its own. They recognise @foldkit/ui parts by the names `toView`, `entryToView`, `toCalendarView` and `*Attributes`, so an app's own Submodel that uses those names is checked as a @foldkit/ui part. They follow bundles through `map`, `flatMap` and `filter` written in place, as array methods, Effect `Array` functions or `pipe` steps.
98
+ The rules recognise the drawn functions and StyleX by their imports, named, aliased or as a namespace, and read each file on its own. They take two things from how a view is written:
99
+
100
+ - A parts object is the parameter of a `view` option, as `dialog` in `Dialog(h, { view: (dialog) => … })`.
101
+ - A part or a view function takes its element as its argument or as `element`, as in `select.item({ element: h.div, value })`, and what is chained on its result reaches the same element.
102
+
103
+ They read the direct form, `dialog.popup(h.div)` and `Button(h).class(...)`, and miss what reaches the same element another way: a function of your own that wraps a drawn one, a parts object that is destructured or passed to a function, a part kept in a variable or read with a computed key, as `dialog["popup"]`, and a class on a builder kept in a variable.
104
+
105
+ The three import rules, `kit/effect-ui-internal-import`, `kit/effect-ui-stylex-subpath` and `kit/effect-ui-stylex-layers` below, read a module named with a literal in an import, a re-export, `import()`, `require`, `import.meta.glob`, `import.meta.resolve`, `new URL("…", import.meta.url)` and Vitest's `vi.importActual` and `vi.mock`. They miss a specifier computed at run time.
106
+
107
+ `kit/effect-ui-state-key` is for the few states effect/ui/kit hands the view no value for. Every other state is a value: `stylex.attrs(styles.base, dialog.open && styles.open)`.
108
+
109
+ A library of drawn elements of your own turns on one more rule, which the preset leaves off. `kit/effect-ui-look-level` reports a look that sets one side or one physical axis, such as `paddingInlineEnd` or `overflowY`: StyleX applies it over a caller's `paddingInline` whatever the order. Write the look at the level above, or exclude that level from the function's `style` option and disable the rule for the line, with the reason:
110
+
111
+ ```ts
112
+ export default defineConfig({
113
+ extends: [effect, effectUiStylex],
114
+ overrides: [{ files: ["src/components/**"], rules: { "kit/effect-ui-look-level": "error" } }],
115
+ });
116
+ ```
117
+
118
+ The plugin has one more rule, for the source of `@kutur-kit/effect-ui-stylex` itself. `kit/effect-ui-stylex-layers` reads a file's layer from its path under `src` and reports an import the layers do not allow:
119
+
120
+ | Layer | Files | Imports of the package's own |
121
+ | --------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
122
+ | Mechanism | `src/mechanism/**` | The mechanism. |
123
+ | Design | `src/design/*` | The design, and `style.ts` and `compiled.ts` of the mechanism. |
124
+ | Component | `src/components/*` | `looks.ts`, `tokens.stylex.ts` and `icons.ts` of the design, `style.ts` of the mechanism, and named imports of the components beside it. |
125
+ | Testing | `src/testing.ts` | The mechanism. |
78
126
 
79
- They miss a @foldkit/ui view, a `create()` result or a styled draggable that reaches the file through another module, a bundle kept in a variable or iterated another way, a Class that a helper adds to a bundle passed to it, and a `*Attributes` input whose `childAttributes([...])` call is not written in place.
127
+ It also reports a file of `src` in none of these, a file of `src/components` that the package does not export, and an import by path that leaves `src`. Type-only imports count. The rule takes a file's place from the last `src` in its path, so turn it on for that directory alone.
80
128
 
81
129
  ### Suppression comments
82
130
 
package/dist/app.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ declare const app: {
2
+ plugins: "typescript"[];
3
+ rules: {
4
+ "typescript/consistent-type-assertions": ["error", {
5
+ assertionStyle: "never";
6
+ }];
7
+ "typescript/ban-ts-comment": ["error", {
8
+ "ts-expect-error": true;
9
+ "ts-ignore": true;
10
+ "ts-nocheck": true;
11
+ "ts-check": false;
12
+ }];
13
+ };
14
+ };
15
+ export default app;
16
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sources":["../src/app.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,GAAG;;;;;;;;;;;;;CAUe,CAAC;AAEzB,eAAe,GAAG,CAAC"}
package/dist/app.js ADDED
@@ -0,0 +1,17 @@
1
+ // Application code has no generic API to type, so it needs no way around the type checker: a value
2
+ // of unknown shape is decoded with a schema or narrowed with a guard. Library code keeps `/base`,
3
+ // where `/anti-slop` asks each assertion for a comment that says why it is safe.
4
+ // `satisfies` keeps `rules` defined, so an override, which cannot extend, can take them.
5
+ const app = {
6
+ plugins: ["typescript"],
7
+ rules: {
8
+ // `as const` and `satisfies` pass: neither changes what the checker believes.
9
+ "typescript/consistent-type-assertions": ["error", { assertionStyle: "never" }],
10
+ "typescript/ban-ts-comment": [
11
+ "error",
12
+ { "ts-expect-error": true, "ts-ignore": true, "ts-nocheck": true, "ts-check": false },
13
+ ],
14
+ },
15
+ };
16
+ export default app;
17
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sources":["../src/app.ts"],"names":[],"mappings":"AAEA,mGAAmG;AACnG,kGAAkG;AAClG,iFAAiF;AACjF,yFAAyF;AACzF,MAAM,GAAG,GAAG;IACV,OAAO,EAAE,CAAC,YAAY,CAAC;IACvB,KAAK,EAAE;QACL,8EAA8E;QAC9E,uCAAuC,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;QAC/E,2BAA2B,EAAE;YAC3B,OAAO;YACP,EAAE,iBAAiB,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;SACtF;KACF;CACqB,CAAC;AAEzB,eAAe,GAAG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAM3C,QAAA,MAAM,IAAI,EAAE,YA8CX,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"base.d.ts","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAM3C,QAAA,MAAM,IAAI,EAAE,YAkDX,CAAC;AAEF,eAAe,IAAI,CAAC"}
package/dist/base.js CHANGED
@@ -21,7 +21,11 @@ const base = {
21
21
  "sonarjs/cognitive-complexity": ["error", 15],
22
22
  "max-depth": ["error", 3],
23
23
  "typescript/no-explicit-any": "error",
24
- "typescript/switch-exhaustiveness-check": "error",
24
+ // A `default` on a switch that already names every member would hide a member added later.
25
+ "typescript/switch-exhaustiveness-check": [
26
+ "error",
27
+ { allowDefaultCaseForExhaustiveSwitch: false },
28
+ ],
25
29
  "typescript/no-deprecated": "error",
26
30
  "typescript/no-unsafe-assignment": "error",
27
31
  "typescript/no-unsafe-argument": "error",
package/dist/base.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sources":["../src/base.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAEhE,MAAM,IAAI,GAAiB;IACzB,SAAS,EAAE;QACT;YACE,IAAI,EAAE,KAAK;YACX,SAAS,EAAE,aAAa,CAAC,IAAI,GAAG,CAAC,YAAY,SAAS,EAAE,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;SAC5E;QACD,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC,EAAE;KAC5F;IACD,OAAO,EAAE,CAAC,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC;IACnD,UAAU,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE;IACpC,KAAK,EAAE;QACL,+BAA+B,EAAE,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;QACrE,oBAAoB,EAAE,OAAO;QAC7B,mCAAmC,EAAE,OAAO;QAC5C,2BAA2B,EAAE;YAC3B,OAAO;YACP,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;SACvF;QACD,8BAA8B,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;QAC7C,WAAW,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACzB,4BAA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B,EAAE,OAAO;QAChC,2BAA2B,EAAE,OAAO;QACpC,sBAAsB,EAAE,CAAC,OAAO,EAAE,EAAE,wBAAwB,EAAE,IAAI,EAAE,CAAC;QACrE,MAAM,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAC/C,QAAQ,EAAE,OAAO;QACjB,8BAA8B,EAAE,OAAO;QACvC,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;QACpF,aAAa,EAAE,OAAO;QACtB,cAAc,EAAE,OAAO;KACxB;IACD,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,6BAA6B,EAAE,OAAO,EAAE;CACrE,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const classRule: import("@oxlint/plugins").Rule;
2
+ //# sourceMappingURL=class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class.d.ts","sources":["../../src/effect-ui-stylex/class.ts"],"names":[],"mappings":"AA6DA,eAAO,MAAM,SAAS,gCA8EpB,CAAC"}
@@ -0,0 +1,109 @@
1
+ import { defineRule } from "@oxlint/plugins";
2
+ import { exportOf, importsOf, keyOf } from "../rules/imports.js";
3
+ import { drawnOf } from "./components.js";
4
+ import { elementOf } from "./parts.js";
5
+ const stylex = "@stylexjs/stylex";
6
+ // `stylex.attrs(...)` or `stylex.props(...)`, whose result holds a class.
7
+ const isStylexAttributes = (node, imports) => {
8
+ const runtime = node.type === "CallExpression" ? exportOf(node.callee, imports, stylex) : "";
9
+ return runtime === "attrs" || runtime === "props";
10
+ };
11
+ // Whether the argument of `.attrs(...)` holds a class: `stylex.attrs(...)` itself, or an object
12
+ // with a `class` key or a spread of `stylex.attrs(...)`.
13
+ const holdsClass = (argument, imports) => {
14
+ if (argument === undefined)
15
+ return false;
16
+ if (isStylexAttributes(argument, imports))
17
+ return true;
18
+ return (argument.type === "ObjectExpression" &&
19
+ argument.properties.some((property) => property.type === "Property"
20
+ ? keyOf(property) === "class"
21
+ : isStylexAttributes(property.argument, imports)));
22
+ };
23
+ // A call that sets an element's class: `.class(...)`, `.attr("class", ...)` or `.attrs(...)`
24
+ // with a class in it. Effect UI's `class` is `attr("class", ...)`, so each replaces the class the
25
+ // builder had.
26
+ const setsClass = (node, imports) => {
27
+ if (node.type !== "CallExpression")
28
+ return false;
29
+ const { callee } = node;
30
+ const [first] = node.arguments;
31
+ const method = callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier"
32
+ ? callee.property.name
33
+ : undefined;
34
+ if (method === "attr")
35
+ return first?.type === "Literal" && first.value === "class";
36
+ if (method === "attrs")
37
+ return holdsClass(first, imports);
38
+ return method === "class";
39
+ };
40
+ // What a builder is written as, under what only changes its type or guards a missing one.
41
+ const unwrapped = (node) => node?.type === "ChainExpression" || node?.type === "TSNonNullExpression"
42
+ ? unwrapped(node.expression)
43
+ : node;
44
+ export const classRule = defineRule({
45
+ meta: {
46
+ type: "problem",
47
+ docs: {
48
+ description: "Keep one class call per element, and pass styles for a drawn element as its style option.",
49
+ },
50
+ schema: [],
51
+ messages: {
52
+ look: "Pass these styles as the `style` option of {{drawn}}, which applies them after its look in one stylex.attrs call. Effect UI keeps the last class a builder gets, so this call replaces the look {{drawn}} drew.",
53
+ element: "Pass these styles as the `style` option of {{drawn}}. It sets the class of the element it is given, so the class this element has is replaced.",
54
+ oneCall: "Pass every style of this element to one stylex.attrs(...) call, conditions included. Effect UI keeps the last class a builder gets, so this call replaces the class before it, and StyleX resolves two styles that set one property only within one call.",
55
+ },
56
+ },
57
+ createOnce(context) {
58
+ let imports = new Map();
59
+ // The call before `node` in the chain of one element: the receiver of a method, as `h.div` in
60
+ // `h.div.children(...)`, or the builder a part or a view function took.
61
+ const before = (node) => {
62
+ const { callee } = node;
63
+ const isChained = callee.type === "MemberExpression" && callee.object.type !== "Identifier";
64
+ return unwrapped(isChained ? callee.object : elementOf(context.sourceCode, node));
65
+ };
66
+ // The drawn function that made the builder `node` evaluates to: `Button` for `Button(h)`, for
67
+ // what is chained on it and for a part that took it, as `dialog.trigger(Button(h))`.
68
+ const drawnBy = (node) => {
69
+ if (node?.type !== "CallExpression")
70
+ return undefined;
71
+ return drawnOf(node.callee, imports) ?? drawnBy(before(node));
72
+ };
73
+ // The call in the chain of `node` that sets its class, if one does.
74
+ const classCallIn = (node) => {
75
+ if (node?.type !== "CallExpression")
76
+ return undefined;
77
+ return setsClass(node, imports) ? node : classCallIn(before(node));
78
+ };
79
+ const nameOf = (node) => node.callee.type === "MemberExpression" ? node.callee.property : node;
80
+ return {
81
+ Program(program) {
82
+ imports = importsOf(program);
83
+ },
84
+ CallExpression(node) {
85
+ const drawn = drawnOf(node.callee, imports);
86
+ // The element a drawn function is given: its look replaces a class set on it.
87
+ if (drawn !== undefined) {
88
+ const given = classCallIn(unwrapped(elementOf(context.sourceCode, node)));
89
+ if (given !== undefined) {
90
+ context.report({ node: nameOf(given), messageId: "element", data: { drawn } });
91
+ }
92
+ return;
93
+ }
94
+ if (!setsClass(node, imports))
95
+ return;
96
+ const earlier = before(node);
97
+ const look = drawnBy(earlier);
98
+ // At the method's name: the call itself starts where the element's whole chain does.
99
+ if (look !== undefined) {
100
+ context.report({ node: nameOf(node), messageId: "look", data: { drawn: look } });
101
+ }
102
+ else if (classCallIn(earlier) !== undefined) {
103
+ context.report({ node: nameOf(node), messageId: "oneCall" });
104
+ }
105
+ },
106
+ };
107
+ },
108
+ });
109
+ //# sourceMappingURL=class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class.js","sources":["../../src/effect-ui-stylex/class.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAgB,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE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8E;gBAC9E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,MAAM,KAAK,GAAG,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;oBAE1E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;wBACxB,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;oBACjF,CAAC;oBAED,OAAO;gBACT,CAAC;gBAED,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC;oBAAE,OAAO;gBAEtC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;gBAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;gBAE9B,qFAAqF;gBACrF,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;oBACvB,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;gBACnF,CAAC;qBAAM,IAAI,WAAW,CAAC,OAAO,CAAC,KAAK,SAAS,EAAE,CAAC;oBAC9C,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC;gBAC/D,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { ESTree } from "@oxlint/plugins";
2
+ import { type Imports } from "../rules/imports.ts";
3
+ /**
4
+ * For each component a module of the library exports from effect/ui/kit, the parts its `view`
5
+ * gets that the module has a drawn function for: `DialogPopup` draws `dialog.popup`. A test
6
+ * derives the table from the library's source, so add a part in the change that adds its
7
+ * function.
8
+ */
9
+ export declare const drawnParts: ReadonlyMap<string, ReadonlyArray<string>>;
10
+ /**
11
+ * The components whose parts another component's functions draw: a `ContextMenu` is a menu at the
12
+ * pointer, drawn with `Menu`'s, and a `ToastProvider`'s parts are the toasts', named `Toast`.
13
+ */
14
+ export declare const drawnAs: ReadonlyMap<string, string>;
15
+ /** The function that draws a component's part: `DialogPopup` for `Dialog` and `popup`. */
16
+ export declare const drawnFunction: (component: string, part: string) => string;
17
+ /**
18
+ * The export of the library `node` names, with its module: `Button` and
19
+ * `@kutur-kit/effect-ui-stylex/button` for the callee of `Button(h)`.
20
+ */
21
+ export declare const libraryExportOf: (node: ESTree.Node, imports: Imports) => {
22
+ name: string;
23
+ module: string;
24
+ } | undefined;
25
+ /**
26
+ * The drawn function a call's callee names: an export of the library that starts with a capital,
27
+ * as `Button`, `DialogPopup` and the icons do. `buttonStyles` returns styles, not an element.
28
+ */
29
+ export declare const drawnOf: (node: ESTree.Node, imports: Imports) => string | undefined;
30
+ //# sourceMappingURL=components.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.d.ts","sources":["../../src/effect-ui-stylex/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,qBAAqB,CAAC;AAG5D;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAyIhE,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAG9C,CAAC;AAEH,0FAA0F;AAC1F,eAAO,MAAM,aAAa,cAAe,MAAM,QAAQ,MAAM,WAC8B,CAAC;AAE5F;;;GAGG;AACH,eAAO,MAAM,eAAe,SAAU,MAAM,CAAC,IAAI,WAAW,OAAO;;;aAMlE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,SAAU,MAAM,CAAC,IAAI,WAAW,OAAO,uBAI1D,CAAC"}
@@ -0,0 +1,175 @@
1
+ import { resolve } from "../rules/imports.js";
2
+ import { library } from "./modules.js";
3
+ /**
4
+ * For each component a module of the library exports from effect/ui/kit, the parts its `view`
5
+ * gets that the module has a drawn function for: `DialogPopup` draws `dialog.popup`. A test
6
+ * derives the table from the library's source, so add a part in the change that adds its
7
+ * function.
8
+ */
9
+ export const drawnParts = new Map([
10
+ ["Accordion", ["root"]],
11
+ ["AccordionItem", ["header", "panel", "root", "trigger"]],
12
+ ["AlertDialog", ["backdrop", "description", "popup", "title", "viewport"]],
13
+ [
14
+ "Autocomplete",
15
+ [
16
+ "clear",
17
+ "empty",
18
+ "group",
19
+ "groupLabel",
20
+ "input",
21
+ "inputGroup",
22
+ "item",
23
+ "label",
24
+ "list",
25
+ "popup",
26
+ "positioner",
27
+ "row",
28
+ "separator",
29
+ "status",
30
+ "trigger",
31
+ ],
32
+ ],
33
+ ["Avatar", ["fallback", "image", "root"]],
34
+ ["Calendar", ["cell", "day", "grid", "heading", "next", "previous", "root", "weekday"]],
35
+ ["Checkbox", ["indicator", "root"]],
36
+ ["CheckboxGroup", ["root"]],
37
+ ["Collapsible", ["panel", "root", "trigger"]],
38
+ [
39
+ "Combobox",
40
+ [
41
+ "chip",
42
+ "chipRemove",
43
+ "chips",
44
+ "clear",
45
+ "empty",
46
+ "group",
47
+ "groupLabel",
48
+ "input",
49
+ "inputGroup",
50
+ "item",
51
+ "label",
52
+ "list",
53
+ "popup",
54
+ "positioner",
55
+ "row",
56
+ "separator",
57
+ "status",
58
+ "trigger",
59
+ ],
60
+ ],
61
+ [
62
+ "ContextMenu",
63
+ [
64
+ "backdrop",
65
+ "checkboxItem",
66
+ "checkboxItemIndicator",
67
+ "clear",
68
+ "empty",
69
+ "group",
70
+ "groupLabel",
71
+ "input",
72
+ "item",
73
+ "linkItem",
74
+ "list",
75
+ "popup",
76
+ "positioner",
77
+ "radioGroup",
78
+ "radioItem",
79
+ "radioItemIndicator",
80
+ "separator",
81
+ "submenuTrigger",
82
+ ],
83
+ ],
84
+ ["DateField", ["input"]],
85
+ ["DatePicker", ["input", "popup", "positioner", "trigger"]],
86
+ ["Dialog", ["backdrop", "close", "description", "popup", "title", "viewport"]],
87
+ [
88
+ "Drawer",
89
+ ["backdrop", "close", "content", "description", "popup", "swipeArea", "title", "viewport"],
90
+ ],
91
+ ["DrawerProvider", ["indent", "indentBackground"]],
92
+ ["Field", ["description", "error", "label", "root"]],
93
+ ["Fieldset", ["legend", "root"]],
94
+ ["FileDrop", ["root"]],
95
+ ["Form", ["root"]],
96
+ [
97
+ "Menu",
98
+ [
99
+ "backdrop",
100
+ "checkboxItem",
101
+ "checkboxItemIndicator",
102
+ "clear",
103
+ "empty",
104
+ "group",
105
+ "groupLabel",
106
+ "input",
107
+ "item",
108
+ "linkItem",
109
+ "list",
110
+ "popup",
111
+ "positioner",
112
+ "radioGroup",
113
+ "radioItem",
114
+ "radioItemIndicator",
115
+ "separator",
116
+ "submenuTrigger",
117
+ ],
118
+ ],
119
+ ["Menubar", ["root"]],
120
+ ["Meter", ["indicator", "label", "root", "track", "value"]],
121
+ ["NavigationMenu", ["item", "link", "list", "root"]],
122
+ [
123
+ "NumberField",
124
+ ["decrement", "group", "increment", "input", "root", "scrubArea", "scrubAreaCursor"],
125
+ ],
126
+ ["OTPField", ["input", "root"]],
127
+ ["Popover", ["arrow", "backdrop", "description", "popup", "positioner", "title"]],
128
+ ["PreviewCard", ["arrow", "popup", "positioner"]],
129
+ ["Progress", ["indicator", "label", "root", "track", "value"]],
130
+ ["RadioGroup", ["indicator", "radio", "root"]],
131
+ ["RangeCalendar", ["day"]],
132
+ ["ScrollArea", ["content", "corner", "root", "scrollbar", "viewport"]],
133
+ [
134
+ "Select",
135
+ ["group", "groupLabel", "item", "label", "popup", "positioner", "separator", "trigger"],
136
+ ],
137
+ ["Slider", ["control", "indicator", "root", "thumb", "track", "value"]],
138
+ ["Switch", ["root", "thumb"]],
139
+ ["Tabs", ["indicator", "list", "panel", "root", "tab"]],
140
+ ["TimeField", ["input"]],
141
+ ["ToastProvider", ["action", "close", "content", "description", "root", "title", "viewport"]],
142
+ ["ToggleGroup", ["item", "root"]],
143
+ ["Toolbar", ["button", "group", "input", "link", "root", "separator"]],
144
+ ["Tooltip", ["arrow", "popup", "positioner"]],
145
+ ["VirtualList", ["item", "list", "table", "viewport"]],
146
+ ]);
147
+ /**
148
+ * The components whose parts another component's functions draw: a `ContextMenu` is a menu at the
149
+ * pointer, drawn with `Menu`'s, and a `ToastProvider`'s parts are the toasts', named `Toast`.
150
+ */
151
+ export const drawnAs = new Map([
152
+ ["ContextMenu", "Menu"],
153
+ ["ToastProvider", "Toast"],
154
+ ]);
155
+ /** The function that draws a component's part: `DialogPopup` for `Dialog` and `popup`. */
156
+ export const drawnFunction = (component, part) => `${drawnAs.get(component) ?? component}${part.slice(0, 1).toUpperCase()}${part.slice(1)}`;
157
+ /**
158
+ * The export of the library `node` names, with its module: `Button` and
159
+ * `@kutur-kit/effect-ui-stylex/button` for the callee of `Button(h)`.
160
+ */
161
+ export const libraryExportOf = (node, imports) => {
162
+ const resolved = resolve(node, imports);
163
+ return resolved?.source.startsWith(`${library}/`) === true
164
+ ? { name: resolved.path, module: resolved.source }
165
+ : undefined;
166
+ };
167
+ /**
168
+ * The drawn function a call's callee names: an export of the library that starts with a capital,
169
+ * as `Button`, `DialogPopup` and the icons do. `buttonStyles` returns styles, not an element.
170
+ */
171
+ export const drawnOf = (node, imports) => {
172
+ const exported = libraryExportOf(node, imports);
173
+ return exported !== undefined && /^[A-Z]\w*$/.test(exported.name) ? exported.name : undefined;
174
+ };
175
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sources":["../../src/effect-ui-stylex/components.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,OAAO,EAAE,M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