@starci/eslint-grammar-core 0.53.0 → 0.54.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +8 -14
  3. package/dist/app-shell.d.ts +0 -11
  4. package/dist/app-shell.js +2 -190
  5. package/dist/button-arrow.d.ts +0 -7
  6. package/dist/button-arrow.js +1 -50
  7. package/dist/index.d.ts +13 -3
  8. package/dist/index.js +18 -19
  9. package/dist/lib/app-shell-scope.d.ts +0 -2
  10. package/dist/lib/app-shell-scope.js +0 -19
  11. package/dist/lib/app-shell.d.ts +0 -4
  12. package/dist/lib/app-shell.js +0 -25
  13. package/dist/lib/cross-file-inputs.js +2 -3
  14. package/dist/lib/why.js +5 -65
  15. package/dist/mascot.d.ts +0 -21
  16. package/dist/mascot.js +4 -69
  17. package/dist/no-raw-type-size.d.ts +27 -0
  18. package/dist/no-raw-type-size.js +107 -0
  19. package/dist/same-line-size.js +9 -0
  20. package/dist/table-cell-type.js +4 -0
  21. package/docs/app-shell.md +1 -37
  22. package/docs/button-arrow.md +1 -26
  23. package/docs/mascot.md +6 -34
  24. package/docs/no-raw-type-size.md +35 -0
  25. package/docs/rows-in-card.md +1 -1
  26. package/package.json +3 -3
  27. package/runtime/knowledge/patterns/fe/ui.yaml +0 -7
  28. package/runtime/knowledge/ui/composition/app-shell.yaml +4 -4
  29. package/runtime/knowledge/ui/presentation/grammar-laws.yaml +11 -0
  30. package/runtime/modules/goal/source-phrases.yaml +0 -4
  31. package/dist/chip-label.d.ts +0 -14
  32. package/dist/chip-label.js +0 -117
  33. package/dist/data-table-surface.d.ts +0 -18
  34. package/dist/data-table-surface.js +0 -57
  35. package/dist/lib/app-shell-cluster.d.ts +0 -6
  36. package/dist/lib/app-shell-cluster.js +0 -75
  37. package/dist/lib/app-shell-create.d.ts +0 -5
  38. package/dist/lib/app-shell-create.js +0 -37
  39. package/dist/lib/app-shell-owner.d.ts +0 -7
  40. package/dist/lib/app-shell-owner.js +0 -97
  41. package/dist/lib/status-tones.generated.d.ts +0 -2
  42. package/dist/lib/status-tones.generated.js +0 -8
  43. package/dist/message-surfaces.d.ts +0 -6
  44. package/dist/message-surfaces.js +0 -158
  45. package/dist/status-colors.d.ts +0 -19
  46. package/dist/status-colors.js +0 -217
  47. package/dist/suggestion-buttons.d.ts +0 -6
  48. package/dist/suggestion-buttons.js +0 -181
  49. package/dist/surface-card-list.d.ts +0 -20
  50. package/dist/surface-card-list.js +0 -47
  51. package/dist/tab-count-chip.d.ts +0 -7
  52. package/dist/tab-count-chip.js +0 -65
  53. package/docs/chip-label.md +0 -30
  54. package/docs/data-table-surface.md +0 -27
  55. package/docs/message-surfaces.md +0 -37
  56. package/docs/status-colors.md +0 -43
  57. package/docs/suggestion-buttons.md +0 -34
  58. package/docs/surface-card-list.md +0 -33
  59. package/docs/tab-count-chip.md +0 -26
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.54.0 - 2026-11-21
4
+
5
+ - Added: `no-raw-type-size` (TYPE-ROLES, `FE_RAW_TYPE_SIZE`). It reports a Tailwind text-size utility (`text-xs` to `text-2xl` and up, `text-[13px]`), a `fontSize` and a CSS `font-size` in a string in app source, and points to `<Text role>` or `starci-type-<role>`. It is the family's first counting rule (`COUNTING`): a warning until both apps migrate. Delete its entry to make it blocking.
6
+ - Changed: `same-line-size` and `table-cell-type` read `Text role` (a figure or title role in a cell or row is a heading in a list). Versioned with @starci/grammar 0.54.0.
7
+
3
8
  ## 0.53.0 - 2026-11-21
4
9
 
5
10
  - No rule changed: versioned with @starci/grammar 0.52.3 (loading as HeroUI Skeleton shapes, the content-zone loading mode).
package/README.md CHANGED
@@ -12,30 +12,25 @@ const hfs = loadHfs(import.meta.url)
12
12
  export default [...starciFeConfig({ hfs }), ...coreGrammarConfig({ hfs })]
