@agentvibes/guardrails 0.2.7 → 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 +33 -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 +2 -20
- 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.ts +9 -0
- package/rules/__fixtures__/discriminator-ternary/bad.tsx +1 -1
- package/rules/__fixtures__/discriminator-ternary/good.ts +17 -0
- package/rules/__fixtures__/discriminator-ternary/good.tsx +1 -1
- package/rules/__fixtures__/hardcoded-url-in-component/components/bad.ts +9 -0
- package/rules/__fixtures__/hardcoded-url-in-component/components/good.ts +13 -0
- package/rules/__fixtures__/inline-map-row/bad.tsx +1 -1
- package/rules/__fixtures__/inline-map-row/good.tsx +1 -1
- package/rules/__fixtures__/match-bool-to-null/bad.ts +14 -0
- package/rules/__fixtures__/match-bool-to-null/bad.tsx +8 -0
- package/rules/__fixtures__/match-bool-to-null/good.ts +12 -0
- package/rules/__fixtures__/match-bool-to-null/good.tsx +12 -0
- 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/bad.ts +11 -0
- package/rules/__fixtures__/ui-imports-app-store/src/ui/good.ts +13 -0
- 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 +46 -0
- package/rules/discriminator-ternary.yml +3 -3
- package/rules/hardcoded-url-in-component-ts.yml +40 -0
- package/rules/hardcoded-url-in-component.yml +5 -8
- 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 +27 -0
- 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 +61 -0
- 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
|
@@ -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:
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# ── the .ts half of `discriminator-ternary` ──────────────────────────────────────────────
|
|
2
|
+
#
|
|
3
|
+
# `discriminator-ternary` is `language: tsx`, so it reads `.tsx` and never `.ts` — ast-grep's
|
|
4
|
+
# languages are disjoint. What it matches needs no JSX, so it can sit in a plain
|
|
5
|
+
# `.ts` file just as well. The `.ts` twin closes that gap.
|
|
6
|
+
#
|
|
7
|
+
# Keep this file's `severity`, `files`, `ignores`, `utils` and `rule:`
|
|
8
|
+
# blocks IDENTICAL to `discriminator-ternary.yml` (`.tsx` globs spelled `.ts`),
|
|
9
|
+
# with one exception: no `is-jsx` helper and no `not:` clause. The typescript
|
|
10
|
+
# grammar has no JSX node kinds (ast-grep refuses the rule if they are named),
|
|
11
|
+
# and a `.ts` file has no JSX branch for this rule to stand down on;
|
|
12
|
+
# `pnpm test:twins` fails when they drift.
|
|
13
|
+
#
|
|
14
|
+
id: discriminator-ternary-ts
|
|
15
|
+
language: typescript
|
|
16
|
+
severity: warning
|
|
17
|
+
message: |
|
|
18
|
+
A ternary branching on a discriminator field. Both arms are written, so
|
|
19
|
+
nothing breaks today — what breaks is the next variant: widen the union and
|
|
20
|
+
the `:` branch silently absorbs it, with no build error anywhere.
|
|
21
|
+
m.kind === "some" ? m.value : []
|
|
22
|
+
→ match(m).with({ kind: "some" }, ({ value }) => value).with({ kind: "none" }, () => []).exhaustive()
|
|
23
|
+
Match the value, not a boolean derived from it — that is what turns adding a
|
|
24
|
+
variant into a type error.
|
|
25
|
+
Related but different: `kind-if-without-match` covers the `if` spelling, and
|
|
26
|
+
`jsx-ternary` covers ternaries that render JSX. This rule deliberately stands
|
|
27
|
+
down when a branch is JSX so the two never report the same line twice.
|
|
28
|
+
See defensive-errors Rule 1 & 2.
|
|
29
|
+
Suppressing this one needs the id you see above — `ast-grep-ignore: discriminator-ternary-ts`.
|
|
30
|
+
`discriminator-ternary` is a DIFFERENT rule (the .tsx arm) and does not cover it.
|
|
31
|
+
rule:
|
|
32
|
+
all:
|
|
33
|
+
- kind: ternary_expression
|
|
34
|
+
- has:
|
|
35
|
+
field: condition
|
|
36
|
+
kind: binary_expression
|
|
37
|
+
all:
|
|
38
|
+
- has:
|
|
39
|
+
field: operator
|
|
40
|
+
regex: '^(===|!==)$'
|
|
41
|
+
- has:
|
|
42
|
+
field: left
|
|
43
|
+
kind: member_expression
|
|
44
|
+
has:
|
|
45
|
+
field: property
|
|
46
|
+
regex: '^(kind|status|state|type|provider|providerId|reason|mode|variant|tag)$'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# PROMOTED to canon in wave 2 from
|
|
1
|
+
# PROMOTED to canon in wave 2 from the source app `r4-ternary-on-discriminator` (rule-triage).
|
|
2
2
|
#
|
|
3
|
-
# The only one of the 11
|
|
3
|
+
# The only one of the 11 source-app R-rules that was actually firing (18 hits in the
|
|
4
4
|
# audit), and the triage question was whether it duplicates something canon
|
|
5
|
-
# already has. Measured on
|
|
5
|
+
# already has. Measured on two consumer apps, it does not — the three
|
|
6
6
|
# rules partition the space cleanly:
|
|
7
7
|
#
|
|
8
8
|
# kind-if-without-match 27 hits `if` on a discriminator
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# ── the .ts half of `hardcoded-url-in-component` ──────────────────────────────────────────────
|
|
2
|
+
#
|
|
3
|
+
# `hardcoded-url-in-component` is `language: tsx`, so it reads `.tsx` and never `.ts` — ast-grep's
|
|
4
|
+
# languages are disjoint. What it matches needs no JSX, so it can sit in a plain
|
|
5
|
+
# `.ts` file just as well. The `.ts` twin closes that gap.
|
|
6
|
+
#
|
|
7
|
+
# Keep this file's `severity`, `files`, `ignores`, `utils` and `rule:`
|
|
8
|
+
# blocks IDENTICAL to `hardcoded-url-in-component.yml` (`.tsx` globs spelled `.ts`);
|
|
9
|
+
# `pnpm test:twins` fails when they drift.
|
|
10
|
+
#
|
|
11
|
+
id: hardcoded-url-in-component-ts
|
|
12
|
+
language: typescript
|
|
13
|
+
severity: warning
|
|
14
|
+
files:
|
|
15
|
+
- '**/components/**/*.ts'
|
|
16
|
+
- '**/screens/**/*.ts'
|
|
17
|
+
ignores:
|
|
18
|
+
- '**/__tests__/**'
|
|
19
|
+
- '**/*.test.ts'
|
|
20
|
+
- '**/showcase/**'
|
|
21
|
+
- '**/*.stories.ts'
|
|
22
|
+
message: |
|
|
23
|
+
A hardcoded URL in a component file. The component now knows which
|
|
24
|
+
environment it is in, so it cannot be rendered in a test, a story or a second
|
|
25
|
+
deployment without editing it — and a URL that moves has to be found by grep
|
|
26
|
+
rather than changed in one place.
|
|
27
|
+
Put it in a constants module and read it from there (or from a store computed
|
|
28
|
+
when it varies at runtime). Service URLs in this codebase come from
|
|
29
|
+
the dev CLI, never a literal — see the house "No localhost" rule, which
|
|
30
|
+
also retires the legacy proxy zone for new code.
|
|
31
|
+
Documentation links and `xmlns` schema URLs are the honest exceptions;
|
|
32
|
+
suppress those with a reason.
|
|
33
|
+
Suppressing this one needs the id you see above — `ast-grep-ignore: hardcoded-url-in-component-ts`.
|
|
34
|
+
`hardcoded-url-in-component` is a DIFFERENT rule (the .tsx arm) and does not cover it.
|
|
35
|
+
rule:
|
|
36
|
+
all:
|
|
37
|
+
- kind: string
|
|
38
|
+
- regex: '^["'']https?://'
|
|
39
|
+
- not:
|
|
40
|
+
regex: 'w3\.org|schema\.org|json-schema\.org'
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
# PROMOTED to canon in wave 2 from
|
|
1
|
+
# PROMOTED to canon in wave 2 from the source app `r1a-hardcoded-url-in-component` (rule-triage).
|
|
2
2
|
#
|
|
3
3
|
# Promoted because it enforces a rule that is already house-wide rather than
|
|
4
|
-
#
|
|
4
|
+
# Source-app-local: the "No localhost" convention — every service URL comes from
|
|
5
5
|
# the dev CLI, never a literal, and the legacy proxy zone is retired for new
|
|
6
6
|
# code. A URL baked into a component is also the thing that
|
|
7
7
|
# makes a component un-reusable and un-testable, which is the same boundary
|
|
8
8
|
# `ui-imports-app-store` guards from the other side.
|
|
9
9
|
#
|
|
10
|
-
# Only 2 hits across
|
|
11
|
-
# rather than a cleanup campaign. The
|
|
12
|
-
# `apps
|
|
10
|
+
# Only 2 hits across two consumer apps — a clean ratchet on new code
|
|
11
|
+
# rather than a cleanup campaign. The source app original pointed at
|
|
12
|
+
# `apps/<app>/lib/constants/urls.ts`; the message below states the destination
|
|
13
13
|
# generically.
|
|
14
14
|
id: hardcoded-url-in-component
|
|
15
15
|
language: tsx
|
|
16
16
|
severity: warning
|
|
17
17
|
files:
|
|
18
|
-
- '**/components/**/*.ts'
|
|
19
18
|
- '**/components/**/*.tsx'
|
|
20
|
-
- '**/screens/**/*.ts'
|
|
21
19
|
- '**/screens/**/*.tsx'
|
|
22
20
|
ignores:
|
|
23
21
|
- '**/__tests__/**'
|
|
24
|
-
- '**/*.test.ts'
|
|
25
22
|
- '**/*.test.tsx'
|
|
26
23
|
- '**/showcase/**'
|
|
27
24
|
- '**/*.stories.tsx'
|
package/rules/inline-map-row.yml
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# ── G1, rule 2 of 3: per-row observer extraction ───────────────────────
|
|
2
2
|
#
|
|
3
|
-
# The MobX list rule
|
|
3
|
+
# The house MobX list rule: mapping an observable collection with the
|
|
4
4
|
# row body written inline makes the PARENT track every field every row reads, so
|
|
5
5
|
# one item's change invalidates the whole list. Extracting the row into its own
|
|
6
6
|
# `observer` component localises the invalidation.
|
|
7
7
|
#
|
|
8
8
|
# The report's audit found this rule already obeyed everywhere it looked (131
|
|
9
|
-
# `*Row.tsx` files in
|
|
9
|
+
# `*Row.tsx` files in one monorepo alone) — so it lands as a ratchet on new code, not
|
|
10
10
|
# as a cleanup campaign.
|
|
11
11
|
#
|
|
12
12
|
# Threshold: the mapped element must contain TWO OR MORE nested JSX elements
|
|
@@ -44,7 +44,7 @@ message: |
|
|
|
44
44
|
Extract the body into its own `observer` component and pass the item down:
|
|
45
45
|
{items.map(t => <TaskRow key={t.id} task={t} />)}
|
|
46
46
|
The parent then re-renders only on insert, remove and reorder; each row
|
|
47
|
-
re-renders on its own fields. See
|
|
47
|
+
re-renders on its own fields. See the house "MobX lists" convention and the
|
|
48
48
|
mobx-components skill.
|
|
49
49
|
Doesn't apply when the mapped children are pure data — constants or plain
|
|
50
50
|
props rather than observables.
|
|
@@ -74,11 +74,11 @@ rule:
|
|
|
74
74
|
# convenience — it is the rule's own rationale made into its scope: the
|
|
75
75
|
# defect is that the PARENT'S reactive scope tracks every field every row
|
|
76
76
|
# reads, and a component with no reactive scope has no such defect. It is
|
|
77
|
-
# also the only syntactically decidable form of
|
|
77
|
+
# also the only syntactically decidable form of the house carve-out
|
|
78
78
|
# ("when the rendered children are pure data … the rule doesn't apply").
|
|
79
79
|
#
|
|
80
80
|
# Measured, not assumed: without this clause the rule fired 50 times in
|
|
81
|
-
#
|
|
81
|
+
# a UI library and its examples/docs site, which
|
|
82
82
|
# contain no MobX whatsoever — where every hit was a false positive at
|
|
83
83
|
# `error` severity. With it, 0 there.
|
|
84
84
|
#
|
|
@@ -94,10 +94,10 @@ rule:
|
|
|
94
94
|
- inside:
|
|
95
95
|
stopBy: end
|
|
96
96
|
kind: jsx_expression
|
|
97
|
-
#
|
|
97
|
+
# The house convention's own carve-out: "When the rendered children are pure data
|
|
98
98
|
# (constants, plain props, not MobX observables), the rule doesn't
|
|
99
99
|
# apply." A literal array is the one case that is provably constant —
|
|
100
|
-
#
|
|
100
|
+
# a session-viewer app's SessionInfoSkeleton maps `[1, 2, 3, 4]` to draw four
|
|
101
101
|
# placeholder cards, which no amount of extraction improves.
|
|
102
102
|
- not:
|
|
103
103
|
has:
|
|
@@ -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-instanceof-map-set` (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 named only Map and Set; WeakMap and WeakSet have exactly the
|
|
5
5
|
# same cross-realm failure and were invisible.
|
|
@@ -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-instanceof-map-set` (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 named only Map and Set; WeakMap and WeakSet have exactly the
|
|
5
5
|
# same cross-realm failure and were invisible.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# way to say "both languages", so a twin id per language is the only option.
|
|
9
9
|
#
|
|
10
10
|
# Measured 2026-09-06 across the same five repos: 29 findings in `.tsx`
|
|
11
|
-
# (
|
|
11
|
+
# (per repo: 1, 2, 6, 2, 18).
|
|
12
12
|
# `if (x.kind === …)` branching lives in components at least as often as in
|
|
13
13
|
# plain modules, which is precisely where the union grows a variant unnoticed.
|
|
14
14
|
#
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# way to say "both languages", so a twin id per language is the only option.
|
|
9
9
|
#
|
|
10
10
|
# Measured 2026-09-06 across the same five repos: 41 findings in `.tsx`
|
|
11
|
-
# (
|
|
11
|
+
# (per repo: 1, 7, 9, 6, 18).
|
|
12
12
|
# This twin restores intent rather than extending it: the `files:` globs below
|
|
13
13
|
# already list `**/components/**/*.tsx` and `**/screens/**/*.tsx`, and under
|
|
14
14
|
# `language: typescript` those three lines could never match anything. The rule
|
|
@@ -43,7 +43,7 @@ message: |
|
|
|
43
43
|
- a shared module as a typed constant + alias when it is purely lexical
|
|
44
44
|
(file kinds, palette names) with no state attached.
|
|
45
45
|
Component prop types then consume the shared type instead of restating it.
|
|
46
|
-
See the mobx-models skill
|
|
46
|
+
See the mobx-models skill.
|
|
47
47
|
Suppressing this one needs the id you see above — `ast-grep-ignore: literal-union-in-component-tsx`.
|
|
48
48
|
`literal-union-in-component` is a DIFFERENT rule (the .ts arm) and does not cover it.
|
|
49
49
|
rule:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# PROMOTED to canon in wave 2 from
|
|
1
|
+
# PROMOTED to canon in wave 2 from the source app `r14-literal-union-in-component` (rule-triage).
|
|
2
2
|
#
|
|
3
|
-
# Generic, not
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# The
|
|
3
|
+
# Generic, not specific to the source app: the house store layout already states it:
|
|
4
|
+
# string-literal unions such as `type Tab = "tasks" | "habits"` may not live
|
|
5
|
+
# in component files of the `ui/` tier of the four-level model.
|
|
6
|
+
# The source app original hard-coded `apps/<app>/components/**` and `apps/<app>/app/**`;
|
|
7
7
|
# the globs below are the same intent stated for any repo.
|
|
8
8
|
#
|
|
9
|
-
# 23 hits across
|
|
9
|
+
# 23 hits across two consumer apps with the source app globs stripped, so it is
|
|
10
10
|
# a live rule elsewhere and not a local house style.
|
|
11
11
|
id: literal-union-in-component
|
|
12
12
|
language: typescript
|
|
@@ -35,7 +35,7 @@ message: |
|
|
|
35
35
|
- a shared module as a typed constant + alias when it is purely lexical
|
|
36
36
|
(file kinds, palette names) with no state attached.
|
|
37
37
|
Component prop types then consume the shared type instead of restating it.
|
|
38
|
-
See the mobx-models skill
|
|
38
|
+
See the mobx-models skill.
|
|
39
39
|
rule:
|
|
40
40
|
all:
|
|
41
41
|
- kind: type_alias_declaration
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# ── the .ts half of `match-bool-to-null` ──────────────────────────────────────────────
|
|
2
|
+
#
|
|
3
|
+
# `match-bool-to-null` is `language: tsx`, so it reads `.tsx` and never `.ts` — ast-grep's
|
|
4
|
+
# languages are disjoint. What it matches needs no JSX, so it can sit in a plain
|
|
5
|
+
# `.ts` file just as well. The `.ts` twin closes that gap.
|
|
6
|
+
#
|
|
7
|
+
# Keep this file's `severity`, `files`, `ignores`, `utils` and `rule:`
|
|
8
|
+
# blocks IDENTICAL to `match-bool-to-null.yml` (`.tsx` globs spelled `.ts`);
|
|
9
|
+
# `pnpm test:twins` fails when they drift.
|
|
10
|
+
#
|
|
11
|
+
id: match-bool-to-null-ts
|
|
12
|
+
language: typescript
|
|
13
|
+
severity: warning
|
|
14
|
+
message: |
|
|
15
|
+
`match(cond).with(true, ...).with(false, () => null).exhaustive()` is the
|
|
16
|
+
ceremonial form of "maybe render this subtree". Use the purpose-built helper:
|
|
17
|
+
<ShowWhen cond={cond}>{() => <JSX/>}</ShowWhen>
|
|
18
|
+
ShowWhen is an observer (MobX-reactive), lazily evaluates children, and
|
|
19
|
+
communicates intent. If BOTH arms render something non-null, keep match().
|
|
20
|
+
Suppressing this one needs the id you see above — `ast-grep-ignore: match-bool-to-null-ts`.
|
|
21
|
+
`match-bool-to-null` is a DIFFERENT rule (the .tsx arm) and does not cover it.
|
|
22
|
+
rule:
|
|
23
|
+
pattern: |
|
|
24
|
+
match($COND)
|
|
25
|
+
.with(true, () => $$$A)
|
|
26
|
+
.with(false, () => null)
|
|
27
|
+
.exhaustive()
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
#
|
|
27
27
|
# Known false-positive class, accepted at warning tier: a `use…Store` hook can
|
|
28
28
|
# return non-observable services next to the stores — `const { platform } =
|
|
29
|
-
# useStore()` in
|
|
29
|
+
# useStore()` in a gallery app's ShareButton pulls a platform adapter, and a
|
|
30
30
|
# component reading only that does not strictly need the wrap. Wrapping it is
|
|
31
31
|
# harmless; the rule does not distinguish.
|
|
32
32
|
id: missing-observer
|
|
@@ -55,7 +55,7 @@ utils:
|
|
|
55
55
|
# Every name a store hook can introduce, in the three spellings the park uses.
|
|
56
56
|
# Binding these is what lets the rule tell `ui.groupBy` (a plain `UIManifest`
|
|
57
57
|
# prop) apart from `uiStore.x` (the store) — without it the rule fires on any
|
|
58
|
-
# dotted value in the markup, which is how
|
|
58
|
+
# dotted value in the markup, which is how a session-viewer app's deliberately-plain
|
|
59
59
|
# `RichEntityListView` got flagged for rendering `groupBy={ui.groupBy}`.
|
|
60
60
|
store-binding:
|
|
61
61
|
any:
|
|
@@ -97,8 +97,8 @@ utils:
|
|
|
97
97
|
#
|
|
98
98
|
# Stated as an exclusion of the two deferred positions rather than as "appears
|
|
99
99
|
# inside JSX", because real components mostly do NOT dereference the store in
|
|
100
|
-
# the markup:
|
|
101
|
-
# themeStore.layout.type` and `match(galleryStore.detailState)`,
|
|
100
|
+
# the markup: a gallery app's GalleryView reads `const layoutType =
|
|
101
|
+
# themeStore.layout.type` and `match(galleryStore.detailState)`, a session-viewer app's
|
|
102
102
|
# SessionsTreeSection reads `data.sessions.filter(...)` — all render reads,
|
|
103
103
|
# none of them inside a JSX expression. An "inside JSX" test missed every one.
|
|
104
104
|
# The test is structural: a read sitting inside a NESTED function is deferred,
|
|
@@ -152,7 +152,7 @@ rule:
|
|
|
152
152
|
matches: jsx-node
|
|
153
153
|
# The component must RENDER a field off something the store gave it. Both
|
|
154
154
|
# halves matter: a component that pulls a store only to call an action from
|
|
155
|
-
# a handler needs no wrap (
|
|
155
|
+
# a handler needs no wrap (a session-viewer app writes two of those on purpose), and
|
|
156
156
|
# a dotted value in the markup means nothing unless the dotted thing came
|
|
157
157
|
# from a store. `$SLICE` ties the two clauses together.
|
|
158
158
|
- any:
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
# `Resource` must carry type parameters to match. Without that the rule hits
|
|
35
35
|
# `interface Resource { name; url; type; description }` in VolumePhotography — a
|
|
36
36
|
# page listing conference links, nothing to do with async state.
|
|
37
|
-
# CARVE-OUT 1 IS NOW A REPO DECLARATION, not only a glob
|
|
37
|
+
# CARVE-OUT 1 IS NOW A REPO DECLARATION, not only a glob.
|
|
38
38
|
# `@agentvibes/kit` exists since 2026-09 and lives in its own repo, where verify
|
|
39
39
|
# sees its files as `src/resource/resource.ts` — neither `**/packages/kit/**`
|
|
40
40
|
# nor `**/agentvibes-kit/**` matches that, and no path glob can tell that tree
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
# kit_source = "^src/"
|
|
45
45
|
#
|
|
46
46
|
# together with the `appliesTo: not-kit-source` marker below. Same mechanism
|
|
47
|
-
# `[verify] screens` uses
|
|
47
|
+
# `[verify] screens` uses: the repo states a fact about itself,
|
|
48
48
|
# the canon says which rules stand down for it. The globs stay for monorepos
|
|
49
49
|
# that vendor the kit under `packages/kit/`.
|
|
50
50
|
#
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
# `Resource` must carry type parameters to match. Without that the rule hits
|
|
24
24
|
# `interface Resource { name; url; type; description }` in VolumePhotography — a
|
|
25
25
|
# page listing conference links, nothing to do with async state.
|
|
26
|
-
# CARVE-OUT 1 IS NOW A REPO DECLARATION, not only a glob
|
|
26
|
+
# CARVE-OUT 1 IS NOW A REPO DECLARATION, not only a glob.
|
|
27
27
|
# `@agentvibes/kit` exists since 2026-09 and lives in its own repo, where verify
|
|
28
28
|
# sees its files as `src/resource/resource.ts` — neither `**/packages/kit/**`
|
|
29
29
|
# nor `**/agentvibes-kit/**` matches that, and no path glob can tell that tree
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
# kit_source = "^src/"
|
|
34
34
|
#
|
|
35
35
|
# together with the `appliesTo: not-kit-source` marker below. Same mechanism
|
|
36
|
-
# `[verify] screens` uses
|
|
36
|
+
# `[verify] screens` uses: the repo states a fact about itself,
|
|
37
37
|
# the canon says which rules stand down for it. The globs stay for monorepos
|
|
38
38
|
# that vendor the kit under `packages/kit/`.
|
|
39
39
|
#
|
|
@@ -7,13 +7,10 @@
|
|
|
7
7
|
# out once in `catch-empty-tsx.yml`; the short version is that ast-grep has no
|
|
8
8
|
# way to say "both languages", so a twin id per language is the only option.
|
|
9
9
|
#
|
|
10
|
-
# Measured 2026-09-06 across
|
|
11
|
-
# (
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
# doc-e4526f1a parks the question of banning `.otherwise()` outright, so the
|
|
15
|
-
# owner was asked whether to surface the .tsx half before D4 lands and answered
|
|
16
|
-
# «1» (add the twin now, severity warning) on 2026-09-06, is-8385d5dd.
|
|
10
|
+
# Measured 2026-09-06 across five repos that consume guardrails: 185
|
|
11
|
+
# `.otherwise()` chains in `.tsx` that the `.ts` arm never saw. The twin ships
|
|
12
|
+
# at severity warning; whether to ban `.otherwise()` outright is a separate,
|
|
13
|
+
# open question.
|
|
17
14
|
#
|
|
18
15
|
# Keep this file's `rule:` block IDENTICAL to `non-exhaustive-match.yml`.
|
|
19
16
|
#
|
|
@@ -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 `ts-pattern-prefer-exhaustive` (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 `pattern: $X.otherwise($$$)` fired on ANY `.otherwise()` method, not just
|
|
5
5
|
# a ts-pattern chain — a false-positive class. Anchoring to a `match()` chain
|
|
@@ -30,7 +30,7 @@ message: |
|
|
|
30
30
|
It ships in `@agentvibes/kit/react`. Pass dependencies to the constructor
|
|
31
31
|
explicitly so the store stays testable with `new GalleryPageStore(fake, "x")`
|
|
32
32
|
and no render at all.
|
|
33
|
-
See the simple-components skill (§store access)
|
|
33
|
+
See the simple-components skill (§store access).
|
|
34
34
|
rule:
|
|
35
35
|
all:
|
|
36
36
|
- kind: call_expression
|
|
@@ -26,7 +26,7 @@ message: |
|
|
|
26
26
|
It ships in `@agentvibes/kit/react`. Pass dependencies to the constructor
|
|
27
27
|
explicitly so the store stays testable with `new GalleryPageStore(fake, "x")`
|
|
28
28
|
and no render at all.
|
|
29
|
-
See the simple-components skill (§store access)
|
|
29
|
+
See the simple-components skill (§store access).
|
|
30
30
|
rule:
|
|
31
31
|
all:
|
|
32
32
|
- kind: call_expression
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ── simple-components, rule 4 of 4 ─────────────────────────────────────
|
|
2
2
|
#
|
|
3
|
-
# The logic half of the two-tier split
|
|
3
|
+
# The logic half of the two-tier split: a screen picks
|
|
4
4
|
# the models, matches the state and composes views. It carries no styling.
|
|
5
5
|
#
|
|
6
6
|
# Scoped to `**/*.screen.tsx` and nothing else, deliberately. The contract says
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
# one filename the convention makes explicit, so it is the one place the rule can
|
|
11
11
|
# be right without a manifest.
|
|
12
12
|
#
|
|
13
|
-
# WARNING TIER: same reason as `view-file-logic` —
|
|
13
|
+
# WARNING TIER: same reason as `view-file-logic` — the two-tier split is recommendation-tier.
|
|
14
14
|
id: screen-file-styling
|
|
15
15
|
language: tsx
|
|
16
16
|
severity: warning
|
|
@@ -22,7 +22,7 @@ message: |
|
|
|
22
22
|
on a second job and starts growing the layout it should have delegated.
|
|
23
23
|
Move the markup into a `*.view.tsx` (or a shared UI primitive) and let the
|
|
24
24
|
screen pass it data.
|
|
25
|
-
See the simple-components skill (§two-tier)
|
|
25
|
+
See the simple-components skill (§two-tier).
|
|
26
26
|
rule:
|
|
27
27
|
all:
|
|
28
28
|
- kind: jsx_attribute
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# way to say "both languages", so a twin id per language is the only option.
|
|
9
9
|
#
|
|
10
10
|
# Measured 2026-09-06 across the same five repos: 24 findings in `.tsx`
|
|
11
|
-
# (
|
|
11
|
+
# (per repo: 3, 0, 9, 0, 12).
|
|
12
12
|
#
|
|
13
13
|
# Keep this file's `rule:` block IDENTICAL to `silent-default-return.yml`.
|
|
14
14
|
#
|
|
@@ -48,7 +48,7 @@ utils:
|
|
|
48
48
|
kind: identifier
|
|
49
49
|
regex: '^runInAction$'
|
|
50
50
|
# An observable MUTATION — which is the whole defect. Without this clause the
|
|
51
|
-
# rule fires on any async method, and in
|
|
51
|
+
# rule fires on any async method, and in a site-builder repo 10 of its 12 hits were
|
|
52
52
|
# private I/O helpers (`walkDir`, `collectAllFiles`, `uploadFile`) that await
|
|
53
53
|
# a filesystem and never touch a field. Those have no action coverage to lose,
|
|
54
54
|
# so at warning tier they were pure noise.
|