@starci/eslint-grammar-core 0.37.2 → 0.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,162 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.38.1 - 2026-11-12
4
+
5
+ - Changed: released with the Grammar family at 0.38.1 (three spacing values read their role's token); no rule of this package changed.
6
+
7
+ ## 0.38.0 - 2026-11-12
8
+
9
+ - Changed: the content of 0.37.3-0.37.38 on the hfs 6.8 line, released as a minor: since 0.37.2, the version npm serves, the family adds and changes lint rules of `@starci/eslint-grammar-core` (`message-surfaces`, `no-card-lead-description`, `no-nested-label`, `rows-in-card`, `section-head-action`, `single-child-card`, `surface-depth`, `tabs`), which is a minor's change (`RELEASE_GRAMMAR_MINOR_REQUIRED`, contexts/grammars/contributing.md "Patch or minor"); the canon pins' range moves to `~0.38.0`. `@starci/eslint-grammar-core` peers `@starci/hfs ~6.8.0` (0.37.38 peers `~6.7.0`, so no hfs 6.8 app could install it). No component, law or lint rule changed against 0.37.38.
10
+
11
+ ## 0.37.38 - 2026-11-12
12
+
13
+ - Changed: released with the Grammar family at 0.37.38; no rule of this package changed.
14
+
15
+ ## 0.37.36 - 2026-11-11
16
+
17
+ - Changed: released with the Grammar family at 0.37.36; no rule of this package changed.
18
+
19
+ ## 0.37.35 - 2026-11-11
20
+
21
+ - Changed: released with the Grammar family at 0.37.35; no rule of this package changed.
22
+
23
+ ## 0.37.34 - 2026-11-11
24
+
25
+ - Changed: released with the Grammar family at 0.37.34; no rule of this package changed.
26
+
27
+ ## 0.37.33 - 2026-11-11
28
+
29
+ - Changed: `starci-grammar/message-surfaces` (`FE_MESSAGE_SURFACES`) also refuses a surface tone on a chat frame (Grammar 0.37.33, `DNA-COMMON-CHAT-FRAME`): `surface` on a `Pane` with `content="chat"`, or on a `Pane` whose own JSX children (fragments opened) hold a `PaneSection` with `scroll.role: "log"`. Knowledge `MESSAGE-SURFACES` case-3; docs and spec updated.
30
+
31
+ ## 0.37.32 - 2026-11-11
32
+
33
+ - Changed: released with the Grammar family at 0.37.32; no rule of this package changed.
34
+
35
+ ## 0.37.31 - 2026-11-11
36
+
37
+ - Added: `starci-grammar/message-surfaces` (`FE_MESSAGE_SURFACES`, law `MESSAGE-SURFACES`, Grammar `DNA-COMMON-CHAT-SURFACES`): no `className`/`class`/`style`/`UNSAFE_className`/`UNSAFE_style` on a Grammar `MessageBubble` or `MessageCard`; no static class string (attribute, template, `cn`/`clsx`/`cx`/`classNames`/`twMerge`/`twJoin` argument) or style key reaching a Grammar message part (`starci-core-message-bubble…`, `starci-core-message-card…`); no `tone: "surface"` beside `role: "log"` in a `PaneSection` `scroll` literal. Docs `docs/message-surfaces.md`.
38
+
39
+ ## 0.37.30 - 2026-11-10
40
+
41
+ - Changed: released with the Grammar family at 0.37.30; no rule of this package changed.
42
+
43
+ ## 0.37.29 - 2026-11-10
44
+
45
+ - Changed: released with the Grammar family at 0.37.29; no rule of this package changed.
46
+
47
+ ## 0.37.28 - 2026-11-10
48
+
49
+ - Changed: released with the Grammar family at 0.37.28; no rule of this package changed.
50
+
51
+ ## 0.37.27 - 2026-11-10
52
+
53
+ - Changed: released with the Grammar family at 0.37.27; no rule of this package changed.
54
+
55
+ ## 0.37.26 - 2026-11-10
56
+
57
+ - Changed: released with the Grammar family at 0.37.26; no rule of this package changed.
58
+
59
+ ## 0.37.25 - 2026-11-10
60
+
61
+ - Changed: `section-head-action` accepts one `Button intent="neutral" size="sm"` with no icon in a `Section` head `action` (message `button` now means any other Button; new message `icon` for an icon prop); a second command is still `many`. Tests for the neutral sm form, a commit Button, a md Button and an icon Button.
62
+
63
+ ## 0.37.24 - 2026-11-10
64
+
65
+ - Changed: released with the Grammar family at 0.37.24 (the flat aside list reverted); no rule of this package changed.
66
+
67
+ ## 0.37.23 - 2026-11-10
68
+
69
+ - Changed: released with the Grammar family at 0.37.23 (Select trigger text centred); no rule of this package changed.
70
+
71
+ ## 0.37.22 - 2026-11-10
72
+
73
+ - Changed: released with the Grammar family at 0.37.22 (Footer links plain); no rule of this package changed.
74
+
75
+ ## 0.37.21 - 2026-11-10
76
+
77
+ - Changed: released with the Grammar family at 0.37.21 (three narrow-width fixes); no rule of this package changed.
78
+
79
+ ## 0.37.20 - 2026-11-10
80
+
81
+ - Changed: released with the Grammar family at 0.37.20 (the FlowGraph steps fit); no rule of this package changed.
82
+
83
+ ## 0.37.19 - 2026-11-10
84
+
85
+ - Changed: released with the Grammar family at 0.37.19 (a DropdownMenu switch entry); no rule of this package changed.
86
+
87
+ ## 0.37.18 - 2026-11-10
88
+
89
+ - Changed: released with the Grammar family at 0.37.18 (an informative Toast and alert dialog are neutral); no rule of this package changed.
90
+
91
+ ## 0.37.17 - 2026-11-10
92
+
93
+ - Changed: released with the Grammar family at 0.37.17 (an informative Alert is neutral); no rule of this package changed.
94
+
95
+ ## 0.37.16 - 2026-11-10
96
+
97
+ - Changed: `tabs-switch-zone` allows a primary `Tabs` pill when it is the value of a row `control` (an object property named `control` in a select item or list row literal, or a JSX attribute `control={...}`, through a fragment, conditional or `&&`); a pill anywhere else outside the card's `switch` header zone is still an error. Tests for both.
98
+
99
+ ## 0.37.15 - 2026-11-10
100
+
101
+ - Changed: released with the Grammar family at 0.37.15 (code block language label, app bar custom buttons); no rule of this package changed.
102
+
103
+ ## 0.37.14 - 2026-11-10
104
+
105
+ - Changed: released with the Grammar family at 0.37.14 (Link plain, flat aside lists, stacked panes, article headings); no rule of this package changed.
106
+
107
+ ## 0.37.13 - 2026-11-10
108
+
109
+ - Changed: released with the Grammar family at 0.37.13 (a select row's `control`); no rule of this package changed.
110
+
111
+ ## 0.37.12 - 2026-11-09
112
+
113
+ - Changed: released with the Grammar family at 0.37.12 (the body-card menu reserves room only beside the content); no rule of this package changed.
114
+
115
+ ## 0.37.11 - 2026-11-09
116
+
117
+ - Changed: released with the Grammar family at 0.37.11 (the FlowGraph controls reserve their corner); no rule of this package changed.
118
+
119
+ ## 0.37.10 - 2026-11-09
120
+
121
+ - Changed: released with the Grammar family at 0.37.10 (a body card takes a menu); no rule of this package changed.
122
+
123
+ ## 0.37.9 - 2026-11-09
124
+
125
+ - Changed: released with the Grammar family at 0.37.9 (short table columns never wrap); no rule of this package changed.
126
+
127
+ ## 0.37.8 - 2026-11-09
128
+
129
+ - Changed (owner laws): `single-child-card` no longer refuses a card of list or key-value rows (`kind="list"`, `kind="table"`, `kind="select"`, `ListBox`, `DisclosureList`, `Timeline`, `Section kind="list"`, `DescriptionList`), alone or not; it refuses only a card with no zones around ONE `DataTable` or chart. Specs updated (list cards valid).
130
+ - Changed: the `no-raised-surface-in-surface` messages (`why.ts`) now say what the rule has judged since 0.37.5: only a card inside a card is refused; a Pane surface, Dialog, Drawer or Popover hosts cards (the spec has the Dialog case valid). An installed copy older than 0.37.5 still refuses a card in a Dialog: the lane must install 0.37.5 or later.
131
+
132
+ ## 0.37.7 - 2026-11-09
133
+ - Changed: the peer `@starci/hfs` is ~6.7.0 and offset-pop peers core 0.37.7.
134
+
135
+
136
+ - Added: rule `starci-grammar/no-nested-label` (LABEL-SUBLABEL-HIERARCHY): a `Section` or `SurfaceCard` with its own Label inside a labelled `Section` or `SurfaceCard` of the same file is an error; the group takes `sublabel`.
137
+
138
+ ## 0.37.6 - 2026-11-09
139
+
140
+ - Changed: released with the Grammar family at 0.37.6 (a row with an href is pressable whole); no rule of this package changed.
141
+
142
+ ## 0.37.5 - 2026-11-09
143
+
144
+ - Changed: released with the Grammar family at 0.37.5 (SurfaceCard kind="select"; outline glyph sizing); no rule of this package changed. A `no-loose-card-caption` rule was weighed and not added: a syntactic rule cannot tell a card from an app block that renders one, nor an explanation from a legend.
145
+ - Added: rule `rows-in-card` (ROWS-IN-CARD, error): a Grammar `DescriptionList` or `DisclosureList` that no `SurfaceCard`, `Section`, `DataTable` or `Accordion` of the same file encloses is refused (a primitive passed as a JSX attribute value is judged where the receiver draws it). `ListBox` is not read (a navigation list or menu cannot be told from rows of data by syntax).
146
+ - Added: `starci-grammar/no-card-lead-description` (CARD-NO-DESCRIPTION): a muted Grammar `Text` written directly above a `SurfaceCard` in the same children list is an error; the line is a row subtitle or the card `note`.
147
+
148
+ ## 0.37.4 - 2026-11-09
149
+
150
+ - Changed: released with the Grammar family at 0.37.4 (FlowGraph chips, ports and containers; outline icons; EmptyNotice frameless by default); no rule of this package changed.
151
+
152
+ ## 0.37.3 - 2026-11-09
153
+
154
+ - Changed: released with the Grammar family at 0.37.3 (the head row only when every pane has a head; a pane that holds a grid is not capped); no rule of this package changed.
155
+
156
+ ## 0.37.37 - 2026-11-11
157
+
158
+ - Changed: peer `@starci/hfs ~6.8.0`; no lint rule changed.
159
+
3
160
  ## 0.37.2 - 2026-11-09
4
161
 
5
162
  - Changed: released with the Grammar family at 0.37.2 (the shared head row reaches nested grids); no rule of this package changed.
package/README.md CHANGED
@@ -19,10 +19,11 @@ Family helpers and the generated runtime closure belong to this package.
19
19
 
20
20
  The rule IDs remain stable when their namespace moves. Laws cover the fixed app shell and navbar,
21
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 content 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 `switch` header zone of a card, and a page stacks two underline `Tabs` layers at most (`tabs-switch-zone`, `tabs-depth`; `docs/tabs.md`). Each rule's metadata cites
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 content 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 `switch` header zone of a card 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
25
  `suggestion-buttons` (suggestions and quick replies are a Cluster of neutral sm Buttons, never a Link row, ChoiceChips or Chip that sends; `docs/suggestion-buttons.md`).
26
+ `message-surfaces` (0.37.31: every chat draws Grammar's faces, the thread `--background`, others' messages flat `--surface`, 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`).
26
27
  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"`) `single-child-card` (a table, list or chart alone is the surface, not a card's only content) and `page-breadcrumbs` (a console `Page` header states `breadcrumbs`, or `"root"`).
27
28
 
28
29
  ## Migrating from @starci/eslint-canon-fe 8.x
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ import { rules as layoutTwoAxisRules } from "./layout-two-axis.js";
15
15
  import { rules as linkLookRules } from "./link-look.js";
16
16
  import { rules as mascotRules } from "./mascot.js";
17
17
  import { rules as menuEntriesRules } from "./menu-entries.js";
18
+ import { rules as messageSurfacesRules } from "./message-surfaces.js";
18
19
  import { rules as noRawScrollRules } from "./no-raw-scroll.js";
19
20
  import { rules as outlineIconsRules } from "./outline-icons.js";
20
21
  import { rules as pageRules } from "./page.js";
@@ -22,6 +23,9 @@ import { rules as pageBreadcrumbsRules } from "./page-breadcrumbs.js";
22
23
  import { rules as pageHeaderRules } from "./page-header.js";
23
24
  import { rules as paneRules } from "./pane.js";
24
25
  import { rules as rowTitleLinkRules } from "./row-title-link.js";
26
+ import { rules as rowsInCardRules } from "./rows-in-card.js";
27
+ import { rules as noCardLeadDescriptionRules } from "./no-card-lead-description.js";
28
+ import { rules as noNestedLabelRules } from "./no-nested-label.js";
25
29
  import { rules as sectionHeadActionRules } from "./section-head-action.js";
26
30
  import { rules as sameLineSizeRules } from "./same-line-size.js";
27
31
  import { rules as statusColorsRules } from "./status-colors.js";
@@ -53,6 +57,7 @@ const CONTRIBUTIONS = [
53
57
  { law: "link-look", rules: linkLookRules },
54
58
  { law: "mascot", rules: mascotRules },
55
59
  { law: "menu-entries", rules: menuEntriesRules },
60
+ { law: "message-surfaces", rules: messageSurfacesRules },
56
61
  { law: "no-raw-scroll", rules: noRawScrollRules },
57
62
  { law: "outline-icons", rules: outlineIconsRules },
58
63
  { law: "page", rules: pageRules },
@@ -61,6 +66,9 @@ const CONTRIBUTIONS = [
61
66
  { law: "pane", rules: paneRules },
62
67
  { law: "row-title-link", rules: rowTitleLinkRules },
63
68
  { law: "same-line-size", rules: sameLineSizeRules },
69
+ { law: "rows-in-card", rules: rowsInCardRules },
70
+ { law: "no-card-lead-description", rules: noCardLeadDescriptionRules },
71
+ { law: "no-nested-label", rules: noNestedLabelRules },
64
72
  { law: "section-head-action", rules: sectionHeadActionRules },
65
73
  { law: "single-child-card", rules: singleChildCardRules },
66
74
  { law: "status-colors", rules: statusColorsRules },
package/dist/lib/why.js CHANGED
@@ -11,8 +11,8 @@ export const why = {
11
11
  },
12
12
  "tabs-switch-zone": {
13
13
  code: "FE_TABS_SWITCH_ZONE",
14
- en: "A pill (`Tabs appearance=\"primary\"`) is written in JSX in `<file>`, outside the `switch` header zone of a card.",
15
- fix: "A mode or period switch of one block is the card's zone: `headers={[{ kind: \"switch\", label, items, selectedKey, onSelect }]}` with two to four short options. Views of a page are page tabs (`Page header.tabs`); views or filters inside a region are underline `Tabs`.",
14
+ en: "A pill (`Tabs appearance=\"primary\"`) is written in JSX in `<file>`, outside the `switch` header zone of a card and not the value of a row `control`.",
15
+ fix: "A mode or period switch of one block is the card's zone: `headers={[{ kind: \"switch\", label, items, selectedKey, onSelect }]}` with two to four short options. A row-level mode choice goes in the row's `control`. Views of a page are page tabs (`Page header.tabs`); views or filters inside a region are underline `Tabs`.",
16
16
  },
17
17
  "tabs-depth": {
18
18
  code: "FE_TABS_DEPTH",
@@ -24,10 +24,25 @@ export const why = {
24
24
  en: "An underline `Tabs` in `<file>` is written in the body of a `Page`, `Pane` or `PaneSection`: on the pink well or in a pane.",
25
25
  fix: "The second tab layer sits in the white header band under the page tabs: `Page header={{ tabs, subTabs }}`, on its own full-width separator and flush with the band's left inset. Or make the views a `switch` zone or a filter zone of a card.",
26
26
  },
27
+ "rows-in-card": {
28
+ code: "FE_ROWS_IN_CARD",
29
+ en: "A `DescriptionList` or `DisclosureList` in `<file>` stands with no `Section` or `SurfaceCard` around it.",
30
+ fix: "Rows are always a card: put them in a `Section kind=\"list\"` or a `SurfaceCard`. Grammar draws the shadow (no border) on the pink well and the 1px border (no shadow) on a white aside, pane or drawer by itself.",
31
+ },
32
+ "no-card-lead-description": {
33
+ code: "FE_NO_CARD_LEAD_DESCRIPTION",
34
+ en: "A muted `Text` in `<file>` stands directly above a `SurfaceCard` as its description.",
35
+ fix: "A card has no description. Put the line in the row subtitle (`SurfaceCard kind=\"select\"` or `kind=\"list\"`), or, when it explains the card's data (a legend, a source, a period), in the card `note`.",
36
+ },
37
+ "no-nested-label": {
38
+ code: "FE_NO_NESTED_LABEL",
39
+ en: "A `Section` or `SurfaceCard` in `<file>` has its own Label inside a labelled `Section` or `SurfaceCard`.",
40
+ fix: "A section has ONE Label. A group inside it is named by a Sublabel: use `sublabel=\"...\"` instead of `title` / `label` (Grammar draws it 12 / 500 muted, 8px above the card, groups 24px apart).",
41
+ },
27
42
  "section-head-action": {
28
43
  code: "FE_SECTION_HEAD_ACTION",
29
- en: "The `Section` head `action` in `<file>` holds a `Button` or more than one command.",
30
- fix: "A section's head is one row: the label and an optional count chip at the start, at most ONE thing at the end. Navigation is a `Link variant=\"head\"` (the label then an arrow that slides on hover), an info is an `IconButton`. A command that does not navigate goes in the card or the page header.",
44
+ en: "The `Section` head `action` in `<file>` holds a Button that is not a neutral small text Button, or more than one command.",
45
+ fix: "A section's head is one row: the label and an optional count chip at the start, at most ONE thing at the end: a `Link variant=\"head\"` (the label then an arrow that slides on hover), an info `IconButton`, or a text `Button intent=\"neutral\" size=\"sm\"` (no icon, never the commit).",
31
46
  },
32
47
  "tab-count-chip": {
33
48
  code: "FE_TAB_COUNT_CHIP",
@@ -176,8 +191,8 @@ export const why = {
176
191
  },
177
192
  "no-raised-surface-in-surface": {
178
193
  code: "FE_RAISED_SURFACE_IN_SURFACE",
179
- en: "A `SurfaceCard` in `<file>` stands inside another SurfaceCard, a Pane surface, or a Dialog, Drawer, AlertDialog or Popover: a surface never stands inside a surface.",
180
- fix: "Give the content to the host's own body, or use a kind of the outer card (`list`, `figures`) or its typed `headers` and `footers` zones for what needs its own faces.",
194
+ en: "A `SurfaceCard` in `<file>` stands inside another SurfaceCard: a card never stands inside a card (a Pane surface, Dialog, Drawer or Popover hosts cards, bordered, since 0.37.5).",
195
+ fix: "Give the content to the outer card's own body, or use a kind of the outer card (`list`, `figures`) or its typed `headers` and `footers` zones for what needs its own faces.",
181
196
  },
182
197
  "no-shell-bottom-tabs": {
183
198
  code: "FE_APP_SHELL_BOTTOM_TABS",
@@ -191,8 +206,8 @@ export const why = {
191
206
  },
192
207
  "single-child-card": {
193
208
  code: "FE_SINGLE_CHILD_CARD",
194
- en: "A `SurfaceCard` in `<file>` has no zones and holds one table, list or chart (a `DataTable`, `ListBox`, `ItemList`, `DisclosureList`, `Timeline`, `Section kind=\"list\"`, `BarChart`, `ProportionBar`, `BubbleMap`, `FlowGraph`, `MermaidDiagram`, or is `kind=\"table\"` or `kind=\"list\"`): a second frame around the one the Grammar already draws.",
195
- fix: "Drop the card: put the title in a `Section` head (`title`) and one line under it in `Section caption`. A card groups two or more different parts, or carries zones (`headers`, `footers`) or head actions (`labelEnd`).",
209
+ en: "A `SurfaceCard` in `<file>` has no zones and holds one `DataTable` or chart (`BarChart`, `ProportionBar`, `BubbleMap`, `FlowGraph`, `MermaidDiagram`): a standalone table or chart is its own surface, so the card is a second frame. A card of list or key-value rows is valid.",
210
+ fix: "Drop the card: put the title in a `Section` head (`title`) and one line under it in `Section caption`. A card groups two or more different parts, or carries zones (`headers`, `footers`) or head actions (`labelEnd`); a list card (`kind=\"list\"`, `kind=\"table\"`) is always valid.",
196
211
  },
197
212
  "surface-card-kind": {
198
213
  code: "FE_SURFACE_CARD_KIND",
@@ -239,6 +254,11 @@ export const why = {
239
254
  en: "A Link is the title of a row in `<file>` that already opens (onPress, onAction, href, chevron, or a DataTable with onRowAction or row hrefs).",
240
255
  fix: "The row is the one pressable: write the title as plain text (`<Text isStrong>`) and keep the destination on the row.",
241
256
  },
257
+ "message-surfaces": {
258
+ code: "FE_MESSAGE_SURFACES",
259
+ en: "`<file>` restyles a chat face: a class or style on MessageBubble or MessageCard, a class string reaching into a Grammar message part, a chat thread asked for the surface tone, or a chat frame (`Pane content=\"chat\"`, a Pane holding a log thread) given `surface`.",
260
+ fix: "Remove the override: the chat frame (head, thread, composer) is `--background` (`Pane content=\"chat\"`, no `surface`, DNA-COMMON-CHAT-FRAME), others' messages the flat `--surface`, your own `--accent` (DNA-COMMON-CHAT-SURFACES); a card's replies are `SurfaceCard kind=\"list\" layout=\"suggestions\"`.",
261
+ },
242
262
  "suggestion-buttons": {
243
263
  code: "FE_SUGGESTION_BUTTONS",
244
264
  en: "A Link row, a ChoiceChips or a Chip in `<file>` runs an action or sends its own label as a suggestion.",
@@ -0,0 +1,6 @@
1
+ import type { Rule } from "eslint";
2
+ export declare const messageSurfaces: Rule.RuleModule;
3
+ /** The rules this law contributes to the plugin. */
4
+ export declare const rules: Record<string, Rule.RuleModule>;
5
+ /** Every rule of this law is an error. */
6
+ export declare const recommended: Record<string, "error">;
@@ -0,0 +1,158 @@
1
+ import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
2
+ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
3
+ import { attributeOf, elementOf, grammarBindings, keyName, propertyOf } from "./lib/row-context.js";
4
+ /**
5
+ * The chat surfaces law (`FE_MESSAGE_SURFACES`, Grammar 0.37.31, DNA-COMMON-CHAT-SURFACES): every chat draws the same three faces, and they are Grammar's
6
+ * alone. The thread is the page tone (`--background`), a message of someone else (`MessageBubble` incoming, `MessageCard`) is the flat surface (no border,
7
+ * no shadow), the reader's own message is `--accent` with `--accent-foreground`. An app never restyles them. The law flags, in cheap static shapes only:
8
+ * - a `className`, `class`, `style` or `UNSAFE_className` attribute on a Grammar `MessageBubble` or `MessageCard` (their props carry none; a cast or a
9
+ * spread that smuggles one past the type is still a restyle);
10
+ * - a static class string or a style key in product source that names a Grammar message part (`starci-core-message-bubble…`, `starci-core-message-card…`):
11
+ * an arbitrary-variant utility (`[&_.starci-core-message-bubble-body]:bg-white`) or a selector reaching into the bubble;
12
+ * - a `PaneSection` whose `scroll` object literal states `role: "log"` with `tone: "surface"`: a thread is always the page tone (the Grammar ignores the
13
+ * tone), so the word misleads the reader of the code;
14
+ * - a surface tone on a chat frame (0.37.33, DNA-COMMON-CHAT-FRAME): `surface` on a `Pane` with `content="chat"`, or on a `Pane` whose own children
15
+ * hold a `PaneSection` with `scroll.role: "log"`. A chat frame (head, thread, composer footer) is `--background` wherever it stands; the Grammar ignores
16
+ * the tone there, so the word misleads.
17
+ * A spread, a computed class or a tone held in a variable is not read; a thread drawn by a component of the app's own is not seen through.
18
+ */
19
+ const MESSAGE_PARTS = /starci-core-message-(?:bubble|card)/;
20
+ const STYLE_ATTRIBUTES = new Set(["className", "class", "style", "UNSAFE_className", "UNSAFE_style"]);
21
+ const FACES = new Set(["MessageBubble", "MessageCard"]);
22
+ /** The static string a literal or a template without expressions holds, or null. */
23
+ const staticString = (node) => {
24
+ if (node.type === "Literal" && typeof node.value === "string")
25
+ return node.value;
26
+ if (node.type === "TemplateLiteral")
27
+ return node.quasis.map((quasi) => quasi.value.cooked ?? "").join(" ");
28
+ return null;
29
+ };
30
+ /** Whether a `scroll` attribute states `role: "log"` in an object literal. */
31
+ const isLogScroll = (opening) => {
32
+ const value = attributeOf(opening, "scroll")?.value;
33
+ if (value?.type !== "JSXExpressionContainer" || value.expression.type !== "ObjectExpression")
34
+ return false;
35
+ const role = propertyOf(value.expression, "role")?.value;
36
+ return role?.type === "Literal" && role.value === "log";
37
+ };
38
+ /** Whether a Pane states `content="chat"`. */
39
+ const isChatContent = (opening) => {
40
+ const value = attributeOf(opening, "content")?.value;
41
+ if (value == null)
42
+ return false;
43
+ if (value.type === "Literal")
44
+ return value.value === "chat";
45
+ return value.type === "JSXExpressionContainer" && value.expression.type === "Literal" && value.expression.value === "chat";
46
+ };
47
+ /** Whether a Pane's own JSX children (a fragment opened) hold a Grammar `PaneSection` thread. */
48
+ const holdsThread = (opening, bound) => {
49
+ const element = opening.parent;
50
+ if (element.type !== "JSXElement")
51
+ return false;
52
+ const walk = (children) => children.some((child) => {
53
+ if (child.type === "JSXFragment")
54
+ return walk(child.children);
55
+ if (child.type !== "JSXElement")
56
+ return false;
57
+ return elementOf(child.openingElement, bound).grammar === "PaneSection" && isLogScroll(child.openingElement);
58
+ });
59
+ return walk(element.children);
60
+ };
61
+ export const messageSurfaces = defineRule({
62
+ meta: {
63
+ type: "problem",
64
+ docs: { description: "FE_MESSAGE_SURFACES: chat bubbles, message cards and the thread ground are Grammar's faces; an app never restyles them." },
65
+ schema: [],
66
+ messages: {
67
+ attribute: "`{{component}}` takes no `{{attribute}}`: every chat draws the same faces (the thread on `--background`, others' messages flat `--surface`, your own `--accent`). Remove it.",
68
+ part: "This class or style reaches into a Grammar message part (`{{part}}`). Chat faces are Grammar's (DNA-COMMON-CHAT-SURFACES); remove the override.",
69
+ tone: "A chat thread (`scroll.role: \"log\"`) is always the page tone; `tone: \"surface\"` is ignored. Remove `tone`.",
70
+ frame: "A chat frame (`Pane content=\"chat\"`, or a Pane that holds a `scroll.role: \"log\"` thread) is `--background` wherever it stands (DNA-COMMON-CHAT-FRAME); `surface` is ignored there. Remove `surface` and give the pane `content=\"chat\"`.",
71
+ },
72
+ },
73
+ create(context) {
74
+ if (!isProductSource(context))
75
+ return {};
76
+ let bound = new Map();
77
+ const reportPart = (node, text) => {
78
+ const part = MESSAGE_PARTS.exec(text)?.[0];
79
+ if (part !== undefined)
80
+ context.report({ node, messageId: "part", data: { part } });
81
+ };
82
+ return {
83
+ Program(program) {
84
+ bound = grammarBindings(program);
85
+ },
86
+ JSXOpeningElement(opening) {
87
+ const { grammar } = elementOf(opening, bound);
88
+ if (grammar !== null && FACES.has(grammar)) {
89
+ for (const entry of opening.attributes) {
90
+ if (entry.type !== "JSXAttribute" || entry.name.type !== "JSXIdentifier" || !STYLE_ATTRIBUTES.has(entry.name.name))
91
+ continue;
92
+ context.report({ node: entry, messageId: "attribute", data: { component: grammar, attribute: entry.name.name } });
93
+ }
94
+ }
95
+ if (grammar === "Pane") {
96
+ const surface = attributeOf(opening, "surface");
97
+ const off = surface?.value?.type === "JSXExpressionContainer" && surface.value.expression.type === "Literal" && surface.value.expression.value === false;
98
+ if (surface !== null && !off && (isChatContent(opening) || holdsThread(opening, bound))) {
99
+ context.report({ node: surface, messageId: "frame" });
100
+ }
101
+ }
102
+ if (grammar === "PaneSection") {
103
+ const value = attributeOf(opening, "scroll")?.value;
104
+ if (value?.type !== "JSXExpressionContainer" || value.expression.type !== "ObjectExpression")
105
+ return;
106
+ const role = propertyOf(value.expression, "role")?.value;
107
+ const tone = propertyOf(value.expression, "tone");
108
+ if (role?.type === "Literal" && role.value === "log" && tone?.value.type === "Literal" && tone.value.value === "surface") {
109
+ context.report({ node: tone, messageId: "tone" });
110
+ }
111
+ }
112
+ },
113
+ JSXAttribute(attribute) {
114
+ if (attribute.name.type !== "JSXIdentifier" || !STYLE_ATTRIBUTES.has(attribute.name.name) || attribute.value == null)
115
+ return;
116
+ if (attribute.value.type === "Literal") {
117
+ if (typeof attribute.value.value === "string")
118
+ reportPart(attribute.value, attribute.value.value);
119
+ return;
120
+ }
121
+ if (attribute.value.type !== "JSXExpressionContainer")
122
+ return;
123
+ const expression = attribute.value.expression;
124
+ const text = staticString(expression);
125
+ if (text !== null) {
126
+ reportPart(expression, text);
127
+ return;
128
+ }
129
+ if (expression.type === "ObjectExpression") {
130
+ for (const property of expression.properties) {
131
+ if (property.type !== "Property")
132
+ continue;
133
+ const key = keyName(property);
134
+ if (key !== null)
135
+ reportPart(property, key);
136
+ }
137
+ }
138
+ },
139
+ CallExpression(call) {
140
+ // a class builder (`cn(...)`, `clsx(...)`): its static string arguments are class strings
141
+ if (call.callee.type !== "Identifier" || !/^(cn|clsx|cx|classNames|classnames|twMerge|twJoin)$/.test(call.callee.name))
142
+ return;
143
+ for (const argument of call.arguments) {
144
+ const text = staticString(argument);
145
+ if (text !== null)
146
+ reportPart(argument, text);
147
+ }
148
+ },
149
+ };
150
+ },
151
+ });
152
+ /** The rules this law contributes to the plugin. */
153
+ export const rules = {
154
+ "message-surfaces": messageSurfaces,
155
+ };
156
+ defineFamilyRules(rules, "knowledge/ui/presentation/grammar-laws.yaml#MESSAGE-SURFACES");
157
+ /** Every rule of this law is an error. */
158
+ export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, "error"]));
@@ -0,0 +1,7 @@
1
+ import type { Rule } from "eslint";
2
+ /** No free-standing description line directly above a SurfaceCard. */
3
+ export declare const noCardLeadDescription: Rule.RuleModule;
4
+ /** The rules this law contributes to the plugin. */
5
+ export declare const rules: Record<string, Rule.RuleModule>;
6
+ /** Every rule of this law is an error. */
7
+ export declare const recommended: Record<string, "error">;
@@ -0,0 +1,55 @@
1
+ import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
2
+ import { elementNameOf, grammarName, renderedChildren, stringProp } from "./lib/grammar-jsx.js";
3
+ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
4
+ /**
5
+ * NO CARD LEAD DESCRIPTION (owner, 2026-11-09, CARD-NO-DESCRIPTION). A card head is its label, a count chip, one fact and one end action: it has NO description. The
6
+ * words that explain a card's data go in the card's `note` (a legend, a source, a period); the words that explain a row are that row's own subtitle (`kind="select"`
7
+ * and `kind="list"`). A free-standing muted line placed directly above a card (the title + description + card pattern) is the same description drawn by hand.
8
+ *
9
+ * WHAT IT READS. In product source, a Grammar `Text` with `tone="muted"` that is the sibling written IMMEDIATELY BEFORE a Grammar `SurfaceCard` in the same children list.
10
+ *
11
+ * WHAT IT LEAVES ALONE. A muted `Text` anywhere else (inside a card, between two cards, below a card), a native `<p>`, and any `Text` with another tone: no static signal tells
12
+ * those apart from a legend or a body line, so the rule stays on the one pattern that is certain.
13
+ */
14
+ const isMutedText = (context, node) => {
15
+ if (node.type !== "JSXElement")
16
+ return false;
17
+ return grammarName(context, node.openingElement) === "Text" && stringProp(node.openingElement, "tone") === "muted";
18
+ };
19
+ const isCard = (context, node) => node !== undefined && node.type === "JSXElement" && elementNameOf(node) !== null && grammarName(context, node.openingElement) === "SurfaceCard";
20
+ /** No free-standing description line directly above a SurfaceCard. */
21
+ export const noCardLeadDescription = defineRule({
22
+ meta: {
23
+ type: "problem",
24
+ docs: { description: "CARD-NO-DESCRIPTION: a card has no lead description; the line goes in a row subtitle or the card `note`." },
25
+ schema: [],
26
+ messages: {
27
+ lead: "A muted `Text` stands directly above a `SurfaceCard` as its description. A card has no description: put the line in the row subtitle (`kind=\"select\"` or `kind=\"list\"`) or, if it explains the card's data (a legend, a source, a period), in the card `note`.",
28
+ },
29
+ },
30
+ create(context) {
31
+ if (!isProductSource(context))
32
+ return {};
33
+ const check = (children) => {
34
+ const rendered = renderedChildren(children);
35
+ rendered.forEach((child, index) => {
36
+ if (!isMutedText(context, child))
37
+ return;
38
+ if (!isCard(context, rendered[index + 1]))
39
+ return;
40
+ context.report({ node: child, messageId: "lead" });
41
+ });
42
+ };
43
+ return {
44
+ JSXElement(node) { check(node.children); },
45
+ JSXFragment(node) { check(node.children); },
46
+ };
47
+ },
48
+ });
49
+ /** The rules this law contributes to the plugin. */
50
+ export const rules = {
51
+ "no-card-lead-description": noCardLeadDescription,
52
+ };
53
+ defineFamilyRules(rules, "knowledge/ui/presentation/grammar-laws.yaml#CARD-NO-DESCRIPTION");
54
+ /** Every rule of this law is an error. */
55
+ export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, "error"]));
@@ -0,0 +1,7 @@
1
+ import type { Rule } from "eslint";
2
+ /** One Label per section; nested groups use a Sublabel. */
3
+ export declare const noNestedLabel: Rule.RuleModule;
4
+ /** The rules this law contributes to the plugin. */
5
+ export declare const rules: Record<string, Rule.RuleModule>;
6
+ /** Every rule of this law is an error. */
7
+ export declare const recommended: Record<string, "error">;
@@ -0,0 +1,67 @@
1
+ import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
2
+ import { attributeOf, grammarName } from "./lib/grammar-jsx.js";
3
+ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
4
+ /**
5
+ * NO NESTED LABEL (owner, 2026-11-09, LABEL-SUBLABEL-HIERARCHY). A section has exactly ONE Label (its head, 14/500, 12px above its content). The groups nested inside it
6
+ * are named by a Sublabel (12/500 muted, 8px above the card), never by a second Label: a `Section` or `SurfaceCard` inside a labelled one takes `sublabel`, not `title`/`label`.
7
+ *
8
+ * WHAT IT READS. In product source, a Grammar `Section` with a `title` or a `SurfaceCard` with a `label` whose JSX ancestor in the same file is a Grammar `Section` with a
9
+ * `title` or a `SurfaceCard` with a `label`. A Grammar element passed as a JSX attribute value is judged where the receiver draws it.
10
+ *
11
+ * WHAT IT LEAVES ALONE. Nesting across files (a block that returns a labelled card inside a parent's labelled section) and non-product source.
12
+ */
13
+ const LABEL_PROP = { Section: "title", SurfaceCard: "label" };
14
+ /** The Grammar name of the element when it is a Section or SurfaceCard that carries its Label prop, else null. */
15
+ const labelOf = (context, opening) => {
16
+ const name = grammarName(context, opening);
17
+ if (name === null)
18
+ return null;
19
+ const prop = LABEL_PROP[name];
20
+ return prop !== undefined && attributeOf(opening, prop) !== undefined ? name : null;
21
+ };
22
+ const labelledAncestor = (context, opening) => {
23
+ let previous = opening;
24
+ for (let current = opening.parent?.parent; current !== undefined && current !== null; previous = current, current = current.parent) {
25
+ if (current.type === "JSXAttribute")
26
+ return null;
27
+ if (current.type !== "JSXElement" || previous === current.openingElement)
28
+ continue;
29
+ const found = labelOf(context, current.openingElement);
30
+ if (found !== null)
31
+ return found;
32
+ }
33
+ return null;
34
+ };
35
+ /** One Label per section; nested groups use a Sublabel. */
36
+ export const noNestedLabel = defineRule({
37
+ meta: {
38
+ type: "problem",
39
+ docs: { description: "LABEL-SUBLABEL-HIERARCHY: a Section or SurfaceCard inside a labelled Section or SurfaceCard uses `sublabel`, never a second `title`/`label`." },
40
+ schema: [],
41
+ messages: {
42
+ nested: "A `{{name}}` with its own Label stands inside a labelled `{{parent}}`. A section has ONE Label; a group inside it is named by a Sublabel: use `sublabel=\"…\"` instead of `{{prop}}`.",
43
+ },
44
+ },
45
+ create(context) {
46
+ if (!isProductSource(context))
47
+ return {};
48
+ return {
49
+ JSXOpeningElement(opening) {
50
+ const name = labelOf(context, opening);
51
+ if (name === null)
52
+ return;
53
+ const parent = labelledAncestor(context, opening);
54
+ if (parent === null)
55
+ return;
56
+ context.report({ node: opening, messageId: "nested", data: { name, parent, prop: LABEL_PROP[name] ?? "label" } });
57
+ },
58
+ };
59
+ },
60
+ });
61
+ /** The rules this law contributes to the plugin. */
62
+ export const rules = {
63
+ "no-nested-label": noNestedLabel,
64
+ };
65
+ defineFamilyRules(rules, "knowledge/ui/presentation/grammar-laws.yaml#LABEL-SUBLABEL-HIERARCHY");
66
+ /** Every rule of this law is an error. */
67
+ export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, "error"]));
@@ -0,0 +1,7 @@
1
+ import type { Rule } from "eslint";
2
+ /** A list of rows stands in a card. */
3
+ export declare const rowsInCard: Rule.RuleModule;
4
+ /** The rules this law contributes to the plugin. */
5
+ export declare const rules: Record<string, Rule.RuleModule>;
6
+ /** Every rule of this law is an error. */
7
+ export declare const recommended: Record<string, "error">;