13
13
  ```
14
14
 
15
- Every rule uses the `starci-grammar` namespace and runs at error. The factory checks the selected
15
+ Every rule uses the `starci-grammar` namespace and runs at error, except the counting cohort (`COUNTING` in `src/index.ts`: `no-raw-type-size`), which runs at warn until its entry is deleted. The factory checks the selected
16
16
  Grammar and covers the same source files as the universal factory. Shared AST, type, slot and
17
17
  binding readers are imported from the universal package's explicit infrastructure exports.
18
18
  Family helpers and the generated runtime closure belong to this package.
19
19
 
20
- The rule IDs remain stable when their namespace moves. Laws cover the fixed app shell and navbar,
21
- Grammar-owned structural elements, glyphs and icon sizes, destructive menu entries, status inks,
22
- chip labels that start uppercase, a Button that leads somewhere ending with `endArrow` (no typed or icon arrow), a leading icon only on the primary Button (`button-arrow`, `button-icon-primary-only`), report cards in one axis (`layout-two-axis`), no app-made scroll area (`no-raw-scroll`), underline tabs only in the header band (`tabs-in-well`), a Link that takes its look from the line (`link-look`), outline icons only, no solid icon set (`outline-icons-only`), one object per card and no description under a label (`card-one-content`, `no-label-description`), a Section head that holds one Link or one IconButton and never a Button (`section-head-action`), a tab count passed as `count` and never as "· N" in the label (`tab-count-chip`), row type sizes in a DataTable cell or ListRow, one size per Cluster line, a row title that is plain text when the row opens (`button-arrow`, `table-cell-type`, `same-line-size`, `row-title-link`), generated art rendered through `Mascot` or `MediaFrame` with every `Mascot` naming its asset slot, the page head composed by `PageHeader`, the pane grid (a `PaneGrid` of `Pane`s, a `Pane` of `PaneSection`s that carry no padding of their own, mounted as `Page chrome="panes"`), the route page as one `Page` with its tabs in the header, heading and token scales, vendor ownership and slot-status composition, and a surface nested in another surface left subordinate (no forced `depth="top"`), and a Freestyle region that names its reason (its raw elements are exempt from the paint and raw-element laws). The pill (`Tabs appearance="primary"`) is only the `action` of a `Section` or the value of a row `control`, and a page stacks two underline `Tabs` layers at most (`tabs-switch-zone`, `tabs-depth`; `docs/tabs.md`). Each rule's metadata cites
20
+ The rule IDs remain stable when their namespace moves. Laws cover the navbar control height,
21
+ Grammar-owned structural elements, glyphs and icon sizes, destructive menu entries,
22
+ a Button that leads somewhere ending with `endArrow` (no typed or icon arrow; `button-arrow`), report cards in one axis (`layout-two-axis`), no app-made scroll area (`no-raw-scroll`), no raw type size in app source, only the type roles (`no-raw-type-size`, the counting rule: a warning until its `COUNTING` entry is deleted), underline tabs only in the header band (`tabs-in-well`), a Link that takes its look from the line (`link-look`), outline icons only, no solid icon set (`outline-icons-only`), one object per card and no description under a label (`card-one-content`, `no-label-description`), a Section head that holds one Link or one IconButton and never a Button (`section-head-action`), row type sizes in a DataTable cell or ListRow, one size per Cluster line, a row title that is plain text when the row opens (`button-arrow`, `table-cell-type`, `same-line-size`, `row-title-link`), every `Mascot` naming its asset slot, the page head composed by `PageHeader`, the pane grid (a `PaneGrid` of `Pane`s, a `Pane` of `PaneSection`s that carry no padding of their own, mounted as `Page chrome="panes"`), the route page as one `Page` with its tabs in the header, heading and token scales, vendor ownership and slot-status composition, and a surface nested in another surface left subordinate (no forced `depth="top"`), and a Freestyle region that names its reason (its raw elements are exempt from the paint and raw-element laws). The pill (`Tabs appearance="primary"`) is only the `action` of a `Section` or the value of a row `control`, and a page stacks two underline `Tabs` layers at most (`tabs-switch-zone`, `tabs-depth`; `docs/tabs.md`). Each rule's metadata cites
23
23
  its behavioral knowledge source and the governing ownership test. The R318 surface composition
24
24
  rules (nested control variants, panel-list alignment, layout-only CSS) stay in the universal canon.
25
- `suggestion-buttons` (suggestions and quick replies are a Cluster of neutral sm Buttons, never a Link row, ChoiceChips, ChoiceButtons or Chip that sends; `docs/suggestion-buttons.md`).
26
- `surface-card-list` (0.43.0, LIST-ONE-LOOK: a list is `Section kind="list"` of `ListRow`s, flat rows aligned with the title, never `SurfaceCard kind="list"`; `docs/surface-card-list.md`).
27
25
  `card-is-object` (0.45.0, CARD-OBJECT: a card is one object; a card whose only content is a table, a list, facts, disclosures, a form, a field, an empty notice, markdown or a chart is refused, the message names the flat `Section` form; `docs/card-is-object.md`).
28
- `data-table-surface` (0.45.0: a `DataTable` has one flat look, its `surface` prop is refused and removed by the fix; `docs/data-table-surface.md`).
29
- `message-surfaces` (0.37.31: every chat draws Grammar's faces, the thread `--background`, others' messages outlined with no fill (0.52.0), your own `--accent`; no class or style on `MessageBubble`/`MessageCard`, no class string reaching a message part, no `tone: "surface"` on a `role: "log"` thread; `docs/message-surfaces.md`).
30
26
  The proximity and composition laws of 2026-11-09 each have a doc: `gap-proximity` (a layout element stands at least one gap step closer than its layout parent), `field-label` (a control is labelled by its own `label` prop), `surface-in-surface` (a hand-made divided row list in a surface is `Section kind="list"`) `card-is-object` (a card is one object, never a lone collection) and `page-breadcrumbs` (a console `Page` header states `breadcrumbs`, or `"root"`).
31
27
 
32
28
  ## Migrating from @starci/eslint-canon-fe 8.x
33
29
 
34
- The pinned canon-fe release moved twenty rules here. Their IDs, finding codes and error severity are unchanged;
35
- only the namespace changes from `starci-fe/` to `starci-grammar/`: `app-shell-frame`,
36
- `no-shell-bottom-tabs`, `navbar-control-size`, `navbar-cluster`, `no-navbar-create`,
30
+ The pinned canon-fe release moved rules here. Their IDs, finding codes and error severity are unchanged;
31
+ only the namespace changes from `starci-fe/` to `starci-grammar/`: `navbar-control-size`,
37
32
  `no-raw-structural-element`,
38
- `status-text-uses-soft-foreground`, `vendor-primitive-has-named-owner`,
33
+ `vendor-primitive-has-named-owner`,
39
34
  `no-vendor-icon-outside-icon-leaf`, `heroicons-is-the-glyph-vendor`,
40
35
  `no-icon-size-class`, `destructive-menu-entry-needs-danger-tone`,
41
36
  `no-inline-svg-outside-brand-mark-leaf`, `no-fractional-step`,
@@ -44,8 +39,7 @@ only the namespace changes from `starci-fe/` to `starci-grammar/`: `app-shell-fr
44
39
 
45
40
  1. Set `sides.fe.grammar` to `core` in `hfs.json`; no family is inferred.
46
41
  2. Install this package at its canon-pins version beside `@starci/eslint-canon-fe` 9 in the app
