@jonmilner/ui 0.3.1 → 0.3.2

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,21 @@
1
+ # Lint
2
+
3
+ `@jonmilner/ui/lint` holds the options for `uiLint()` from `@jonmilner/oxlint-config` that follow the library's components. Import it in the app's `vite.config.ts`; nothing in it runs in the app.
4
+
5
+ ## textComponents
6
+
7
+ The library's components and parts that render their children through `Text`. Pass it as `textComponents`, so documented usage such as `<Tabs.Tab>Privacy</Tabs.Tab>` or `<Field.Label>Email</Field.Label>` passes `ui/no-bare-text`.
8
+
9
+ ```ts
10
+ import { lint, uiLint } from "@jonmilner/oxlint-config";
11
+ import { textComponents } from "@jonmilner/ui/lint";
12
+ import { defineConfig } from "vite-plus";
13
+
14
+ export default defineConfig({
15
+ lint: { ...lint, ...uiLint({ textComponents: [...textComponents, "VisuallyHidden"] }) },
16
+ });
17
+ ```
18
+
19
+ - The option replaces the preset's default list, so add the app's own text components (here `VisuallyHidden`) after the library's.
20
+ - Never copy the list into the app: it changes with the library, and an upgrade brings the new parts.
21
+ - The rule matches a tag's last segment: `Tabs.Tab` is `Tab`. So `Item` and `Label` pass any component's part of that name, and `Trigger` and `Close` pass even without the look (`variant`, `size`, an icon) that makes them a Button. Give a look-less `Trigger` or `Close` a `Text` child yourself.
@@ -30,4 +30,5 @@
30
30
 
31
31
  - [manifest.json](manifest.json): every component, prop, variant, icon and token, as JSON
32
32
  - [theming.md](theming.md): themes, brands and tokens
33
+ - [lint.md](lint.md): the `uiLint()` options the library ships
33
34
  - [migrations/](migrations/README.md): upgrade notes for breaking releases
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "./manifest.schema.json",
3
3
  "package": "@jonmilner/ui",
4
- "version": "0.3.1",
4
+ "version": "0.3.2",
5
5
  "components": [
6
6
  {
7
7
  "name": "AlertDialog",
@@ -0,0 +1,9 @@
1
+ //#region src/lint/index.d.ts
2
+ /**
3
+ * The library's components and parts that render their children through `Text`, for the
4
+ * `textComponents` option of `uiLint()` from `@jonmilner/oxlint-config`. A part is named by its
5
+ * property (`Tabs.Tab` is `Tab`). Spread it and add the app's own text components; see
6
+ * `docs/lint.md`.
7
+ */
8
+ export declare const textComponents: readonly string[];
9
+ //#endregion
@@ -0,0 +1,18 @@
1
+ //#region src/lint/index.ts
2
+ var e = Object.freeze([
3
+ "Text",
4
+ "Heading",
5
+ "Button",
6
+ "Badge",
7
+ "Tag",
8
+ "Chip",
9
+ "Tab",
10
+ "Item",
11
+ "Label",
12
+ "Error",
13
+ "Description",
14
+ "Trigger",
15
+ "Close"
16
+ ]);
17
+ //#endregion
18
+ export { e as textComponents };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonmilner/ui",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "files": [
5
5
  "dist",
6
6
  "THIRD_PARTY_NOTICES.md"
@@ -114,6 +114,10 @@
114
114
  "types": "./dist/testing/index.d.mts",
115
115
  "default": "./dist/testing/index.mjs"
116
116
  },
117
+ "./lint": {
118
+ "types": "./dist/lint/index.d.mts",
119
+ "default": "./dist/lint/index.mjs"
120
+ },
117
121
  "./base.css": "./dist/base.css",
118
122
  "./docs/*": "./dist/docs/*"
119
123
  },