@vvedantb/config 0.7.2 → 0.8.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#273](https://github.com/vvedantb/packages/pull/273) [`2db587f`](https://github.com/vvedantb/packages/commit/2db587ffc66fed29c86e8562f7f9b5bcb30e06c6) Thanks [@vvedantb](https://github.com/vvedantb)! - Soften the synced `## UI copy` section: subtext is the exception, allowed where the user needs it and nothing else on screen says it. The `vvedantb/no-settings-description` rule stays opt-in for apps that want a hard ban.
8
+
9
+ ## 0.8.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#272](https://github.com/vvedantb/packages/pull/272) [`712a66e`](https://github.com/vvedantb/packages/commit/712a66eb2f9567df914ef2f34da5db5433333650) Thanks [@vvedantb](https://github.com/vvedantb)! - Add the `vvedantb/no-settings-description` oxlint rule, which flags a `description` prop on `SettingsSection`, `SettingsToggleRow` and `LabeledSwitchRow` (option `components` adds names). `vvedantb-config sync` now adds a `## UI copy` section to `CLAUDE.md` when it is missing.
14
+
3
15
  ## 0.7.2
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -57,7 +57,7 @@ The package ships two oxlint JS plugins. Both load with oxlint 1.79 or later (th
57
57
 
58
58
  #### `vvedantb` plugin: `@vvedantb/config/oxlint/plugin.mjs`
59
59
 
60
- Eleven rules, with no app prefix:
60
+ Twelve rules, with no app prefix:
61
61
 
62
62
  | Rule | Flags |
63
63
  | --- | --- |
@@ -66,6 +66,7 @@ Eleven rules, with no app prefix:
66
66
  | `no-double-cast` | A double cast such as `x as A as B` or `x as unknown as T`. |
67
67
  | `no-json-parse` | A bare `JSON.parse(...)` result that flows unchecked. `schema.parse(JSON.parse(x))` / `schema.safeParse(...)` are always allowed. With `{ "allowUnknownEscapeHatch": true }`, a `: unknown` annotation or `as unknown` cast is also allowed. |
68
68
  | `no-is-record` | Any identifier named `isRecord`. An `unknown` leaked in; type the data at its entry point instead. |
69
+ | `no-settings-description` | A `description` prop on `SettingsSection`, `SettingsToggleRow` or `LabeledSwitchRow`. Opt in only where an app wants a hard ban; the default guidance is the `## UI copy` section, which allows a description where the user needs one. `{ "components": ["ProfileCard"] }` adds component names. |
69
70
  | `no-ts-nocheck` | `@ts-nocheck` and `@ts-ignore` comments. `@ts-expect-error` with a reason stays allowed. |
70
71
  | `no-conditional-tests` | An `expect(...)` call inside an `if`, `?:`, `&&`/`\|\|` or `switch` case in a test file. |
71
72
  | `no-inline-object-type-assertion` | `x as { … }` and `x as Record<string, unknown>`. |
@@ -515,7 +516,7 @@ In `package.json` scripts, call `vvedantb-config sync --check` directly. Without
515
516
  | Target | Behaviour |
516
517
  | --- | --- |
517
518
  | `.claude/commands/{stage,changelog,push,ship}.md` | Managed. Overwritten on every sync. |
518
- | `CLAUDE.md` | Created from a skeleton if missing. If present, the four headings (`## Git / ship`, `## Always`, `## Domain docs (read when relevant)`, `## Product facts`) are appended when absent. Existing bodies, including Product facts, are never changed. Drift means a missing heading only. |
519
+ | `CLAUDE.md` | Created from a skeleton if missing. If present, the five headings (`## Git / ship`, `## Always`, `## UI copy`, `## Domain docs (read when relevant)`, `## Product facts`) are appended when absent. Existing bodies, including Product facts, are never changed. Drift means a missing heading only. |
519
520
  | `.cursor/environment.json` | Created if missing. If present, other keys are kept. `install` gains the Claude Code CLI step (sudo, then `~/.local` fallback) and `pnpm install` when either is absent. |
520
521
  | `convex/tsconfig.json` or `packages/backend/convex/tsconfig.json` | Only when that folder exists. Created if missing. If present, `extends` is set to `@vvedantb/config/tsconfig/convex.json`; other keys are kept. Comments in an existing file are lost on rewrite. |
521
522
 
package/dist/sync.js CHANGED
@@ -22,6 +22,14 @@ const CLAUDE_SECTIONS = [
22
22
  "- Prefer simplicity. No premature abstractions.",
23
23
  ].join("\n"),
24
24
  },