47
- root `devDependencies`. `starci app check` refuses canon-fe 9 without it
48
- (`FE_STACK_FAMILY_LINT_MISSING`), so the rules cannot be lost silently.
42
+ root `devDependencies`; without it the Grammar component rules do not run.
49
43
  3. Compose the universal factory first and this one second, with the same HFS view (the block
50
44
  above). `starci app sync` renders that managed `fe/eslint.config.mjs`.
51
45
  4. Rename references to the moved rules from `starci-fe/` to `starci-grammar/`.
@@ -1,17 +1,6 @@
1
1
  import type { Rule } from "eslint";
2
- /** The app frame is the fixed-viewport Grammar shell; hand-written frame landmarks are rejected. */
3
- export declare const appShellFrame: Rule.RuleModule;
4
- /**
5
- * FE-APP-SHELL-4: the one bottom bar is the Grammar `BottomNav`, and only as the `compactNavigation` of a `WorkspaceShell` (the phone slot). A hand-rolled bottom
6
- * tab bar, any other `compactNavigation` and a `BottomNav` anywhere else are refused.
7
- */
8
- export declare const noShellBottomTabs: Rule.RuleModule;
9
2
  /** Every visible control in a navbar band uses the shared control height through its published size API. */
10
3
  export declare const navbarControlSize: Rule.RuleModule;
11
- /** The right cluster is checked at the bar's actions composition, in visual source order. */
12
- export declare const navbarCluster: Rule.RuleModule;
13
- /** Creation belongs to its page, never to the global app bar. */
14
- export declare const noNavbarCreate: Rule.RuleModule;
15
4
  /** Every app-shell enforcer is gathered into the ordinary FE lint and gate path. */
16
5
  export declare const rules: Record<string, Rule.RuleModule>;
17
6
  /** Every rule is mandatory. */
package/dist/app-shell.js CHANGED
@@ -1,37 +1,16 @@
1
1
  import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
2
2
  /** FE-APP-SHELL-1..5: static app-frame and visible navbar composition from the UI canon. */
3
3
  import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
4
- import { grammarName, isBarControl, propOf, resolveLocal, semanticText, textProp } from "./lib/app-shell.js";
5
- import { appBarOpenings, isAppBar, isAppShell, isNavigationDrawer, ownsAppFrame } from "./lib/app-shell-scope.js";
4
+ import { grammarName, isBarControl, propOf, resolveLocal, textProp } from "./lib/app-shell.js";
5
+ import { isAppBar, isAppShell, isNavigationDrawer } from "./lib/app-shell-scope.js";
6
6
  import { visitVisible } from "./lib/app-shell-visible.js";
7
- import { clusterAlternatives } from "./lib/app-shell-cluster.js";
8
- import { isCreateAction, menuHasCreate } from "./lib/app-shell-create.js";
9
- import { provesImportedBar, provesNavigationOpener } from "./lib/app-shell-owner.js";
10
- import { variableOf } from "@starci/eslint-canon-fe/lib/bindings.mjs";
11
- import { walk } from "@starci/eslint-canon-fe/lib/ast.mjs";
12
7
  const CANON = "knowledge/ui/composition/app-shell.yaml";
