@vvedantb/config 0.7.2 → 0.8.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.
- package/CHANGELOG.md +6 -0
- package/README.md +3 -2
- package/dist/sync.js +8 -0
- package/oxlint/plugin.mjs +3 -1
- package/oxlint/rules/no-settings-description.mjs +51 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
3
9
|
## 0.7.2
|
|
4
10
|
|
|
5
11
|
### 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
|
-
|
|
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`. A section or row shows a title only. `{ "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
|
|
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
|
+
"- A section, card or row shows a title only. Do not add a description, subtitle or helper text under it unless the user asks.",
|
|
29
|
+
"- Keep user-visible text short: say each thing once, in plain words.",
|
|
30
|
+
"- Lint rule `vvedantb/no-settings-description` enforces this for the settings components.",
|
|
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
|
-
//
|
|
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.
|
|
3
|
+
"version": "0.8.0",
|
|
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",
|