25
+ {
26
+ heading: "## UI copy",
27
+ body: [
28
+ "- Subtext is the exception, not the default. Most sections, cards and rows show a title only.",
29
+ "- Add a description only when the user needs it to act and the title, value or badge does not already say it (a price, a limit, a warning).",
30
+ "- Never repeat the title, the value, a badge or a nearby row. Say each thing once, in plain words.",
31
+ ].join("\n"),
32
+ },
25
33
  {
26
34
  heading: "## Domain docs (read when relevant)",
27
35
  body: "- (add pointers to this app's docs)",
package/oxlint/plugin.mjs CHANGED
@@ -15,7 +15,7 @@
15
15
  // }
16
16
  // }
17
17
  //
18
- // Eleven rules ship; see the package README for the full list.
18
+ // Twelve rules ship; see the package README for the full list.
19
19
  // oxlint reports each as `vvedantb(<rule>)`.
20
20
 
21
21
  import noDoubleCast from "./rules/no-double-cast.mjs";
@@ -24,6 +24,7 @@ import noConditionalTests from "./rules/no-conditional-tests.mjs";
24
24
  import noInlineObjectTypeAssertion from "./rules/no-inline-object-type-assertion.mjs";
25
25
  import noInlineZodSchema from "./rules/no-inline-zod-schema.mjs";
26
26
  import noIsRecord from "./rules/no-is-record.mjs";
27
+ import noSettingsDescription from "./rules/no-settings-description.mjs";
27
28
  import noTsNocheck from "./rules/no-ts-nocheck.mjs";
28
29
  import noUnknownShapeProbing from "./rules/no-unknown-shape-probing.mjs";
29
30
  import preferSchemaInferredTypes from "./rules/prefer-schema-inferred-types.mjs";
@@ -39,6 +40,7 @@ export default {
39
40
  "no-inline-zod-schema": noInlineZodSchema,
40
41
  "no-is-record": noIsRecord,
41
42
  "no-json-parse": noJsonParse,
43
+ "no-settings-description": noSettingsDescription,
42
44
  "no-source-text-in-tests": noSourceTextInTests,
43
45
  "no-ts-nocheck": noTsNocheck,
44
46
  "no-unknown-shape-probing": noUnknownShapeProbing,
@@ -0,0 +1,51 @@
1
+ // Flags a `description` prop on the settings layout components. A section or
2
+ // row shows a title only; helper text under it is extra reading for the user.
3
+ // Options: `{ "components": ["ProfileCard"] }` adds component names to the
4
+ // built-in list.
5
+
6
+ const DEFAULT_COMPONENTS = ["SettingsSection", "SettingsToggleRow", "LabeledSwitchRow"];
7
+
8
+ function elementName(name) {
9
+ if (!name) return null;
10
+ if (name.type === "JSXIdentifier") return name.name;
11
+ if (name.type === "JSXMemberExpression") return name.property.name;
12
+ return null;
13
+ }
14
+
15
+ export default {
16
+ meta: {
17
+ type: "suggestion",
18
+ docs: {
19
+ description:
20
+ "Disallow the `description` prop on settings sections and rows; show a title only.",
21
+ },
22
+ schema: [
23
+ {
24
+ type: "object",
25
+ properties: {
26
+ components: { type: "array", items: { type: "string" } },
27
+ },
28
+ additionalProperties: false,
29
+ },
30
+ ],
31
+ },
32
+ create(context) {
33
+ const extra = context.options[0]?.components ?? [];
34
+ const components = new Set([...DEFAULT_COMPONENTS, ...extra]);
35
+ return {
36
+ JSXOpeningElement(node) {
37
+ const name = elementName(node.name);
38
+ if (!name || !components.has(name)) return;
39
+ for (const attribute of node.attributes) {
40
+ if (attribute.type !== "JSXAttribute") continue;
41
+ if (attribute.name.type !== "JSXIdentifier") continue;
42
+ if (attribute.name.name !== "description") continue;
43
+ context.report({
44
+ message: `Remove \`description\` from <${name}>. A section or row shows a title only; do not add helper text unless the user asks for it.`,
45
+ node: attribute,
46
+ });
47
+ }
48
+ },
49
+ };
50
+ },
51
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/config",
3
- "version": "0.7.2",
3
+ "version": "0.8.1",
4
4
  "license": "MIT",
5
5
  "description": "Shared tsconfig bases, oxlint base, Vite, Vitest, Babel and Metro presets, a WXT preset and host-permission helper for Chrome extensions, pinned tool versions, a sync CLI for Claude commands, CLAUDE.md, Cursor environment and Convex tsconfig, a packaged Electron app.asar module check, a shared header and footer check, a no-source-text-in-tests check, shared oxlint JS plugins and a CLI that adds an extension to Clerk's allowed origins.",
6
6
  "type": "module",