13
- const BOTTOM_TABS = /^(?:BottomNavigation|BottomTabBar|MobileBottomNav|MobileTabBar|BottomNav)$/;
14
- const EXPECTED_CLUSTER = ["language:IconButton", "theme:Switch", "notifications:IconButton", "account:AvatarButton"];
15
- /** The cluster of a shell with no notification source (a platform-admin shell with no workspace): notifications are required only where a read feeds them, so a shell without one may omit them. */
16
- const NO_SOURCE_CLUSTER = EXPECTED_CLUSTER.filter((kind) => !kind.startsWith("notifications:"));
17
- /** A notification source: a call of a hook that reads notifications (`useNotifications`, `useWorkspaceNotificationFeed`). */
18
- const NOTIFICATION_READ = /use\w*Notification\w*\s*\(/;
19
8
  const meta = (code, description, messages) => ({
20
9
  type: "problem",
21
10
  docs: { description: `${code}: ${description}`, url: CANON },
22
11
  schema: [],
23
12
  messages,
24
13
  });
25
- /** Whether a slot is present; unknown spreads do not prove either presence or absence. */
26
- const slotPresence = (context, opening, name) => {
27
- const prop = propOf(context, opening, name);
28
- if (!prop.known)
29
- return null;
30
- const value = resolveLocal(context, prop.value);
31
- if (value === null || value === undefined || value.type === "Literal" && (value.value == null || value.value === false))
32
- return false;
33
- return !(value.type === "Identifier" && value.name === "undefined" && !variableOf(context, value)?.defs.length);
34
- };
35
14
  /** Resolve constants and require every possible conditional value to prove the slot contract. */
36
15
  const everyValue = (context, expression, proves, seen = new Set()) => {
37
16
  const node = resolveLocal(context, expression);
@@ -42,90 +21,6 @@ const everyValue = (context, expression, proves, seen = new Set()) => {
42
21
  const visited = new Set(seen).add(node);
43
22
  return [node.consequent, node.alternate].every((branch) => everyValue(context, branch, proves, visited));
44
23
  };
45
- const hasMobileNavigation = (context, opening) => {
46
- const drawerProp = propOf(context, opening, "navigationDrawer");
47
- const drawer = drawerProp.known && everyValue(context, drawerProp.value, (value) => value.type === "ObjectExpression");
48
- const opener = drawer || provesNavigationOpener(context, propOf(context, opening, "compactHeader").value);
49
- const visibility = propOf(context, opening, "navigationVisibility");
50
- const defaultsWide = opener && visibility.known && slotPresence(context, opening, "navigationVisibility") === false;
51
- if (!defaultsWide && (!visibility.known || !everyValue(context, visibility.value, (value) => value.type === "Literal" && value.value === "wide")))
52
- return false;
53
- return opener;
54
- };
55
- /** App-owned tab names count only in a frame owner or a shell's rendered slots. */
56
- const visibleFromShell = (context, target) => {
57
- let visible = false;
58
- walk(context.sourceCode, context.sourceCode.ast, (node) => {
59
- if (node.type !== "JSXOpeningElement" || !isAppShell(context, node))
60
- return;
61
- const inspect = (opening) => { if (opening === target)
62
- visible = true; };
63
- for (const slot of ["header", "compactHeader", "navigation", "primary", "floatingLayer", "compactNavigation"])
64
- visitVisible(context, propOf(context, node, slot).value, inspect);
65
- for (const child of node.parent.children)
66
- visitVisible(context, child, inspect);
67
- });
68
- return visible;
69
- };
70
- /** The app frame is the fixed-viewport Grammar shell; hand-written frame landmarks are rejected. */
71
- export const appShellFrame = defineRule({
72
- meta: meta("FE_APP_SHELL_FRAME", "FE-APP-SHELL-1 uses WorkspaceShell viewport=fixed.", {
73
- frame: "FE_APP_SHELL_FRAME: compose the app frame with WorkspaceShell viewport=\"fixed\"; navigation must resolve to navigationVisibility=\"wide\" and have navigationDrawer or a compactHeader with a left Drawer containing Sidebar presentation=\"drawer\". Grammar owns its header, navigation and independent scroll regions.",
74
- }),
75
- create(context) {
76
- if (!isProductSource(context))
77
- return {};
78
- return { JSXOpeningElement(node) {
79
- const shell = isAppShell(context, node);
80
- const wrongViewport = shell && textProp(context, node, "viewport") !== "fixed";
81
- const missingVisibility = shell && slotPresence(context, node, "navigation") !== false && !hasMobileNavigation(context, node);
82
- const handFrame = ownsAppFrame(context, node) && (node.name.type === "JSXIdentifier" && ["header", "nav", "main"].includes(node.name.name) || isAppBar(context, node) && !appBarOpenings(context).has(node));
83
- if (wrongViewport || missingVisibility || handFrame) {
84
- context.report({ node, messageId: "frame" });
85
- }
86
- } };
87
- },
88
- });
89
- /**
90
- * FE-APP-SHELL-4: the one bottom bar is the Grammar `BottomNav`, and only as the `compactNavigation` of a `WorkspaceShell` (the phone slot). A hand-rolled bottom
91
- * tab bar, any other `compactNavigation` and a `BottomNav` anywhere else are refused.
92
- */
93
- export const noShellBottomTabs = defineRule({
94
- meta: meta("FE_APP_SHELL_BOTTOM_TABS", "FE-APP-SHELL-4 keeps mobile navigation in the sidebar drawer; the Grammar BottomNav stands only as the compactNavigation of a WorkspaceShell.", {
95
- bottom: "FE_APP_SHELL_BOTTOM_TABS: the app shell uses a mobile subnav opener and Sidebar drawer. Remove the hand-made bottom tab bar; a BottomNav stands only as the compactNavigation of a WorkspaceShell, and compactNavigation holds nothing else.",
96
- }),
97
- create(context) {
98
- if (!isProductSource(context))
99
- return {};
100
- /** The Grammar `BottomNav` openings seen, and those a shell holds as its `compactNavigation`. */
101
- const bottomNavs = [];
102
- const inShellSlot = new Set();
103
- const keyOf = (opening) => `${opening.range[0]}:${opening.range[1]}`;
104
- const isBottomNav = (value) => value?.type === "JSXElement" && grammarName(context, value.openingElement) === "BottomNav";
105
- return {
106
- JSXOpeningElement(node) {
107
- const name = grammarName(context, node);
108
- if (name === "BottomNav")
109
- bottomNavs.push(node);
110
- const appTab = name === null && node.name.type === "JSXIdentifier" && BOTTOM_TABS.test(node.name.name) && (ownsAppFrame(context, node) || visibleFromShell(context, node));
111
- const compact = name === "WorkspaceShell" ? propOf(context, node, "compactNavigation") : null;
112
- const value = compact ? resolveLocal(context, compact.value) : null;
113
- const absent = value?.type === "Identifier" && value.name === "undefined" && !variableOf(context, value)?.defs.length;
114
- if (compact && compact.known && isBottomNav(value)) {
115
- inShellSlot.add(keyOf(value.openingElement));
116
- return;
117
- }
118
- if (name !== "BottomNav" && BOTTOM_TABS.test(name ?? "") || appTab || compact && !absent && (!compact.known || compact.value !== null || compact.present))
119
- context.report({ node, messageId: "bottom" });
120
- },
121
- "Program:exit"() {
122
- for (const opening of bottomNavs)
123
- if (!inShellSlot.has(keyOf(opening)))
124
- context.report({ node: opening, messageId: "bottom" });
125
- },
126
- };
127
- },
128
- });
129
24
  const visitBar = (context, node, visit) => {
130
25
  const name = grammarName(context, node);
131
26
  if (name === "WorkspaceShell" && isAppShell(context, node)) {
@@ -139,23 +34,6 @@ const visitBar = (context, node, visit) => {
139
34
  visitVisible(context, propOf(context, node, "trigger").value, visit);
140
35
  }
141
36
  };
142
- const delegatesImportedBar = (context, expression) => {
143
- let imported = false;
144
- let controls = false;
145
- let unknown = false;
146
- visitVisible(context, expression, (opening, name) => {
147
- if (isBarControl(context, opening, name))
148
- controls = true;
149
- if (name !== null)
150
- return;
151
- const proof = provesImportedBar(context, opening);
152
- if (proof === true)
153
- imported = true;
154
- if (proof === false)
155
- unknown = true;
156
- });
157
- return imported && !controls && !unknown;
158
- };
159
37
  /** Whether every value a prop can take is one of the given string literals. */
160
38
  const everyLiteral = (context, expression, allowed) => everyValue(context, expression, (value) => value.type === "Literal" && typeof value.value === "string" && allowed.has(value.value));
161
39
  const TOGGLE = new Set(["toggle"]);
@@ -205,75 +83,9 @@ export const navbarControlSize = defineRule({
205
83
  } };
206
84
  },
207
85
  });
