@agentvibes/guardrails 0.2.8 → 0.3.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/README.md +252 -5
- package/candidates/README.md +13 -13
- package/candidates/r10-as-cast.yml +4 -4
- package/candidates/r1d-scattered-numeric-const-in-component.yml +3 -3
- package/candidates/r2-helper-fn-in-tsx.yml +3 -3
- package/candidates/r3-hooks-outside-layout.yml +4 -4
- package/candidates/r6-jsx-comment-smell.yml +2 -2
- package/candidates/r7-raw-hsl-outside-tokens.yml +3 -3
- package/candidates/r8-inline-style-prop.yml +2 -2
- package/candidates/r9-optional-store-arg.yml +2 -2
- package/dist/astGrep.js +4 -2
- package/dist/astGrep.js.map +1 -1
- package/dist/cli.js +89 -6
- package/dist/cli.js.map +1 -1
- package/dist/cliArgsTest.d.ts +1 -0
- package/dist/cliArgsTest.js +44 -0
- package/dist/cliArgsTest.js.map +1 -0
- package/dist/doctor.d.ts +1 -1
- package/dist/doctor.js +58 -6
- package/dist/doctor.js.map +1 -1
- package/dist/fileSloc.d.ts +28 -0
- package/dist/fileSloc.js +72 -0
- package/dist/fileSloc.js.map +1 -0
- package/dist/fileSlocBaseline.d.ts +78 -0
- package/dist/fileSlocBaseline.js +173 -0
- package/dist/fileSlocBaseline.js.map +1 -0
- package/dist/fileSlocGate.d.ts +17 -0
- package/dist/fileSlocGate.js +75 -0
- package/dist/fileSlocGate.js.map +1 -0
- package/dist/fileSlocTest.d.ts +1 -0
- package/dist/fileSlocTest.js +172 -0
- package/dist/fileSlocTest.js.map +1 -0
- package/dist/fileWalk.js +1 -1
- package/dist/fileWalk.js.map +1 -1
- package/dist/findings.d.ts +1 -1
- package/dist/gateRed.d.ts +1 -1
- package/dist/gateRed.js +1 -0
- package/dist/gateRed.js.map +1 -1
- package/dist/gitDiff.d.ts +6 -0
- package/dist/gitDiff.js +25 -0
- package/dist/gitDiff.js.map +1 -1
- package/dist/hookStop.d.ts +2 -1
- package/dist/hookStop.js +7 -1
- package/dist/hookStop.js.map +1 -1
- package/dist/hookStopTest.d.ts +1 -1
- package/dist/hookStopTest.js +1 -0
- package/dist/hookStopTest.js.map +1 -1
- package/dist/init.js +1 -1
- package/dist/init.js.map +1 -1
- package/dist/initTest.d.ts +1 -1
- package/dist/initTest.js +2 -1
- package/dist/initTest.js.map +1 -1
- package/dist/iterateTest.d.ts +1 -1
- package/dist/iterateTest.js +1 -0
- package/dist/iterateTest.js.map +1 -1
- package/dist/jsxSuppress.js +1 -1
- package/dist/jsxSuppress.js.map +1 -1
- package/dist/jsxSuppressTest.d.ts +1 -1
- package/dist/jsxSuppressTest.js +4 -2
- package/dist/jsxSuppressTest.js.map +1 -1
- package/dist/leaksRed.d.ts +1 -1
- package/dist/leaksRed.js +1 -0
- package/dist/leaksRed.js.map +1 -1
- package/dist/metrics.d.ts +9 -0
- package/dist/metrics.js +96 -7
- package/dist/metrics.js.map +1 -1
- package/dist/metricsBaseline.js +1 -1
- package/dist/metricsBaseline.js.map +1 -1
- package/dist/metricsCollect.js +2 -45
- package/dist/metricsCollect.js.map +1 -1
- package/dist/metricsCycle.d.ts +1 -1
- package/dist/metricsCycle.js +1 -0
- package/dist/metricsCycle.js.map +1 -1
- package/dist/metricsTypes.d.ts +1 -1
- package/dist/overrideDeclarations.d.ts +35 -0
- package/dist/overrideDeclarations.js +94 -0
- package/dist/overrideDeclarations.js.map +1 -0
- package/dist/overrides.d.ts +35 -0
- package/dist/overrides.js +284 -0
- package/dist/overrides.js.map +1 -0
- package/dist/overridesTest.d.ts +1 -0
- package/dist/overridesTest.js +183 -0
- package/dist/overridesTest.js.map +1 -0
- package/dist/pipeOutputTest.d.ts +1 -1
- package/dist/pipeOutputTest.js +2 -1
- package/dist/pipeOutputTest.js.map +1 -1
- package/dist/presetDrift.d.ts +8 -0
- package/dist/presetDrift.js +91 -34
- package/dist/presetDrift.js.map +1 -1
- package/dist/presetDriftTest.d.ts +1 -1
- package/dist/presetDriftTest.js +3 -3
- package/dist/presetDriftTest.js.map +1 -1
- package/dist/record/config.d.ts +17 -0
- package/dist/record/config.js +83 -0
- package/dist/record/config.js.map +1 -0
- package/dist/record/index.d.ts +69 -0
- package/dist/record/index.js +8 -0
- package/dist/record/index.js.map +1 -0
- package/dist/record/record.d.ts +56 -0
- package/dist/record/record.js +111 -0
- package/dist/record/record.js.map +1 -0
- package/dist/record/repoKey.d.ts +8 -0
- package/dist/record/repoKey.js +70 -0
- package/dist/record/repoKey.js.map +1 -0
- package/dist/record/repoMetrics.d.ts +14 -0
- package/dist/record/repoMetrics.js +124 -0
- package/dist/record/repoMetrics.js.map +1 -0
- package/dist/record/runRecord.d.ts +60 -0
- package/dist/record/runRecord.js +2 -0
- package/dist/record/runRecord.js.map +1 -0
- package/dist/record/schema.d.ts +31 -0
- package/dist/record/schema.js +201 -0
- package/dist/record/schema.js.map +1 -0
- package/dist/record/writer.d.ts +22 -0
- package/dist/record/writer.js +341 -0
- package/dist/record/writer.js.map +1 -0
- package/dist/recordTest.d.ts +1 -0
- package/dist/recordTest.js +422 -0
- package/dist/recordTest.js.map +1 -0
- package/dist/renameDiffTest.d.ts +1 -1
- package/dist/renameDiffTest.js +2 -1
- package/dist/renameDiffTest.js.map +1 -1
- package/dist/repoRules.js +1 -1
- package/dist/repoRules.js.map +1 -1
- package/dist/repoRulesTest.d.ts +1 -1
- package/dist/repoRulesTest.js +2 -1
- package/dist/repoRulesTest.js.map +1 -1
- package/dist/screenScope.js +4 -5
- package/dist/screenScope.js.map +1 -1
- package/dist/screenScopeTest.d.ts +1 -1
- package/dist/screenScopeTest.js +2 -1
- package/dist/screenScopeTest.js.map +1 -1
- package/dist/severityTest.d.ts +1 -1
- package/dist/severityTest.js +1 -0
- package/dist/severityTest.js.map +1 -1
- package/dist/siblingCloneTest.js +12 -12
- package/dist/siblingCloneTest.js.map +1 -1
- package/dist/snapshot.d.ts +2 -0
- package/dist/snapshot.js +118 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/snapshotTest.d.ts +1 -0
- package/dist/snapshotTest.js +194 -0
- package/dist/snapshotTest.js.map +1 -0
- package/dist/structure.js +2 -2
- package/dist/structure.js.map +1 -1
- package/dist/testIsolation.d.ts +1 -0
- package/dist/testIsolation.js +7 -0
- package/dist/testIsolation.js.map +1 -0
- package/dist/testPaths.d.ts +4 -0
- package/dist/testPaths.js +9 -0
- package/dist/testPaths.js.map +1 -0
- package/dist/testRules.js +3 -3
- package/dist/testRules.js.map +1 -1
- package/dist/time.d.ts +22 -0
- package/dist/time.js +77 -0
- package/dist/time.js.map +1 -0
- package/dist/timeTest.d.ts +1 -0
- package/dist/timeTest.js +103 -0
- package/dist/timeTest.js.map +1 -0
- package/dist/tomlTable.d.ts +1 -1
- package/dist/tomlTable.js +6 -3
- package/dist/tomlTable.js.map +1 -1
- package/dist/toolResolve.d.ts +6 -0
- package/dist/toolResolve.js +18 -0
- package/dist/toolResolve.js.map +1 -1
- package/dist/twinCoverageTest.js +1 -2
- package/dist/twinCoverageTest.js.map +1 -1
- package/dist/verify.d.ts +2 -1
- package/dist/verify.js +33 -5
- package/dist/verify.js.map +1 -1
- package/dist/verifyDiff.d.ts +3 -2
- package/dist/verifyDiff.js +58 -8
- package/dist/verifyDiff.js.map +1 -1
- package/dist/wiring.d.ts +31 -0
- package/dist/wiring.js +262 -0
- package/dist/wiring.js.map +1 -0
- package/dist/wiringTest.d.ts +1 -0
- package/dist/wiringTest.js +127 -0
- package/dist/wiringTest.js.map +1 -0
- package/package.json +18 -6
- package/rules/__fixtures__/demo-mode-by-default/bad.ts +1 -1
- package/rules/__fixtures__/demo-mode-by-default/bad.tsx +1 -1
- package/rules/__fixtures__/direct-store-import/bad.tsx +1 -1
- package/rules/__fixtures__/direct-store-import/good.tsx +2 -2
- package/rules/__fixtures__/discriminator-ternary/bad.tsx +1 -1
- package/rules/__fixtures__/discriminator-ternary/good.tsx +1 -1
- package/rules/__fixtures__/inline-map-row/bad.tsx +1 -1
- package/rules/__fixtures__/inline-map-row/good.tsx +1 -1
- package/rules/__fixtures__/missing-observer/bad.tsx +2 -2
- package/rules/__fixtures__/missing-observer/good.tsx +2 -2
- package/rules/__fixtures__/no-local-kit-clone/bad.ts +2 -2
- package/rules/__fixtures__/no-local-kit-clone/bad.tsx +2 -2
- package/rules/__fixtures__/state-loading-boolean-shape/good.ts +1 -1
- package/rules/__fixtures__/state-loading-boolean-shape/good.tsx +1 -1
- package/rules/__fixtures__/store-async-method/good.ts +1 -1
- package/rules/__fixtures__/store-async-method/good.tsx +1 -1
- package/rules/__fixtures__/store-context-provider/bad.ts +1 -1
- package/rules/__fixtures__/store-delegation-getter/bad.ts +1 -1
- package/rules/__fixtures__/store-delegation-getter/bad.tsx +1 -1
- package/rules/__fixtures__/store-delegation-getter/good.ts +3 -3
- package/rules/__fixtures__/store-delegation-getter/good.tsx +3 -3
- package/rules/__fixtures__/store-no-runinaction/bad.ts +1 -1
- package/rules/__fixtures__/store-no-runinaction/bad.tsx +1 -1
- package/rules/__fixtures__/store-no-runinaction/good.ts +1 -1
- package/rules/__fixtures__/store-no-runinaction/good.tsx +1 -1
- package/rules/__fixtures__/ts-pattern-dangling-match/bad.ts +1 -1
- package/rules/__fixtures__/ts-pattern-dangling-match/good.ts +2 -2
- package/rules/__fixtures__/ui-imports-app-store/src/ui/good.tsx +1 -1
- package/rules/__fixtures__/view-imports-store/good.view.tsx +1 -1
- package/rules/as-any-escape-tsx.yml +2 -2
- package/rules/as-any-escape.yml +2 -2
- package/rules/catch-empty-tsx.yml +3 -3
- package/rules/catch-empty.yml +3 -3
- package/rules/demo-mode-by-default-ts.yml +6 -7
- package/rules/demo-mode-by-default.yml +6 -7
- package/rules/direct-store-import.yml +15 -16
- package/rules/discriminator-ternary-ts.yml +1 -1
- package/rules/discriminator-ternary.yml +3 -3
- package/rules/hardcoded-url-in-component-ts.yml +1 -1
- package/rules/hardcoded-url-in-component.yml +5 -5
- package/rules/inline-map-row.yml +7 -7
- package/rules/instanceof-map-set-tsx.yml +2 -2
- package/rules/instanceof-map-set.yml +2 -2
- package/rules/kind-if-without-match-tsx.yml +1 -1
- package/rules/literal-union-in-component-tsx.yml +2 -2
- package/rules/literal-union-in-component.yml +7 -7
- package/rules/match-bool-to-null-ts.yml +1 -1
- package/rules/missing-observer.yml +5 -5
- package/rules/no-local-kit-clone-tsx.yml +2 -2
- package/rules/no-local-kit-clone.yml +2 -2
- package/rules/non-exhaustive-match-tsx.yml +4 -7
- package/rules/non-exhaustive-match.yml +2 -2
- package/rules/page-store-bare-usememo-tsx.yml +1 -1
- package/rules/page-store-bare-usememo.yml +1 -1
- package/rules/screen-file-styling.yml +3 -3
- package/rules/silent-default-return-tsx.yml +1 -1
- package/rules/store-async-method-tsx.yml +1 -1
- package/rules/store-async-method.yml +1 -1
- package/rules/store-context-provider-tsx.yml +3 -3
- package/rules/store-context-provider.yml +5 -5
- package/rules/store-delegation-getter-tsx.yml +2 -2
- package/rules/store-delegation-getter.yml +2 -2
- package/rules/store-no-runinaction-tsx.yml +2 -2
- package/rules/store-no-runinaction.yml +2 -2
- package/rules/store-no-setinterval-poll-tsx.yml +1 -1
- package/rules/store-no-setinterval-poll.yml +1 -1
- package/rules/ts-pattern-dangling-match-tsx.yml +4 -4
- package/rules/ts-pattern-dangling-match.yml +4 -4
- package/rules/ui-imports-app-store-ts.yml +2 -2
- package/rules/ui-imports-app-store.yml +1 -1
- package/rules/view-file-logic.yml +5 -5
- package/rules/view-imports-store.yml +4 -5
- package/rules/zod-optional-nullable-tsx.yml +2 -2
- package/rules/zod-optional-nullable.yml +2 -2
- package/structure/rules/component-decl.yml +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentvibes/guardrails",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Verification toolkit that makes agents write simple code: ast-grep rule canon, diff ratchet, biome/tsconfig presets, one CLI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
"./tsconfig": "./configs/tsconfig.base.json",
|
|
17
17
|
"./sgconfig": "./sgconfig.yml",
|
|
18
18
|
"./package.json": "./package.json",
|
|
19
|
-
"./plugin": "./dist/pluginApi.js"
|
|
19
|
+
"./plugin": "./dist/pluginApi.js",
|
|
20
|
+
"./overrides": "./dist/overrides.js",
|
|
21
|
+
"./wiring": "./dist/wiring.js",
|
|
22
|
+
"./record": "./dist/record/index.js"
|
|
20
23
|
},
|
|
21
24
|
"files": [
|
|
22
25
|
"dist",
|
|
@@ -35,11 +38,12 @@
|
|
|
35
38
|
"format": "biome check --write .",
|
|
36
39
|
"test:rules": "node dist/testRules.js",
|
|
37
40
|
"test:gate": "node dist/gateRed.js",
|
|
38
|
-
"check": "pnpm build && pnpm lint && pnpm test:rules && pnpm test:twins && pnpm test:repo-rules && pnpm test:preset && pnpm test:gate && pnpm test:sibling-clone && pnpm test:metrics && pnpm test:init && pnpm test:severity && pnpm test:screens && pnpm test:jsx-suppress && pnpm test:hooks && pnpm test:iterate && pnpm test:rename-diff && pnpm test:leaks && pnpm test:pipe && pnpm leaks",
|
|
41
|
+
"check": "pnpm build && pnpm lint && pnpm test:rules && pnpm test:twins && pnpm test:repo-rules && pnpm test:preset && pnpm test:overrides && pnpm test:wiring && pnpm test:record && pnpm test:snapshot && pnpm test:time && pnpm test:gate && pnpm test:sibling-clone && pnpm test:metrics && pnpm test:cli-args && pnpm test:init && pnpm test:severity && pnpm test:screens && pnpm test:jsx-suppress && pnpm test:hooks && pnpm test:iterate && pnpm test:rename-diff && pnpm test:leaks && pnpm test:pipe && pnpm test:file-sloc && pnpm leaks",
|
|
39
42
|
"test:metrics": "node dist/metricsCycle.js",
|
|
40
43
|
"leaks": "node dist/cli.js leaks .",
|
|
41
44
|
"test:leaks": "node dist/leaksRed.js",
|
|
42
45
|
"test:pipe": "node dist/pipeOutputTest.js",
|
|
46
|
+
"test:file-sloc": "node dist/fileSlocTest.js",
|
|
43
47
|
"test:init": "node dist/initTest.js",
|
|
44
48
|
"test:severity": "node dist/severityTest.js",
|
|
45
49
|
"test:hooks": "node dist/hookStopTest.js",
|
|
@@ -49,19 +53,27 @@
|
|
|
49
53
|
"test:twins": "node dist/twinCoverageTest.js",
|
|
50
54
|
"test:repo-rules": "node dist/repoRulesTest.js",
|
|
51
55
|
"test:preset": "node dist/presetDriftTest.js",
|
|
56
|
+
"test:overrides": "node dist/overridesTest.js",
|
|
57
|
+
"test:wiring": "node dist/wiringTest.js",
|
|
58
|
+
"test:record": "node dist/recordTest.js",
|
|
59
|
+
"test:snapshot": "node dist/snapshotTest.js",
|
|
60
|
+
"test:time": "node dist/timeTest.js",
|
|
52
61
|
"test:sibling-clone": "node dist/siblingCloneTest.js",
|
|
53
|
-
"test:jsx-suppress": "node dist/jsxSuppressTest.js"
|
|
62
|
+
"test:jsx-suppress": "node dist/jsxSuppressTest.js",
|
|
63
|
+
"test:cli-args": "node dist/cliArgsTest.js"
|
|
54
64
|
},
|
|
55
65
|
"dependencies": {
|
|
56
66
|
"oxc-parser": "0.153.0",
|
|
57
|
-
"
|
|
67
|
+
"smol-toml": "1.9.1",
|
|
68
|
+
"ts-pattern": "^5.6.2",
|
|
69
|
+
"zod": "4.6.7"
|
|
58
70
|
},
|
|
59
71
|
"devDependencies": {
|
|
60
72
|
"@types/node": "^22.13.0",
|
|
61
73
|
"typescript": "^5.7.3"
|
|
62
74
|
},
|
|
63
75
|
"engines": {
|
|
64
|
-
"node": ">=22"
|
|
76
|
+
"node": ">=22.13.0"
|
|
65
77
|
},
|
|
66
78
|
"packageManager": "pnpm@10.12.1",
|
|
67
79
|
"publishConfig": {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// The annotated form, which the rule caught from the start.
|
|
7
7
|
export const DEFAULT_MODE: Mode = { kind: "demo" }
|
|
8
8
|
|
|
9
|
-
// The `as const` form
|
|
9
|
+
// The `as const` form. This is the spelling people reach for
|
|
10
10
|
// when the object carries no type annotation to hold the literal type, and it
|
|
11
11
|
// was silently missed — DataSpool's retired local `no-fake-defaults` caught it,
|
|
12
12
|
// so adopting the canon had been a coverage regression.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// The annotated form, which the rule caught from the start.
|
|
7
7
|
export const DEFAULT_MODE: Mode = { kind: "demo" }
|
|
8
8
|
|
|
9
|
-
// The `as const` form
|
|
9
|
+
// The `as const` form. This is the spelling people reach for
|
|
10
10
|
// when the object carries no type annotation to hold the literal type, and it
|
|
11
11
|
// was silently missed — DataSpool's retired local `no-fake-defaults` caught it,
|
|
12
12
|
// so adopting the canon had been a coverage regression.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// type-switches on the implementation instead of receiving a model.
|
|
5
5
|
import { GalleryStore } from "../../stores/galleryStore"
|
|
6
6
|
|
|
7
|
-
// A slice-store singleton. `rootStore` at a screen is legal
|
|
7
|
+
// A slice-store singleton. `rootStore` at a screen is legal;
|
|
8
8
|
// reaching past it for one slice is not.
|
|
9
9
|
import { galleryStore } from "../../stores/galleryStore"
|
|
10
10
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// NOTHING in this file may be reported by `direct-store-import`.
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// The global rootStore imported at a screen is legal.
|
|
4
4
|
import { rootStore } from "../../stores/rootStore"
|
|
5
5
|
|
|
6
|
-
// Type-only imports are the view-model contract
|
|
6
|
+
// Type-only imports are the view-model contract, not a store dependency.
|
|
7
7
|
import type { IGalleryModel } from "../../stores/galleryStore"
|
|
8
8
|
import type { RootStore } from "../../stores/rootStore"
|
|
9
9
|
import type Photo from "../../stores/photo"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Every ternary here MUST be reported by `discriminator-ternary`.
|
|
2
2
|
|
|
3
|
-
// The terse option-unwrap the
|
|
3
|
+
// The terse option-unwrap the source app audit found 18 of.
|
|
4
4
|
export const first = (m: Maybe<string[]>) => (m.kind === "some" ? m.value : [])
|
|
5
5
|
export const adapter = (s: S) => (s.adapter.kind === "some" ? s.adapter.value : "—")
|
|
6
6
|
// Other discriminator names the rule covers.
|
|
@@ -10,7 +10,7 @@ export const first = (m: Maybe<string[]>) =>
|
|
|
10
10
|
|
|
11
11
|
// A ternary whose branches are JSX belongs to `jsx-ternary`, which owns that
|
|
12
12
|
// case with the same fix. This rule stands down so the two can never report the
|
|
13
|
-
// same line twice — measured overlap on
|
|
13
|
+
// same line twice — measured overlap on two consumer apps: 0.
|
|
14
14
|
export const View = (r: R) => (r.status === "error" ? <ErrorState /> : <Ready />)
|
|
15
15
|
export const View2 = (r: R) => (r.kind === "idle" ? null : <Spinner />)
|
|
16
16
|
|
|
@@ -52,7 +52,7 @@ export const E = observer(() => (
|
|
|
52
52
|
))
|
|
53
53
|
|
|
54
54
|
// The real shape, with design-system tags rather than host elements:
|
|
55
|
-
//
|
|
55
|
+
// A session-viewer app's SessionsTreeSection with its extracted <StatusGroup/> inlined.
|
|
56
56
|
export const SessionsTreeSection = observer(() => {
|
|
57
57
|
const { data, ui } = useStore()
|
|
58
58
|
const byStatus = (s: SessionStatus) => data.sessions.filter((x) => x.status === s)
|
|
@@ -23,7 +23,7 @@ export const E = observer(() => <ul>{xs.map((x) => <li key={x.id}><a href={x.hre
|
|
|
23
23
|
// Mapping to non-JSX values is untouched.
|
|
24
24
|
export const F = observer(() => <ul>{xs.map((x) => x.title).join(", ")}</ul>)
|
|
25
25
|
|
|
26
|
-
// A literal array —
|
|
26
|
+
// A literal array — the house "pure data" carve-out. A skeleton drawing four
|
|
27
27
|
// placeholder cards has no observable to subscribe to and no row to extract.
|
|
28
28
|
export const G = observer(() => (
|
|
29
29
|
<div>
|
|
@@ -47,7 +47,7 @@ export const TabBar = ({ store }: { store: IUiModel }) => {
|
|
|
47
47
|
|
|
48
48
|
// ── shapes taken from real components, not invented ────────────────────
|
|
49
49
|
// The store read happens at body level and never appears inside the JSX.
|
|
50
|
-
//
|
|
50
|
+
// A gallery app's GalleryView does exactly this; an earlier "deref must be inside
|
|
51
51
|
// a jsx_expression" version of this rule missed it completely.
|
|
52
52
|
export const GalleryView = function GalleryView() {
|
|
53
53
|
const { galleryStore, themeStore } = useStore()
|
|
@@ -58,7 +58,7 @@ export const GalleryView = function GalleryView() {
|
|
|
58
58
|
.exhaustive()
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
// Read straight into a local derivation —
|
|
61
|
+
// Read straight into a local derivation — a session-viewer app's SessionsTreeSection.
|
|
62
62
|
export const SessionsTreeSection = () => {
|
|
63
63
|
const { data, ui } = useStore()
|
|
64
64
|
const matched = data.sessions.filter((s) => sessionMatches(s, ui.searchQuery))
|
|
@@ -9,7 +9,7 @@ export const SessionsList = observer(() => {
|
|
|
9
9
|
return <div>{data.sessions.length} sessions, tab {ui.tab}</div>
|
|
10
10
|
})
|
|
11
11
|
|
|
12
|
-
// Wrapped named function expression — the shape
|
|
12
|
+
// Wrapped named function expression — the shape a gallery app uses.
|
|
13
13
|
export const GalleryEmptyStateView = observer(function GalleryEmptyStateView({
|
|
14
14
|
title,
|
|
15
15
|
}: {
|
|
@@ -54,7 +54,7 @@ export const ModelDebugLabel = ({ model }: { model: unknown }) => (
|
|
|
54
54
|
|
|
55
55
|
// Pulls the store ONLY to call a stable action from a handler. Nothing is read
|
|
56
56
|
// during render, so nothing needs subscribing and the parent observer owns the
|
|
57
|
-
// page.
|
|
57
|
+
// page. A session-viewer app writes two of these on purpose (`RichEntityListView`,
|
|
58
58
|
// `KanbanView`) with a comment saying exactly this.
|
|
59
59
|
export const OpenEntityButton = ({ id, label }: { id: string; label: string }) => {
|
|
60
60
|
const { ui } = useStore()
|
|
@@ -15,7 +15,7 @@ export class ObservableQuery<T> {
|
|
|
15
15
|
constructor(private readonly fetcher: () => Promise<T>) {}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// One consumer carries six byte-identical copies of these two inside one monorepo.
|
|
19
19
|
export function warnDegraded(context: string, detail: string): void {
|
|
20
20
|
console.warn(`[degraded] ${context}: ${detail}`)
|
|
21
21
|
}
|
|
@@ -24,7 +24,7 @@ export function warnNotImplemented(category: string, detail: string): void {
|
|
|
24
24
|
console.warn(`[not-implemented] ${category}: ${detail}`)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
// The useMemo improvisation with no dispose that
|
|
27
|
+
// The useMemo improvisation with no dispose that the store-layout audit found everywhere.
|
|
28
28
|
export const usePageStore = <T>(factory: () => T, deps: unknown[]): T => {
|
|
29
29
|
return useMemo(factory, deps)
|
|
30
30
|
}
|
|
@@ -15,7 +15,7 @@ export class ObservableQuery<T> {
|
|
|
15
15
|
constructor(private readonly fetcher: () => Promise<T>) {}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// One consumer carries six byte-identical copies of these two inside one monorepo.
|
|
19
19
|
export function warnDegraded(context: string, detail: string): void {
|
|
20
20
|
console.warn(`[degraded] ${context}: ${detail}`)
|
|
21
21
|
}
|
|
@@ -24,7 +24,7 @@ export function warnNotImplemented(category: string, detail: string): void {
|
|
|
24
24
|
console.warn(`[not-implemented] ${category}: ${detail}`)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
// The useMemo improvisation with no dispose that
|
|
27
|
+
// The useMemo improvisation with no dispose that the store-layout audit found everywhere.
|
|
28
28
|
export const usePageStore = <T,>(factory: () => T, deps: unknown[]): T => {
|
|
29
29
|
return useMemo(factory, deps)
|
|
30
30
|
}
|
|
@@ -8,7 +8,7 @@ export type Resource<T> =
|
|
|
8
8
|
| { status: "error"; message: string }
|
|
9
9
|
|
|
10
10
|
// Independent axes done RIGHT — this is SWR, not boolean soup: "has data" and
|
|
11
|
-
// "a fetch is in flight" genuinely are orthogonal
|
|
11
|
+
// "a fetch is in flight" genuinely are orthogonal.
|
|
12
12
|
export type QueryState<T> =
|
|
13
13
|
| { status: "pending"; fetchActivity: "idle" | "fetching" }
|
|
14
14
|
| { status: "success"; data: T; fetchActivity: "idle" | "fetching" }
|
|
@@ -8,7 +8,7 @@ export type Resource<T> =
|
|
|
8
8
|
| { status: "error"; message: string }
|
|
9
9
|
|
|
10
10
|
// Independent axes done RIGHT — this is SWR, not boolean soup: "has data" and
|
|
11
|
-
// "a fetch is in flight" genuinely are orthogonal
|
|
11
|
+
// "a fetch is in flight" genuinely are orthogonal.
|
|
12
12
|
export type QueryState<T> =
|
|
13
13
|
| { status: "pending"; fetchActivity: "idle" | "fetching" }
|
|
14
14
|
| { status: "success"; data: T; fetchActivity: "idle" | "fetching" }
|
|
@@ -40,7 +40,7 @@ export class ApiClient {
|
|
|
40
40
|
// ── the false-positive class this rule was narrowed to exclude ─────────
|
|
41
41
|
// Private async helpers that do pure I/O and never touch an observable field.
|
|
42
42
|
// There is no action coverage to lose, so there is nothing to convert. Real:
|
|
43
|
-
//
|
|
43
|
+
// A site-builder repo's walkDir / collectAllFiles / uploadFile — 10 of the rule's 12
|
|
44
44
|
// hits in that repo before the mutation requirement was added.
|
|
45
45
|
export class ContentStore {
|
|
46
46
|
files: string[] = []
|
|
@@ -40,7 +40,7 @@ export class ApiClient {
|
|
|
40
40
|
// ── the false-positive class this rule was narrowed to exclude ─────────
|
|
41
41
|
// Private async helpers that do pure I/O and never touch an observable field.
|
|
42
42
|
// There is no action coverage to lose, so there is nothing to convert. Real:
|
|
43
|
-
//
|
|
43
|
+
// A site-builder repo's walkDir / collectAllFiles / uploadFile — 10 of the rule's 12
|
|
44
44
|
// hits in that repo before the mutation requirement was added.
|
|
45
45
|
export class ContentStore {
|
|
46
46
|
files: string[] = []
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// BAD: the whole context channel
|
|
1
|
+
// BAD: the whole context channel the house store layout removes — provider, hook, null-check.
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
|
|
4
4
|
type RootStore = { readonly ready: boolean };
|
|
@@ -18,7 +18,7 @@ export class AppStore {
|
|
|
18
18
|
return this.userStore.id
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
// The real shape found in the park (2 sites
|
|
21
|
+
// The real shape found in the park (2 sites in a survey of two consumer repos).
|
|
22
22
|
get isConnected(): boolean {
|
|
23
23
|
return this.connectionStore.isConnected
|
|
24
24
|
}
|
|
@@ -18,7 +18,7 @@ export class AppStore {
|
|
|
18
18
|
return this.userStore.id
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
// The real shape found in the park (2 sites
|
|
21
|
+
// The real shape found in the park (2 sites in a survey of two consumer repos).
|
|
22
22
|
get isConnected(): boolean {
|
|
23
23
|
return this.connectionStore.isConnected
|
|
24
24
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { makeAutoObservable } from "mobx"
|
|
3
3
|
|
|
4
4
|
// ── The data-wrapper pattern: 89 of the 91 single-line `return this.X.y`
|
|
5
|
-
// getters measured across
|
|
5
|
+
// getters measured across four consumer repos look exactly
|
|
6
6
|
// like this. A model holding a plain record and republishing its fields as
|
|
7
|
-
// observable getters is the sanctioned shape (
|
|
8
|
-
//
|
|
7
|
+
// observable getters is the sanctioned shape (a shared model class in one
|
|
8
|
+
// consumer repo, domain stores in another).
|
|
9
9
|
export class Model {
|
|
10
10
|
readonly data: ModelRecordData
|
|
11
11
|
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { makeAutoObservable } from "mobx"
|
|
3
3
|
|
|
4
4
|
// ── The data-wrapper pattern: 89 of the 91 single-line `return this.X.y`
|
|
5
|
-
// getters measured across
|
|
5
|
+
// getters measured across four consumer repos look exactly
|
|
6
6
|
// like this. A model holding a plain record and republishing its fields as
|
|
7
|
-
// observable getters is the sanctioned shape (
|
|
8
|
-
//
|
|
7
|
+
// observable getters is the sanctioned shape (a shared model class in one
|
|
8
|
+
// consumer repo, domain stores in another).
|
|
9
9
|
export class Model {
|
|
10
10
|
readonly data: ModelRecordData
|
|
11
11
|
|
|
@@ -32,7 +32,7 @@ export class GitStore {
|
|
|
32
32
|
|
|
33
33
|
// The generic-argument spelling of the annotation. A `pattern:
|
|
34
34
|
// makeAutoObservable($$$)` does not match a call carrying explicit type
|
|
35
|
-
// arguments, which is how
|
|
35
|
+
// arguments, which is how a site-builder repo's project.store.ts — 7 real call sites —
|
|
36
36
|
// went missing from the first version of this rule.
|
|
37
37
|
export class ProjectStore {
|
|
38
38
|
private _buildTimer: number | null = null
|
|
@@ -32,7 +32,7 @@ export class GitStore {
|
|
|
32
32
|
|
|
33
33
|
// The generic-argument spelling of the annotation. A `pattern:
|
|
34
34
|
// makeAutoObservable($$$)` does not match a call carrying explicit type
|
|
35
|
-
// arguments, which is how
|
|
35
|
+
// arguments, which is how a site-builder repo's project.store.ts — 7 real call sites —
|
|
36
36
|
// went missing from the first version of this rule.
|
|
37
37
|
export class ProjectStore {
|
|
38
38
|
private _buildTimer: number | null = null
|
|
@@ -34,6 +34,6 @@ export function describeBranch(branch: string): string {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// Importing the symbol is not calling it. The report's "66 runInAction in
|
|
37
|
-
//
|
|
37
|
+
// a site-builder repo" counted 7 import lines exactly like this one; the real call-site
|
|
38
38
|
// count is 59.
|
|
39
39
|
export { runInAction } from "mobx"
|
|
@@ -34,6 +34,6 @@ export function describeBranch(branch: string): string {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// Importing the symbol is not calling it. The report's "66 runInAction in
|
|
37
|
-
//
|
|
37
|
+
// a site-builder repo" counted 7 import lines exactly like this one; the real call-site
|
|
38
38
|
// count is 59.
|
|
39
39
|
export { runInAction } from "mobx"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Every match chain here MUST be reported by `ts-pattern-dangling-match`.
|
|
2
2
|
import { match } from "ts-pattern"
|
|
3
3
|
|
|
4
|
-
// A real
|
|
4
|
+
// A real chain from a consumer app with its terminator deleted: evaluates to a builder
|
|
5
5
|
// object, which is truthy, so the caller keeps compiling and every arm is dead.
|
|
6
6
|
export function label(r: Resource<string>): string {
|
|
7
7
|
return match(r)
|
|
@@ -9,8 +9,8 @@ export function label(r: Resource<string>): string {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// `.otherwise()` and `.run()` terminate a chain too. Whether `.exhaustive()`
|
|
12
|
-
// should be PREFERRED over `.otherwise()` is a separate question
|
|
13
|
-
//
|
|
12
|
+
// should be PREFERRED over `.otherwise()` is a separate, open question;
|
|
13
|
+
// this rule is only about a chain that ends nowhere.
|
|
14
14
|
export function label2(r: Resource<string>): string {
|
|
15
15
|
return match(r).with({ kind: "idle" }, () => "idle").otherwise(() => "?")
|
|
16
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// NOTHING in this file may be reported by `ui-imports-app-store`.
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// A reusable UI component typed against the view-model
|
|
4
4
|
// interface the store implements is exactly what the mobx-models view-model
|
|
5
5
|
// pattern prescribes. `import type` erases at build time — the component
|
|
6
6
|
// depends on a shape, not on an app store — so it must not trip the rule that
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// NOTHING in this file may be reported by `view-imports-store`.
|
|
2
2
|
|
|
3
|
-
// A view is typed against the model interface it renders
|
|
3
|
+
// A view is typed against the model interface it renders. The type
|
|
4
4
|
// vanishes at build time, so it is a contract, not a store dependency.
|
|
5
5
|
import type { IGalleryModel } from "../../stores/galleryStore"
|
|
6
6
|
import { type IUiModel } from "../../stores/uiStore"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# ── rule body adopted from
|
|
2
|
-
# The two rules were duplicates; the
|
|
1
|
+
# ── rule body adopted from a consumer repo's `no-as-any` (wave 2 triage) ──
|
|
2
|
+
# The two rules were duplicates; the consumer's implementation is strictly better,
|
|
3
3
|
# so the canon id keeps its message and takes that body. Why it is better here:
|
|
4
4
|
# surface `pattern:` is compared at ast-grep's default `smart` strictness, which
|
|
5
5
|
# also compares interleaved `comment` nodes — so `x as /* why */ any` slipped
|
package/rules/as-any-escape.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# ── rule body adopted from
|
|
2
|
-
# The two rules were duplicates; the
|
|
1
|
+
# ── rule body adopted from a consumer repo's `no-as-any` (wave 2 triage) ──
|
|
2
|
+
# The two rules were duplicates; the consumer's implementation is strictly better,
|
|
3
3
|
# so the canon id keeps its message and takes that body. Why it is better here:
|
|
4
4
|
# surface `pattern:` is compared at ast-grep's default `smart` strictness, which
|
|
5
5
|
# also compares interleaved `comment` nodes — so `x as /* why */ any` slipped
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# ── rule body adopted from
|
|
2
|
-
# The two rules were duplicates; the
|
|
1
|
+
# ── rule body adopted from a consumer repo's `no-empty-catch` (wave 2 triage) ──
|
|
2
|
+
# The two rules were duplicates; the consumer's implementation is strictly better,
|
|
3
3
|
# so the canon id keeps its message and takes that body. Why it is better here:
|
|
4
4
|
# the old patterns covered `catch {}` and `catch (e) {}` but NOT `catch (e:
|
|
5
5
|
# unknown) {}` / `catch (e: any) {}` — the type annotation is an extra named node.
|
|
6
|
-
# Measured on
|
|
6
|
+
# Measured on four consumer repos: 0 files lost, 1 gained,
|
|
7
7
|
# and the finding now anchors on the `catch` keyword rather than the `try`.
|
|
8
8
|
#
|
|
9
9
|
# The .tsx half of `catch-empty`.
|
package/rules/catch-empty.yml
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# ── rule body adopted from
|
|
2
|
-
# The two rules were duplicates; the
|
|
1
|
+
# ── rule body adopted from a consumer repo's `no-empty-catch` (wave 2 triage) ──
|
|
2
|
+
# The two rules were duplicates; the consumer's implementation is strictly better,
|
|
3
3
|
# so the canon id keeps its message and takes that body. Why it is better here:
|
|
4
4
|
# the old patterns covered `catch {}` and `catch (e) {}` but NOT `catch (e:
|
|
5
5
|
# unknown) {}` / `catch (e: any) {}` — the type annotation is an extra named node.
|
|
6
|
-
# Measured on
|
|
6
|
+
# Measured on four consumer repos: 0 files lost, 1 gained,
|
|
7
7
|
# and the finding now anchors on the `catch` keyword rather than the `try`.
|
|
8
8
|
#
|
|
9
9
|
id: catch-empty
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
#
|
|
21
21
|
# A fixture/demo/mock source chosen as the DEFAULT data source.
|
|
22
22
|
#
|
|
23
|
-
# The failure this encodes:
|
|
23
|
+
# The failure this encodes: an issue-tracker web app shipped with
|
|
24
24
|
# function initialState(boot, narrow): State { … mode: { kind: "demo" }, … }
|
|
25
25
|
# so the deployed site always opened on in-memory fixtures that accepted writes
|
|
26
|
-
# and forgot them at reload.
|
|
27
|
-
#
|
|
26
|
+
# and forgot them at reload. Its user worked in it for days and lost the issues
|
|
27
|
+
# they had filed (2026-08-07).
|
|
28
28
|
#
|
|
29
29
|
# Scoped deliberately narrow — only the positions that decide what the app STARTS
|
|
30
30
|
# on: an `initialState`-family function, a DEFAULT_/INITIAL_ binding, or the
|
|
@@ -33,10 +33,9 @@
|
|
|
33
33
|
# excluded.
|
|
34
34
|
#
|
|
35
35
|
# Validated against the real pre-fix store.tsx: 1 hit at the exact declaration,
|
|
36
|
-
# 0 on the fixed version, 0 across
|
|
37
|
-
# agent-workbench web.
|
|
36
|
+
# 0 on the fixed version, 0 across three other web apps.
|
|
38
37
|
#
|
|
39
|
-
# 2026-09-06
|
|
38
|
+
# 2026-09-06: the value matcher was widened to accept
|
|
40
39
|
# `as const` / `as <Type>` / `satisfies <Type>` around the literal. This is an
|
|
41
40
|
# error-tier rule, so the widening was measured before landing: 0 new findings
|
|
42
41
|
# in the seven repos that run this gate, and 0 across every repo under
|
|
@@ -59,7 +58,7 @@ rule:
|
|
|
59
58
|
field: key
|
|
60
59
|
regex: '^(kind|mode|backend|source|dataSource|driver|adapter|transport|client)$'
|
|
61
60
|
# The literal, optionally wrapped in `as const` / `as Mode` /
|
|
62
|
-
# `satisfies Mode
|
|
61
|
+
# `satisfies Mode`. Without the tail, `{ kind: "demo" }` was
|
|
63
62
|
# a finding and `{ kind: "demo" as const }` was not — and `as const` is the
|
|
64
63
|
# spelling people reach for precisely when the object has no type
|
|
65
64
|
# annotation to carry the literal type. DataSpool's retired local
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# A fixture/demo/mock source chosen as the DEFAULT data source.
|
|
2
2
|
#
|
|
3
|
-
# The failure this encodes:
|
|
3
|
+
# The failure this encodes: an issue-tracker web app shipped with
|
|
4
4
|
# function initialState(boot, narrow): State { … mode: { kind: "demo" }, … }
|
|
5
5
|
# so the deployed site always opened on in-memory fixtures that accepted writes
|
|
6
|
-
# and forgot them at reload.
|
|
7
|
-
#
|
|
6
|
+
# and forgot them at reload. Its user worked in it for days and lost the issues
|
|
7
|
+
# they had filed (2026-08-07).
|
|
8
8
|
#
|
|
9
9
|
# Scoped deliberately narrow — only the positions that decide what the app STARTS
|
|
10
10
|
# on: an `initialState`-family function, a DEFAULT_/INITIAL_ binding, or the
|
|
@@ -13,10 +13,9 @@
|
|
|
13
13
|
# excluded.
|
|
14
14
|
#
|
|
15
15
|
# Validated against the real pre-fix store.tsx: 1 hit at the exact declaration,
|
|
16
|
-
# 0 on the fixed version, 0 across
|
|
17
|
-
# agent-workbench web.
|
|
16
|
+
# 0 on the fixed version, 0 across three other web apps.
|
|
18
17
|
#
|
|
19
|
-
# 2026-09-06
|
|
18
|
+
# 2026-09-06: the value matcher was widened to accept
|
|
20
19
|
# `as const` / `as <Type>` / `satisfies <Type>` around the literal. This is an
|
|
21
20
|
# error-tier rule, so the widening was measured before landing: 0 new findings
|
|
22
21
|
# in the seven repos that run this gate, and 0 across every repo under
|
|
@@ -37,7 +36,7 @@ rule:
|
|
|
37
36
|
field: key
|
|
38
37
|
regex: '^(kind|mode|backend|source|dataSource|driver|adapter|transport|client)$'
|
|
39
38
|
# The literal, optionally wrapped in `as const` / `as Mode` /
|
|
40
|
-
# `satisfies Mode
|
|
39
|
+
# `satisfies Mode`. Without the tail, `{ kind: "demo" }` was
|
|
41
40
|
# a finding and `{ kind: "demo" as const }` was not — and `as const` is the
|
|
42
41
|
# spelling people reach for precisely when the object has no type
|
|
43
42
|
# annotation to carry the literal type. DataSpool's retired local
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ── G1, rule 3 of 3: reaching past the store boundary ──────────────────
|
|
2
2
|
#
|
|
3
|
-
#
|
|
3
|
+
# Scope: the global `rootStore` is a module-level
|
|
4
4
|
# singleton imported DIRECTLY at screen level — that is now the sanctioned
|
|
5
5
|
# channel, and this rule must not fight it. What stays banned is reaching past
|
|
6
6
|
# it: pulling a store CLASS into a component file, or grabbing one slice-store
|
|
@@ -9,17 +9,17 @@
|
|
|
9
9
|
#
|
|
10
10
|
# So the rule keys on the imported BINDING, not on the directory alone:
|
|
11
11
|
#
|
|
12
|
-
# import { rootStore } from "…/stores/rootStore" legal
|
|
12
|
+
# import { rootStore } from "…/stores/rootStore" legal
|
|
13
13
|
# import { galleryStore } from "…/stores/gallery" flagged (slice store)
|
|
14
14
|
# import { GalleryStore } from "…/stores/gallery" flagged (store class)
|
|
15
15
|
# import { useStore } from "…/stores/StoreContext" ignored (access hook)
|
|
16
|
-
# import type { IGalleryModel } from "…/stores/…" ignored (
|
|
16
|
+
# import type { IGalleryModel } from "…/stores/…" ignored (view-model contract)
|
|
17
17
|
#
|
|
18
18
|
# NEAR-TERM SCOPE, stated plainly: "component file" is approximated by `.tsx`,
|
|
19
19
|
# and screens are not distinguished from leaf components — so a screen importing
|
|
20
20
|
# a page-store class is flagged alongside a leaf component doing the same. The
|
|
21
|
-
# real boundary needs the manifest's `screens` glob from `.agentvibes/project.toml
|
|
22
|
-
#
|
|
21
|
+
# real boundary needs the manifest's `screens` glob from `.agentvibes/project.toml`,
|
|
22
|
+
# which arrives with the `@agentvibes/guardrails` package. Until
|
|
23
23
|
# then this rule is the pragmatic half: it catches slice-store and store-class
|
|
24
24
|
# imports anywhere in `.tsx`, and leaves `rootStore` alone everywhere.
|
|
25
25
|
#
|
|
@@ -28,11 +28,10 @@
|
|
|
28
28
|
# scopes per rule file, so it lives in `view-imports-store.yml`.
|
|
29
29
|
id: direct-store-import
|
|
30
30
|
# A screen MUST import its page-store class — `usePageStore(() => new
|
|
31
|
-
# GalleryPageStore(rootStore, slug))` is
|
|
31
|
+
# GalleryPageStore(rootStore, slug))` is the prescribed shape — so this
|
|
32
32
|
# rule does not apply to files the repo declares as screens via
|
|
33
33
|
# `[verify] screens` in .agentvibes/project.toml. Without that declaration
|
|
34
|
-
# nothing changes and screens keep needing a justified suppression
|
|
35
|
-
# (is-7067a0b8).
|
|
34
|
+
# nothing changes and screens keep needing a justified suppression.
|
|
36
35
|
metadata:
|
|
37
36
|
appliesTo: not-screens
|
|
38
37
|
language: tsx
|
|
@@ -41,14 +40,14 @@ files:
|
|
|
41
40
|
- '**/*.tsx'
|
|
42
41
|
ignores:
|
|
43
42
|
# A test constructing a store directly is the PRESCRIBED shape, not a breach:
|
|
44
|
-
#
|
|
45
|
-
# the centre of why the store is
|
|
46
|
-
# 15 of
|
|
43
|
+
# the house store layout puts `new GalleryPageStore(fakeRoot, "slug")` with no render at
|
|
44
|
+
# the centre of why the store is a separate, easily tested unit. Without this,
|
|
45
|
+
# 15 of a session-viewer app's 21 hits were tests doing exactly the right thing.
|
|
47
46
|
- '**/*.test.tsx'
|
|
48
47
|
- '**/*.spec.tsx'
|
|
49
48
|
- '**/__tests__/**'
|
|
50
49
|
# The composition root wires dependencies once before the first render —
|
|
51
|
-
# `initRootStore(deps)` in
|
|
50
|
+
# `initRootStore(deps)` in the house store layout. A session-viewer app's `main.tsx` picks its data
|
|
52
51
|
# source here, which is also where fake-data.md REQUIRES the choice to be made.
|
|
53
52
|
- '**/main.tsx'
|
|
54
53
|
# A gallery, storybook or preview harness legitimately builds stores over
|
|
@@ -81,7 +80,7 @@ message: |
|
|
|
81
80
|
in with it.
|
|
82
81
|
Take the data as a prop — a `model` typed by the view-model interface the
|
|
83
82
|
store implements (`IXxxModel`) — and let the screen do the reading. The
|
|
84
|
-
global `rootStore` imported at screen level is legal
|
|
83
|
+
global `rootStore` imported at screen level is legal; this is
|
|
85
84
|
about everything reached past it.
|
|
86
85
|
`import type { IXxxModel } from ".../stores/..."` is the compliant shape and
|
|
87
86
|
does not fire. See the mobx-models and mobx-components skills.
|
|
@@ -95,7 +94,7 @@ rule:
|
|
|
95
94
|
kind: string_fragment
|
|
96
95
|
regex: '(^|/)stores?(/|$)'
|
|
97
96
|
# A binding whose name says "store", excluding the two legal ones: the
|
|
98
|
-
# global singleton
|
|
97
|
+
# global singleton and the `use…Store` access hooks.
|
|
99
98
|
- has:
|
|
100
99
|
stopBy: end
|
|
101
100
|
all:
|
|
@@ -105,10 +104,10 @@ rule:
|
|
|
105
104
|
regex: '^rootStore$'
|
|
106
105
|
- not:
|
|
107
106
|
regex: '^use[A-Z]'
|
|
108
|
-
#
|
|
107
|
+
# The same pattern, one level down: `import { NOTIFICATION_KINDS, type
|
|
109
108
|
# NotificationSettingsStore }` is a value import, so the whole-statement
|
|
110
109
|
# type check above does not exclude it — but the store name in it is
|
|
111
|
-
# still just a type.
|
|
110
|
+
# still just a type. A session-viewer app's NotificationsSettingsView.tsx was
|
|
112
111
|
# flagged for exactly this before the clause existed.
|
|
113
112
|
- not:
|
|
114
113
|
inside:
|