208
- /** The right cluster is checked at the bar's actions composition, in visual source order. */
209
- export const navbarCluster = defineRule({
210
- meta: meta("FE_NAVBAR_CLUSTER", "FE-APP-SHELL-3 fixes navbar action kinds and order.", {
211
- cluster: "FE_NAVBAR_CLUSTER: navbar actions must be a tertiary Language IconButton in DropdownMenu, theme Switch, notification IconButton in Popover, account AvatarButton in DropdownMenu, in that order. Mobile retains notifications then account and moves language/theme into the drawer.",
212
- }),
213
- create(context) {
214
- if (!isProductSource(context))
215
- return {};
216
- return { JSXOpeningElement(node) {
217
- const name = grammarName(context, node);
218
- if (!isAppShell(context, node) && !isAppBar(context, node))
219
- return;
220
- const shellHeader = name === "WorkspaceShell";
221
- const actions = propOf(context, node, shellHeader ? "header" : "actions");
222
- const { alternatives, ownsBar } = clusterAlternatives(context, actions.value, shellHeader);
223
- if (ownsBar)
224
- return;
225
- if (shellHeader && delegatesImportedBar(context, actions.value))
226
- return;
227
- const shapes = [EXPECTED_CLUSTER, ...(NOTIFICATION_READ.test(context.sourceCode.text) ? [] : [NO_SOURCE_CLUSTER])];
228
- const sequences = alternatives.map((sequence) => sequence.join("|"));
229
- const desktop = shapes.map((shape) => shape.join("|"));
230
- const mobile = shapes.map((shape) => shape.slice(2).join("|"));
231
- if (!sequences.some((sequence) => desktop.includes(sequence)) || sequences.some((sequence) => !desktop.includes(sequence) && !mobile.includes(sequence)))
232
- context.report({ node, messageId: "cluster" });
233
- } };
234
- },
235
- });
236
- /** Creation belongs to its page, never to the global app bar. */
237
- export const noNavbarCreate = defineRule({
238
- meta: meta("FE_NAVBAR_CREATE", "FE-APP-SHELL-5 keeps create actions on pages.", {
239
- create: "FE_NAVBAR_CREATE: move this create action from the navbar to its page.",
240
- }),
241
- create(context) {
242
- if (!isProductSource(context))
243
- return {};
244
- const reported = new Set();
245
- const report = (node) => {
246
- if (reported.has(node))
247
- return;
248
- reported.add(node);
249
- context.report({ node, messageId: "create" });
250
- };
251
- const inspect = (control, name) => {
252
- if (name === "DropdownMenu" || name === "Popover") {
253
- if (["entries", "items", "sections"].some((slot) => menuHasCreate(context, propOf(context, control, slot).value)))
254
- report(control);
255
- visitVisible(context, propOf(context, control, "content").value, inspect);
256
- for (const child of control.parent.children)
257
- visitVisible(context, child, inspect);
258
- }
259
- if (!isBarControl(context, control, name) || reported.has(control))
260
- return;
261
- const text = `${semanticText(context, control)} ${control.parent.children.map((child) => context.sourceCode.getText(child)).join(" ")}`;
262
- if (isCreateAction(text))
263
- report(control);
264
- };
265
- return { JSXOpeningElement(node) {
266
- visitBar(context, node, inspect);
267
- } };
268
- },
269
- });
270
86
  /** Every app-shell enforcer is gathered into the ordinary FE lint and gate path. */
271
87
  export const rules = {
272
- "app-shell-frame": appShellFrame,
273
- "no-shell-bottom-tabs": noShellBottomTabs,
274
88
  "navbar-control-size": navbarControlSize,
275
- "navbar-cluster": navbarCluster,
276
- "no-navbar-create": noNavbarCreate,
277
89
  };
278
90
  defineFamilyRules(rules, "knowledge/ui/composition/app-shell.yaml");
279
91
  /** Every rule is mandatory. */
@@ -1,13 +1,6 @@
1
1
  import type { Rule } from "eslint";
2
2
  /** A Button leads somewhere with `endArrow` and does something with `startGlyph`; no typed arrow, no arrow icon, never both. */
3
3
  export declare const buttonArrow: Rule.RuleModule;
4
- /**
5
- * The button-icon law (owner, 2026-11-09): only a PRIMARY Button (`intent="commit"`) carries a leading icon. The Button type already
6
- * refuses `startGlyph` / `startContent` on a literal non-primary intent; this reads what a type cannot see: a Button with no `intent`
7
- * (it renders the secondary step) and an `intent` computed from a variable, a conditional or a spread. A start icon is accepted only
8
- * when `intent` is the literal `"commit"`. The arrow (`endArrow`) is not an icon under this law, and `IconButton` is not judged.
9
- */
10
- export declare const buttonIconPrimaryOnly: Rule.RuleModule;
11
4
  /** The rules this law contributes to the plugin. */
12
5
  export declare const rules: Record<string, Rule.RuleModule>;
13
6
  /** Every rule of this law is an error. */
@@ -1,6 +1,6 @@
1
1
  import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
2
2
  import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
3
- import { attributeOf, descendants, elementOf, grammarBindings, literalAttribute } from "./lib/row-context.js";
3
+ import { attributeOf, descendants, elementOf, grammarBindings } from "./lib/row-context.js";
4
4
  /**
5
5
  * The button arrow law (`FE_BUTTON_ARROW`): a Button that leads somewhere ends with `endArrow`; a Button that does something
6
6
  * starts with a `startGlyph`. The arrow of a destination is the Grammar's own (it slides toward the reading end on hover and is
@@ -11,7 +11,6 @@ import { attributeOf, descendants, elementOf, grammarBindings, literalAttribute
11
11
  * - an `endContent` that is an arrow: an element named `Arrow*` or `ChevronRight*`, or any element whose `source` / `glyph` / `name`
12
12
  * is such an identifier or a string that names `arrow`, `chevron-right` or `chevron-end`;
13
13
  * - `endArrow` together with `startGlyph` or `startContent` (the Button type refuses it as well).
14
- * The button-icon law (`button-icon-primary-only`) lives beside it: only a primary Button (`intent="commit"`) carries `startGlyph` or `startContent`.
15
14
  * `Button` takes the label as its children only, so no string label prop exists to read. `IconButton` has no label to type an arrow
16
15
  * in and no `endArrow`; `TextAction` takes `endContent` but not `endArrow`, so neither is judged.
17
16
  */
@@ -138,57 +137,9 @@ export const buttonArrow = defineRule({
138
137
  };
139
138
  },
140
139
  });
141
- /** The one intent that is the CTA: the primary Button. */
142
- const PRIMARY_INTENT = "commit";
143
- /**
144
- * The button-icon law (owner, 2026-11-09): only a PRIMARY Button (`intent="commit"`) carries a leading icon. The Button type already
145
- * refuses `startGlyph` / `startContent` on a literal non-primary intent; this reads what a type cannot see: a Button with no `intent`
146
- * (it renders the secondary step) and an `intent` computed from a variable, a conditional or a spread. A start icon is accepted only
147
- * when `intent` is the literal `"commit"`. The arrow (`endArrow`) is not an icon under this law, and `IconButton` is not judged.
148
- */
149
- export const buttonIconPrimaryOnly = defineRule({
150
- meta: {
151
- type: "problem",
152
- docs: { description: "FE_BUTTON_ICON_PRIMARY_ONLY: only a primary Button (`intent=\"commit\"`) carries a leading icon (`startGlyph`, `startContent`)." },
153
- schema: [],
154
- messages: {
155
- icon: "The Button sets `{{start}}` but is not primary. Only the primary Button (`intent=\"commit\"`, the CTA) carries a leading icon; a neutral, alternative, dismiss or destructive Button, a suggestion pill and a row action are text only. Remove `{{start}}`, or make this the region's one primary. A Button that leads somewhere keeps `endArrow`.",
156
- small: "The Button sets `{{start}}` at size `sm`. A small Button never carries an icon, not even the primary: a leading icon is for the primary at `md` or `lg`. Remove `{{start}}`, or make the Button `md`.",
157
- },
158
- },
159
- create(context) {
160
- if (!isProductSource(context))
161
- return {};
162
- let bound = new Map();
163
- return {
164
- Program(program) {
165
- bound = grammarBindings(program);
166
- },
167
- JSXOpeningElement(opening) {
168
- if (elementOf(opening, bound).grammar !== "Button")
169
- return;
170
- const isPrimary = literalAttribute(opening, "intent") === PRIMARY_INTENT;
171
- const isSmall = literalAttribute(opening, "size") === "sm";
172
- if (isPrimary && !isSmall)
173
- return;
174
- for (const start of ["startGlyph", "startContent"]) {
175
- const attribute = attributeOf(opening, start);
176
- if (attribute === null)
177
- continue;
178
- const value = attribute.value;
179
- // `startContent={undefined}` / `{null}` states no icon.
180
- if (value?.type === "JSXExpressionContainer" && (value.expression.type === "JSXEmptyExpression" || (value.expression.type === "Identifier" && value.expression.name === "undefined") || (value.expression.type === "Literal" && value.expression.value === null)))
181
- continue;
182
- context.report({ node: attribute, messageId: isPrimary ? "small" : "icon", data: { start } });
183
- }
184
- },
185
- };
186
- },
187
- });
188
140
  /** The rules this law contributes to the plugin. */
189
141
  export const rules = {
190
142
  "button-arrow": buttonArrow,
191
- "button-icon-primary-only": buttonIconPrimaryOnly,
192
143
  };
193
144
  defineFamilyRules(rules, "knowledge/ui/presentation/grammar-laws.yaml#BUTTON-ARROW");
194
145
  /** Every rule of this law is an error. */
package/dist/index.d.ts CHANGED
@@ -21,8 +21,18 @@ export declare const ruleDeclarations: readonly {
21
21
  export declare const ruleOwners: Readonly<Record<string, string>>;
22
22
  /** Every rule of the selected family contract. */
23
23
  export declare const rules: Readonly<Record<string, Rule.RuleModule>>;
24
- /** Every family rule runs at error, with no consumer override surface. */
25
- export declare const recommended: Readonly<Record<string, "error">>;
24
+ /**
25
+ * THE COUNTING COHORT: a family rule that ships at `warn` while the apps migrate onto the API it asks for, with the law it
26
+ * enforces and what ends it. `starci app check --gate lint` reports and counts its findings and never fails on them. THE SWITCH
27
+ * to blocking is deleting the rule's entry here (a family minor): the rule then runs at error like every other. No other rule
28
+ * may be below error, and there is no consumer override (the app's eslint.config.mjs is the managed one-liner, R17).
29
+ */
30
+ export declare const COUNTING: Readonly<Record<string, {
31
+ readonly law: string;
32
+ readonly until: string;
33
+ }>>;
34
+ /** Every family rule runs at error, the counting cohort at warn, with no consumer override surface. */
35
+ export declare const recommended: Readonly<Record<string, "error" | "warn">>;
26
36
  /** The failure-code guidance of every rule. */
27
37
  export declare const why: Readonly<Record<string, {
28
38
  readonly code: string;
@@ -37,7 +47,7 @@ export default plugin;
37
47
  * Add the complete selected-family contract to the universal front-end flat config.
38
48
  * Offset Pop uses the inherited Common renderer contract through its own package entry.
39
49
  * @param input - The selected FE slot view and family.
40
- * @returns A typed source block with every family rule at error.
50
+ * @returns A typed source block with every family rule at error (the counting cohort, `COUNTING`, at warn).
41
51
  */
42
52
  export declare const coreGrammarConfig: (input: {
43
53
  readonly hfs: GrammarHfsView;
package/dist/index.js CHANGED
@@ -4,9 +4,7 @@ import { rules as appShellRules } from "./app-shell.js";
4
4
  import { rules as buttonArrowRules } from "./button-arrow.js";
5
5
  import { rules as cardContentRules } from "./card-content.js";
6
6
  import { rules as cardIsObjectRules } from "./card-is-object.js";
7
- import { rules as chipLabelRules } from "./chip-label.js";
8
7
  import { rules as choiceControlsRules } from "./choice-controls.js";
9
- import { rules as dataTableSurfaceRules } from "./data-table-surface.js";
10
8
  import { rules as fragmentRules } from "./fragment.js";
11
9
  import { rules as drawingRules } from "./drawing.js";
12
10
  import { rules as fieldLabelRules } from "./field-label.js";
@@ -19,8 +17,8 @@ import { rules as linkLookRules } from "./link-look.js";
19
17
  import { rules as mascotRules } from "./mascot.js";
20
18
  import { rules as mediaRules } from "./media.js";
21
19
  import { rules as menuEntriesRules } from "./menu-entries.js";
22
- import { rules as messageSurfacesRules } from "./message-surfaces.js";
23
20
  import { rules as noRawScrollRules } from "./no-raw-scroll.js";
21
+ import { rules as noRawTypeSizeRules } from "./no-raw-type-size.js";
24
22
  import { rules as outlineIconsRules } from "./outline-icons.js";
25
23
  import { rules as pageRules } from "./page.js";
26
24
  import { rules as pageBreadcrumbsRules } from "./page-breadcrumbs.js";
@@ -32,13 +30,9 @@ import { rules as noCardLeadDescriptionRules } from "./no-card-lead-description.
32
30
  import { rules as noNestedLabelRules } from "./no-nested-label.js";
33
31
  import { rules as sectionHeadActionRules } from "./section-head-action.js";
34
32
  import { rules as sameLineSizeRules } from "./same-line-size.js";
35
- import { rules as statusColorsRules } from "./status-colors.js";
36
33
  import { rules as surfaceCardRules } from "./surface-card.js";
37
- import { rules as surfaceCardListRules } from "./surface-card-list.js";
38
34
  import { rules as surfaceDepthRules } from "./surface-depth.js";
39
35
  import { rules as surfaceInSurfaceRules } from "./surface-in-surface.js";
40
- import { rules as suggestionButtonsRules } from "./suggestion-buttons.js";
41
- import { rules as tabCountChipRules } from "./tab-count-chip.js";
42
36
  import { rules as tabsRules } from "./tabs.js";
43
37
  import { rules as tableCellTypeRules } from "./table-cell-type.js";
44
38
  import { rules as textRules } from "./text-rules.js";
@@ -64,9 +58,7 @@ const DECLARED = [
64
58
  { law: "button-arrow", rules: buttonArrowRules },
65
59
  { law: "card-content", rules: cardContentRules },
66
60
  { law: "card-is-object", rules: cardIsObjectRules },
67
- { law: "chip-label", rules: chipLabelRules },
68
61
  { law: "choice-controls", rules: choiceControlsRules },
69
- { law: "data-table-surface", rules: dataTableSurfaceRules },
70
62
  { law: "drawing", rules: drawingRules },
71
63
  { law: "field-label", rules: fieldLabelRules },
72
64
  { law: "freestyle", rules: freestyleRules },
@@ -78,8 +70,8 @@ const DECLARED = [
78
70
  { law: "mascot", rules: mascotRules },
79
71
  { law: "media", rules: mediaRules },
80
72
  { law: "menu-entries", rules: menuEntriesRules },
81
- { law: "message-surfaces", rules: messageSurfacesRules },
82
73
  { law: "no-raw-scroll", rules: noRawScrollRules },
74
+ { law: "no-raw-type-size", rules: noRawTypeSizeRules },
83
75
  { law: "outline-icons", rules: outlineIconsRules },
84
76
  { law: "page", rules: pageRules },
85
77
  { law: "page-breadcrumbs", rules: pageBreadcrumbsRules },
@@ -91,13 +83,9 @@ const DECLARED = [
91
83
  { law: "no-card-lead-description", rules: noCardLeadDescriptionRules },
92
84
  { law: "no-nested-label", rules: noNestedLabelRules },
93
85
  { law: "section-head-action", rules: sectionHeadActionRules },
94
- { law: "status-colors", rules: statusColorsRules },
95
86
  { law: "surface-card", rules: surfaceCardRules },
96
- { law: "surface-card-list", rules: surfaceCardListRules },
97
87
  { law: "surface-depth", rules: surfaceDepthRules },
98
- { law: "suggestion-buttons", rules: suggestionButtonsRules },
99
88
  { law: "surface-in-surface", rules: surfaceInSurfaceRules },
100
- { law: "tab-count-chip", rules: tabCountChipRules },
101
89
  { law: "tabs", rules: tabsRules },
102
90
  { law: "table-cell-type", rules: tableCellTypeRules },
103
91
  { law: "text-rules", rules: textRules },
@@ -120,8 +108,19 @@ export const ruleDeclarations = CONTRIBUTIONS.flatMap(({ law, rules }) => Object
120
108
  export const ruleOwners = Object.fromEntries(ruleDeclarations.map(({ law, name }) => [name, law]));
121
109
  /** Every rule of the selected family contract. */
122
110
  export const rules = Object.fromEntries(CONTRIBUTIONS.flatMap(({ rules }) => Object.entries(rules)));
123
- /** Every family rule runs at error, with no consumer override surface. */
124
- export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, "error"]));
111
+ /**
112
+ * THE COUNTING COHORT: a family rule that ships at `warn` while the apps migrate onto the API it asks for, with the law it
113
+ * enforces and what ends it. `starci app check --gate lint` reports and counts its findings and never fails on them. THE SWITCH
114
+ * to blocking is deleting the rule's entry here (a family minor): the rule then runs at error like every other. No other rule
115
+ * may be below error, and there is no consumer override (the app's eslint.config.mjs is the managed one-liner, R17).
116
+ */
117
+ export const COUNTING = Object.freeze({
118
+ "starci-grammar/no-raw-type-size": { law: "TYPE-ROLES", until: "both apps have moved their raw type sizes onto the type roles" },
119
+ });
120
+ /** The level of one published rule: warn in the counting cohort, error otherwise. */
121
+ const levelOf = (name) => (`starci-grammar/${name}` in COUNTING ? "warn" : "error");
122
+ /** Every family rule runs at error, the counting cohort at warn, with no consumer override surface. */
123
+ export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, levelOf(name)]));
125
124
  /** The failure-code guidance of every rule. */
126
125
  export const why = familyWhy;
127
126
  /** The linter options of the universal canon: no inline configuration, no unused disable directive. */
@@ -134,7 +133,7 @@ const SERVED_FAMILIES = Object.freeze(["core", "offset-pop"]);
134
133
  * Add the complete selected-family contract to the universal front-end flat config.
135
134
  * Offset Pop uses the inherited Common renderer contract through its own package entry.
136
135
  * @param input - The selected FE slot view and family.
137
- * @returns A typed source block with every family rule at error.
136
+ * @returns A typed source block with every family rule at error (the counting cohort, `COUNTING`, at warn).
138
137
  */
139
138
  export const coreGrammarConfig = ({ hfs, family = "core" } = {}) => {
140
139
  if (!hfs || typeof hfs.slotOf !== "function" || typeof hfs.repoRoot !== "string" || hfs.profile !== "fe") {
@@ -143,9 +142,9 @@ export const coreGrammarConfig = ({ hfs, family = "core" } = {}) => {
143
142
  if (!SERVED_FAMILIES.includes(family) || hfs.grammar !== family) {
144
143
  throw new Error(`coreGrammarConfig family ${family} does not match the selected Grammar ${hfs.grammar}`);
145
144
  }
146
- const missing = Object.keys(rules).filter((name) => recommended[`starci-grammar/${name}`] !== "error");
145
+ const missing = Object.keys(rules).filter((name) => recommended[`starci-grammar/${name}`] !== levelOf(name));
147
146
  if (missing.length)
148
- throw new Error(`coreGrammarConfig requires every family rule at error: ${missing.join(", ")}`);
147
+ throw new Error(`coreGrammarConfig requires every family rule at error (the counting cohort at warn): ${missing.join(", ")}`);
149
148
  return [{
150
149
  files: [...SOURCE_FILES],
151
150
  languageOptions: {
@@ -7,7 +7,5 @@ export declare const isAppShell: (context: ReaderContext, opening: TSESTree.JSXO
7
7
  export declare const isNavigationDrawer: (context: ReaderContext, opening: TSESTree.JSXOpeningElement) => boolean;
8
8
  /** Shell-named React owners and the HFS layout kind compose an app frame, rather than page-local navigation. */
9
9
  export declare const ownsAppFrame: (context: ReaderContext, node: TSESTree.JSXOpeningElement) => boolean;
10
- /** Every visible opening hosted by a structurally identified app shell in this source file. */
11
- export declare const appBarOpenings: (context: ReaderContext) => Set<TSESTree.JSXOpeningElement>;
12
10
  /** Grammar bars are app bars unless an explicit generic flow shell establishes site-chrome ownership. */
13
11
  export declare const isAppBar: (context: ReaderContext, opening: TSESTree.JSXOpeningElement) => boolean;
@@ -1,4 +1,3 @@
1
- import { walk } from "@starci/eslint-canon-fe/lib/ast.mjs";
2
1
  import { kindOfFile, roleOfFile } from "@starci/eslint-canon-fe/lib/scope.mjs";
3
2
  import { grammarName, propOf, textProp } from "./app-shell.js";
4
3
  import { visitVisible } from "./app-shell-visible.js";
@@ -59,24 +58,6 @@ export const ownsAppFrame = (context, node) => {
59
58
  sidebar = true; });
60
59
  return sidebar;
61
60
  };
62
- const APP_BAR_CACHE = new WeakMap();
63
- /** Every visible opening hosted by a structurally identified app shell in this source file. */
64
- export const appBarOpenings = (context) => {
65
- const source = context.sourceCode;
66
- const cached = APP_BAR_CACHE.get(source);
67
- if (cached)
68
- return cached;
69
- const openings = new Set();
70
- walk(source, source.ast, (node) => {
71
- if (node.type !== "JSXOpeningElement" || !isAppShell(context, node))
72
- return;
73
- for (const slot of ["header", "compactHeader"]) {
74
- visitVisible(context, propOf(context, node, slot).value, (opening) => { openings.add(opening); });
75
- }
76
- });
77
- APP_BAR_CACHE.set(source, openings);
78
- return openings;
79
- };
80
61
  /** Grammar bars are app bars unless an explicit generic flow shell establishes site-chrome ownership. */
81
62
  export const isAppBar = (context, opening) => {
82
63
  const barName = grammarName(context, opening);
@@ -21,7 +21,3 @@ export declare const propertyKeyText: (key: Node) => string | null;
21
21
  export declare const propOf: (context: ReaderContext, opening: TSESTree.JSXOpeningElement, name: string) => PropValue;
22
22
  /** A statically proven string prop, or null for missing/unknown values. */
23
23
  export declare const textProp: (context: ReaderContext, opening: TSESTree.JSXOpeningElement, name: string) => string | null;
24
- /** The source spelling is semantic evidence for an icon or action whose translated label is dynamic. */
25
- export declare const semanticText: (context: ReaderContext, opening: TSESTree.JSXOpeningElement) => string;
26
- /** The right-cluster role and the Grammar kind that must draw it. */
27
- export declare const clusterRole: (context: ReaderContext, opening: TSESTree.JSXOpeningElement, name: string | null) => string | null;
@@ -158,28 +158,3 @@ export const textProp = (context, opening, name) => {
158
158
  const prop = propOf(context, opening, name);
159
159
  return prop.known ? stringOf(realNode(resolveLocal(context, prop.value))) : null;
160
160
  };
161
- /** The source spelling is semantic evidence for an icon or action whose translated label is dynamic. */
162
- export const semanticText = (context, opening) => {
163
- const values = ["source", "icon", "label", "aria-label", "id", ...ACTION_PROPS].map((name) => {
164
- const prop = propOf(context, opening, name);
165
- return prop.value ? context.sourceCode.getText(prop.value) : "";
166
- });
167
- return values.join(" ");
168
- };
169
- /** The right-cluster role and the Grammar kind that must draw it. */
170
- export const clusterRole = (context, opening, name) => {
171
- if (name === "Switch")
172
- return "theme";
173
- if (name === "AvatarButton")
174
- return "account";
175
- const text = semanticText(context, opening);
176
- if (/language|locale|translate/i.test(text))
177
- return "language";
178
- if (/notification|bell/i.test(text))
179
- return "notifications";
180
- if (/account|avatar|profile/i.test(text))
181
- return "account";
182
- if (/theme|darkmode|color.?mode/i.test(text))
183
- return "theme";
184
- return null;
185
- };