@starci/eslint-grammar-core 0.23.2 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.24.0 - 2026-11-06
4
+
5
+ - Added: `no-button-view-switch` (R380, `FE_GROUPED_CHOICE_CONTROL`): two or more adjacent `Button` or `IconButton` elements, or one in a `.map`, carrying `aria-pressed`, `isSelected` or `isActive` are joined buttons or pills acting as tabs; use `Tabs` in the block's `filter` header zone. `docs/choice-controls.md` says which component switches what.
6
+ - Added: `no-primary-tabs-misuse` (R380): `Tabs appearance="primary"` and the `switch` header zone hold two to four fixed options with no `count`, `href` or `isAttention`; a literal that carries one is refused.
7
+ - Changed: the `SegmentedControl` replacement names `Tabs appearance="primary"`; the component is removed from `@starci/grammar` 0.24.0.
8
+ - Changed: with `@starci/grammar` 0.24.0 (the family shares a minor). `surface-card-kind` (R355) refuses a `Tabs`, `SearchField` or `Divider` inside a `{ kind: "custom" }` zone of a `SurfaceCard` or `Board` `headers` or `footers` array (message `zone`), and its messages and the `no-raised-surface-in-surface` fix name the typed zones instead of the removed `kind="bands"` and the renamed `footer` (now `note`).
9
+
3
10
  ## 0.23.2 - 2026-11-06
4
11
 
5
12
  - Changed: the peer range of `@starci/eslint-canon-fe` follows the canon's new minor (`~9.16.0`, eslint-canon-fe 9.16.0); no rule of this package changed. Grammar stays at 0.23.3 (a lint patch never re-releases it).
@@ -7,11 +7,20 @@ import type { Rule } from "eslint";
7
7
  *
8
8
  * WHAT IT READS. A JSX element named `ButtonGroup`, `FilterButtonGroup` or `SegmentedControl` in product source, written
9
9
  * bare or as a member (`Grammar.ButtonGroup`). The components stay exported and deprecated for one release.
10
+ *
11
+ * A second rule holds the same law for loose buttons: two or more adjacent `Button` or `IconButton` elements (or one written in a
12
+ * `.map`) that carry `aria-pressed`, `isSelected` or `isActive` are joined buttons acting as tabs, a pill toggle ("This month / Last
13
+ * month"). A switch between views or periods of one block is `Tabs` (the primary underline) in the block's `filter` header zone;
14
+ * `ChoiceChips` or `RadioGroup` choose a form value; a button holds a command, never a selection state.
10
15
  */
11
16
  /** Each banned component with the replacement its message names. */
12
17
  export declare const REPLACEMENTS: Readonly<Record<string, string>>;
13
18
  /** No ButtonGroup, FilterButtonGroup or SegmentedControl in product source. */
14
19
  export declare const noGroupedChoiceControls: Rule.RuleModule;
20
+ /** No joined buttons acting as tabs: two or more Buttons carrying a selection state are a view switch. */
21
+ export declare const noButtonViewSwitch: Rule.RuleModule;
22
+ /** Primary tabs (a pill in a track) switch a mode or period: 2 to 4 short fixed options, no count, no destination. */
23
+ export declare const noPrimaryTabsMisuse: Rule.RuleModule;
15
24
  /** The rules this law contributes to the plugin. */
16
25
  export declare const rules: Record<string, Rule.RuleModule>;
17
26
  /** Every rule of this law is an error. */
@@ -8,12 +8,17 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
8
8
  *
9
9
  * WHAT IT READS. A JSX element named `ButtonGroup`, `FilterButtonGroup` or `SegmentedControl` in product source, written
10
10
  * bare or as a member (`Grammar.ButtonGroup`). The components stay exported and deprecated for one release.
11
+ *
12
+ * A second rule holds the same law for loose buttons: two or more adjacent `Button` or `IconButton` elements (or one written in a
13
+ * `.map`) that carry `aria-pressed`, `isSelected` or `isActive` are joined buttons acting as tabs, a pill toggle ("This month / Last
14
+ * month"). A switch between views or periods of one block is `Tabs` (the primary underline) in the block's `filter` header zone;
15
+ * `ChoiceChips` or `RadioGroup` choose a form value; a button holds a command, never a selection state.
11
16
  */
12
17
  /** Each banned component with the replacement its message names. */
13
18
  export const REPLACEMENTS = {
14
19
  ButtonGroup: "separate `Button`s (one commit, the rest alternative or dismiss), or a `DropdownMenu` for the overflow",
15
20
  FilterButtonGroup: "`Tabs kind=\"filter\"` (compact underline tabs with a `count` each, under the list's search field) to narrow a list that stays in place",
16
- SegmentedControl: "`ChoiceChips` or `RadioGroup` to choose a value of a form, or `Tabs` only to switch a view",
21
+ SegmentedControl: "`ChoiceChips` or `RadioGroup` to choose a value of a form, or `Tabs appearance=\"primary\"` (a `switch` header zone) to switch a mode or period of one block",
17
22
  };
18
23
  /** The element name of a JSX opening element (`ButtonGroup`, or `Grammar.ButtonGroup` as `ButtonGroup`). */
19
24
  const elementName = (opening) => {
@@ -50,9 +55,142 @@ export const noGroupedChoiceControls = defineRule({
50
55
  };
51
56
  },
52
57
  });
58
+ /** The buttons whose pressed or selected state makes a set of them a switch. */
59
+ const BUTTON_COMPONENTS = new Set(["Button", "IconButton"]);
60
+ const SELECTION_ATTRIBUTES = new Set(["aria-pressed", "isSelected", "isActive"]);
61
+ /** Whether an opening element is a Button or IconButton carrying a selection attribute. */
62
+ const isSelectionButton = (opening) => {
63
+ const name = elementName(opening);
64
+ if (name === null || !BUTTON_COMPONENTS.has(name))
65
+ return false;
66
+ return opening.attributes.some((attribute) => attribute.type === "JSXAttribute" && attribute.name.type === "JSXIdentifier" && SELECTION_ATTRIBUTES.has(attribute.name.name));
67
+ };
68
+ /** The selection buttons a child position renders, read through conditionals, `&&` and `.map`. */
69
+ const selectionButtonsOf = (node, inMap = false) => {
70
+ if (node === null || node === undefined)
71
+ return [];
72
+ switch (node.type) {
73
+ case "JSXElement":
74
+ return isSelectionButton(node.openingElement) ? [{ opening: node.openingElement, inMap }] : [];
75
+ case "JSXFragment":
76
+ return node.children.flatMap((child) => selectionButtonsOf(child, inMap));
77
+ case "JSXExpressionContainer":
78
+ return selectionButtonsOf(node.expression, inMap);
79
+ case "ConditionalExpression":
80
+ return [...selectionButtonsOf(node.consequent, inMap), ...selectionButtonsOf(node.alternate, inMap)];
81
+ case "LogicalExpression":
82
+ return node.operator === "&&" ? selectionButtonsOf(node.right, inMap) : [...selectionButtonsOf(node.left, inMap), ...selectionButtonsOf(node.right, inMap)];
83
+ case "CallExpression": {
84
+ const callee = node.callee;
85
+ const method = callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier" ? callee.property.name : null;
86
+ const callback = node.arguments[0];
87
+ if (method !== "map" || callback === undefined || (callback.type !== "ArrowFunctionExpression" && callback.type !== "FunctionExpression"))
88
+ return [];
89
+ if (callback.body.type !== "BlockStatement")
90
+ return selectionButtonsOf(callback.body, true);
91
+ return callback.body.body.flatMap((statement) => (statement.type === "ReturnStatement" ? selectionButtonsOf(statement.argument, true) : []));
92
+ }
93
+ default:
94
+ return [];
95
+ }
96
+ };
97
+ /** No joined buttons acting as tabs: two or more Buttons carrying a selection state are a view switch. */
98
+ export const noButtonViewSwitch = defineRule({
99
+ meta: {
100
+ type: "problem",
101
+ docs: { description: "R380: no row of Buttons carrying aria-pressed, isSelected or isActive as a view switch; a switch between views or periods is Tabs in the block's filter header zone." },
102
+ schema: [],
103
+ messages: {
104
+ switch: "Buttons that carry `{{attribute}}` side by side are a view switch drawn as joined buttons or pills. Switching between views or periods of one block is `Tabs` (the primary underline) in the block's `filter` header zone; choosing a form value is `ChoiceChips` or `RadioGroup`; a `Button` holds a command, never a selection state.",
105
+ },
106
+ },
107
+ create(context) {
108
+ if (!isProductSource(context))
109
+ return {};
110
+ return {
111
+ JSXElement(element) {
112
+ const found = element.children.flatMap((child) => selectionButtonsOf(child));
113
+ if (found.length < 2 && !found.some(({ inMap }) => inMap))
114
+ return;
115
+ for (const { opening } of found) {
116
+ const attribute = opening.attributes.find((entry) => entry.type === "JSXAttribute" && entry.name.type === "JSXIdentifier" && SELECTION_ATTRIBUTES.has(entry.name.name));
117
+ const named = attribute !== undefined && attribute.type === "JSXAttribute" && attribute.name.type === "JSXIdentifier" ? attribute.name.name : "aria-pressed";
118
+ context.report({ node: opening, messageId: "switch", data: { attribute: named } });
119
+ }
120
+ },
121
+ };
122
+ },
123
+ });
124
+ /** The item keys a primary tab never carries: a count, an attention mark or a destination. */
125
+ const PRIMARY_FORBIDDEN_KEYS = new Set(["count", "href", "isAttention"]);
126
+ /** The static `items` array of a primary strip, or null when it is not an array literal. */
127
+ const itemsArrayOf = (value) => {
128
+ if (value === null || value === undefined)
129
+ return null;
130
+ const expression = value.type === "JSXExpressionContainer" ? value.expression : value;
131
+ return expression.type === "ArrayExpression" ? expression : null;
132
+ };
133
+ /** Whether an object literal has `kind: "<literal>"`. */
134
+ const hasKind = (object, literal) => object.properties.some((property) => property.type === "Property" && property.key.type === "Identifier" && property.key.name === "kind" && property.value.type === "Literal" && property.value.value === literal);
135
+ /** Primary tabs (a pill in a track) switch a mode or period: 2 to 4 short fixed options, no count, no destination. */
136
+ export const noPrimaryTabsMisuse = defineRule({
137
+ meta: {
138
+ type: "problem",
139
+ docs: { description: "R380: Tabs appearance=\"primary\" (and the switch header zone) hold two to four short, fixed options with no count, no href and no attention mark; views, filters and navigation are the secondary underline tabs." },
140
+ schema: [],
141
+ messages: {
142
+ primary: "Primary tabs (a pill in a track) switch a mode or period of the same data among two to four short, fixed options: {{problem}}. Views, filters with counts and destinations are the secondary (underline) `Tabs`.",
143
+ },
144
+ },
145
+ create(context) {
146
+ if (!isProductSource(context))
147
+ return {};
148
+ const check = (items, node) => {
149
+ if (items === null)
150
+ return;
151
+ const problems = [];
152
+ if (items.elements.length > 4)
153
+ problems.push(`${String(items.elements.length)} items`);
154
+ if (items.elements.length === 1)
155
+ problems.push("one item");
156
+ for (const element of items.elements) {
157
+ if (element === null || element.type !== "ObjectExpression")
158
+ continue;
159
+ for (const property of element.properties) {
160
+ if (property.type === "Property" && property.key.type === "Identifier" && PRIMARY_FORBIDDEN_KEYS.has(property.key.name))
161
+ problems.push(`an item with \`${property.key.name}\``);
162
+ }
163
+ }
164
+ if (problems.length > 0)
165
+ context.report({ node, messageId: "primary", data: { problem: [...new Set(problems)].join(", ") } });
166
+ };
167
+ return {
168
+ JSXOpeningElement(opening) {
169
+ if (elementName(opening) !== "Tabs")
170
+ return;
171
+ const appearance = opening.attributes.find((entry) => entry.type === "JSXAttribute" && entry.name.type === "JSXIdentifier" && entry.name.name === "appearance");
172
+ if (appearance === undefined || appearance.type !== "JSXAttribute" || appearance.value === null)
173
+ return;
174
+ const value = appearance.value.type === "JSXExpressionContainer" ? appearance.value.expression : appearance.value;
175
+ if (value.type !== "Literal" || value.value !== "primary")
176
+ return;
177
+ const items = opening.attributes.find((entry) => entry.type === "JSXAttribute" && entry.name.type === "JSXIdentifier" && entry.name.name === "items");
178
+ check(items !== undefined && items.type === "JSXAttribute" ? itemsArrayOf(items.value) : null, opening);
179
+ },
180
+ ObjectExpression(object) {
181
+ if (!hasKind(object, "switch"))
182
+ return;
183
+ const items = object.properties.find((property) => property.type === "Property" && property.key.type === "Identifier" && property.key.name === "items");
184
+ check(items === undefined ? null : itemsArrayOf(items.value), object);
185
+ },
186
+ };
187
+ },
188
+ });
53
189
  /** The rules this law contributes to the plugin. */
54
190
  export const rules = {
55
191
  "no-grouped-choice-controls": noGroupedChoiceControls,
192
+ "no-button-view-switch": noButtonViewSwitch,
193
+ "no-primary-tabs-misuse": noPrimaryTabsMisuse,
56
194
  };
57
195
  defineFamilyRules(rules, "knowledge/hfs/rules.yaml#R380");
58
196
  /** Every rule of this law is an error. */
package/dist/lib/why.js CHANGED
@@ -9,6 +9,16 @@ export const why = {
9
9
  en: "A StatusDot or Badge label in `<file>` starts with a lowercase letter.",
10
10
  fix: "Start the label with an uppercase letter (`Running`, not `running`); the rule fixes a literal label in place.",
11
11
  },
12
+ "no-primary-tabs-misuse": {
13
+ code: "FE_GROUPED_CHOICE_CONTROL",
14
+ en: "Primary `Tabs` (or a `switch` header zone) in `<file>` hold a count, an href, an attention mark, one item or more than four items.",
15
+ fix: "Primary tabs switch a mode or period of the same data among two to four short, fixed options. Views, filters with counts and destinations are the secondary (underline) `Tabs`.",
16
+ },
17
+ "no-button-view-switch": {
18
+ code: "FE_GROUPED_CHOICE_CONTROL",
19
+ en: "Buttons carrying `aria-pressed`, `isSelected` or `isActive` stand side by side in `<file>`: joined buttons or pills acting as tabs.",
20
+ fix: "Switching between views or periods of one block is `Tabs` (the primary underline) in the block's `filter` header zone of its card; choosing a form value is `ChoiceChips` or `RadioGroup`; a `Button` holds a command, never a selection state.",
21
+ },
12
22
  "no-grouped-choice-controls": {
13
23
  code: "FE_GROUPED_CHOICE_CONTROL",
14
24
  en: "A ButtonGroup, FilterButtonGroup or SegmentedControl in `<file>` draws a group of attached buttons, which the Grammar no longer has.",
@@ -107,7 +117,7 @@ export const why = {
107
117
  "no-raised-surface-in-surface": {
108
118
  code: "FE_RAISED_SURFACE_IN_SURFACE",
109
119
  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.",
110
- fix: "Give the content to the host's own body, or use a kind of the outer card (`bands`, `list`, `figures`) for what needs its own faces.",
120
+ 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.",
111
121
  },
112
122
  "no-shell-bottom-tabs": {
113
123
  code: "FE_APP_SHELL_BOTTOM_TABS",
@@ -116,8 +126,8 @@ export const why = {
116
126
  },
117
127
  "surface-card-kind": {
118
128
  code: "FE_SURFACE_CARD_KIND",
119
- en: "A `body` SurfaceCard in `<file>` holds a hand-built list, a Divider, a SectionHeader or Heading as a second title.",
120
- fix: "Rows are `kind=\"list\"`, key figures `kind=\"figures\"`, faces divided by seams `kind=\"bands\"`; the card's title is its `label`.",
129
+ en: "A `body` SurfaceCard in `<file>` holds a hand-built list, a Divider, a SectionHeader or Heading as a second title, or a `custom` zone holds a Tabs, SearchField or Divider.",
130
+ fix: "Rows are `kind=\"list\"`, key figures `kind=\"figures\"`, bands divided by seams the typed `headers` and `footers` zones (`filter`, `search`, `toolbar`, `figures`, `more`, `paging`); the card's title is its `label`.",
121
131
  },
122
132
  "status-text-uses-soft-foreground": {
123
133
  code: "FE_STYLE_TOKEN_ONLY",
@@ -1,5 +1,5 @@
1
1
  import type { Rule } from "eslint";
2
- /** A body card does not hold what a kind draws: hand rows, a divider, a second title. */
2
+ /** A body card does not hold what a kind draws: hand rows, a divider, a second title; a custom zone holds none of the typed zones' parts. */
3
3
  export declare const surfaceCardKind: Rule.RuleModule;
4
4
  /** A labelled card repeated in a card grid is a tile. */
5
5
  export declare const noLabelInGrid: Rule.RuleModule;
@@ -8,7 +8,10 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
8
8
  * R355. A card of the default `body` kind holds copy and controls. It does not hold the things a kind draws for it: a
9
9
  * hand-built list (`ul`, `ol`, `li`), a divider, a `SectionHeader` or a `Heading` standing as a second title (the card has a
10
10
  * `label`),. Rows are `kind="list"`, key figures
11
- * `kind="figures"`, faces divided by seams `kind="bands"`.
11
+ * `kind="figures"`, bands divided by seams are the typed `headers` and `footers` zones.
12
+ *
13
+ * R355 (zones). A `custom` zone of a card (`headers` or `footers`) holds no `Tabs`, `SearchField` or `Divider`: filter and search are
14
+ * the typed `filter`, `search` and `toolbar` zones, and the card draws its own seams.
12
15
  *
13
16
  * R366. A card with a `label` heads a section; a peer you recognise and open is a `kind="tile"` and names itself inside. A
14
17
  * labelled card repeated in a `Grid kind="cards"` (two or more, or one written in a `.map`) is a tile drawn with the wrong
@@ -109,7 +112,49 @@ const HAND_COMPONENTS = new Map([
109
112
  ["SectionHeader", "title"],
110
113
  ["Heading", "title"],
111
114
  ]);
112
- /** A body card does not hold what a kind draws: hand rows, a divider, a second title. */
115
+ /** The Grammar components a `custom` zone never holds: the typed zones draw them. */
116
+ const ZONE_COMPONENTS = new Set(["Tabs", "SearchField", "Divider"]);
117
+ /** Every JSX element below a node, whatever holds it (an object property, a fragment, a call). */
118
+ const jsxBelow = (node, seen = new Set()) => {
119
+ if (typeof node !== "object" || node === null || seen.has(node))
120
+ return [];
121
+ seen.add(node);
122
+ const found = [];
123
+ if ("type" in node && node.type === "JSXElement")
124
+ found.push(node);
125
+ for (const [key, value] of Object.entries(node)) {
126
+ if (key === "parent" || key === "loc" || key === "range")
127
+ continue;
128
+ if (Array.isArray(value))
129
+ for (const item of value)
130
+ found.push(...jsxBelow(item, seen));
131
+ else
132
+ found.push(...jsxBelow(value, seen));
133
+ }
134
+ return found;
135
+ };
136
+ /** The `children` of every `{ kind: "custom" }` object of a `headers` or `footers` array. */
137
+ const customZoneChildren = (opening) => {
138
+ const zones = [];
139
+ for (const name of ["headers", "footers"]) {
140
+ const value = attributeOf(opening, name)?.value;
141
+ if (value === null || value === undefined || value.type !== "JSXExpressionContainer" || value.expression.type !== "ArrayExpression")
142
+ continue;
143
+ for (const zone of value.expression.elements) {
144
+ if (zone === null || zone.type !== "ObjectExpression")
145
+ continue;
146
+ const props = zone.properties.filter((property) => property.type === "Property" && property.key.type === "Identifier");
147
+ const kind = props.find((property) => property.key.type === "Identifier" && property.key.name === "kind");
148
+ if (kind === undefined || kind.value.type !== "Literal" || kind.value.value !== "custom")
149
+ continue;
150
+ const children = props.find((property) => property.key.type === "Identifier" && property.key.name === "children");
151
+ if (children !== undefined)
152
+ zones.push(children.value);
153
+ }
154
+ }
155
+ return zones;
156
+ };
157
+ /** A body card does not hold what a kind draws: hand rows, a divider, a second title; a custom zone holds none of the typed zones' parts. */
113
158
  export const surfaceCardKind = defineRule({
114
159
  meta: {
115
160
  type: "problem",
@@ -117,8 +162,9 @@ export const surfaceCardKind = defineRule({
117
162
  schema: [],
118
163
  messages: {
119
164
  list: "`<{{element}}>` is a hand-built list in a `body` card. Rows are `<SurfaceCard kind=\"list\" items={...} empty={...} />`, and the card draws every row the same way.",
120
- divider: "A `Divider` in a card is refused: the card draws its own seams. Faces divided by a line are `<SurfaceCard kind=\"bands\" bands={[...]} />`.",
121
- title: "`<{{element}}>` stands as a second title inside a card. The card has a `label` (and `fact`, `labelEnd`, `footer`); a sub-section of one subject is a band with its own `label` in `kind=\"bands\"`.",
165
+ divider: "A `Divider` in a card is refused: the card draws its own seams. Bands divided by a line are the typed `headers` and `footers` zones: `<SurfaceCard headers={[{ kind: \"figures\", items }]} />`.",
166
+ zone: "`<{{element}}>` stands in a `custom` zone of a card. Filter and search are the typed zones (`{ kind: \"filter\" | \"search\" | \"toolbar\" }`) and the card draws its own seams, so a `custom` zone holds no `Tabs`, `SearchField` or `Divider`.",
167
+ title: "`<{{element}}>` stands as a second title inside a card. The card has a `label` (and `fact`, `labelEnd`, `note`); a sub-section of one subject is a typed header or footer zone.",
122
168
  },
123
169
  },
124
170
  create(context) {
@@ -128,6 +174,15 @@ export const surfaceCardKind = defineRule({
128
174
  JSXElement(element) {
129
175
  const opening = element.openingElement;
130
176
  const component = grammarComponent(context, opening);
177
+ if (component === "SurfaceCard" || component === "Board") {
178
+ for (const content of customZoneChildren(opening)) {
179
+ for (const node of jsxBelow(content)) {
180
+ const inner = grammarComponent(context, node.openingElement);
181
+ if (inner !== null && ZONE_COMPONENTS.has(inner))
182
+ context.report({ node: node.openingElement, messageId: "zone", data: { element: inner } });
183
+ }
184
+ }
185
+ }
131
186
  if (component === "SurfaceCard" && isBodyCard(opening)) {
132
187
  for (const { node } of childElements(element)) {
133
188
  const child = node.openingElement;
@@ -6,6 +6,37 @@ The Grammar draws no group of attached buttons. A choice among a few has one com
6
6
 
7
7
  Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
8
8
 
9
+ ## Which component switches what
10
+
11
+ - `Tabs` switches the views or periods of one block, or filters its list: the primary underline, `kind="filter"` in the block's `filter` (or `toolbar`) header zone of a `SurfaceCard`, one line under the strip.
12
+ - `ChoiceChips` or `RadioGroup` chooses a value of a form.
13
+ - A `Button` holds a command, never a selection state; a `ButtonGroup` holds commands only.
14
+ - A switch between modes or periods of one block ("This month / Last month", "Day / Week / Month", "List / Board") is `Tabs appearance="primary"` in the card's `switch` header zone.
15
+ - Two joined buttons or pills acting as tabs are banned. `SegmentedControl` is removed.
16
+
17
+ ## `starci-grammar/no-button-view-switch`
18
+
19
+ Finding code: `FE_GROUPED_CHOICE_CONTROL` (R380). Two or more adjacent `Button` or `IconButton` elements, or one written in a `.map`, that carry `aria-pressed`, `isSelected` or `isActive` are a view switch drawn as buttons and are a finding; one toggle button on its own is a command with a state and is not. Use `Tabs`.
20
+
21
+ **Invalid** (`src/components/blocks/Cash/component.tsx`)
22
+
23
+ ```tsx
24
+ <div>
25
+ <Button aria-pressed={period === "this"} onPress={() => setPeriod("this")}>This month</Button>
26
+ <Button aria-pressed={period === "last"} onPress={() => setPeriod("last")}>Last month</Button>
27
+ </div>
28
+ ```
29
+
30
+ **Valid**
31
+
32
+ ```tsx
33
+ <SurfaceCard kind="list" label="Cash" headers={[{ kind: "filter", label: "Period", items, selectedKey: period, onSelect: setPeriod }]} items={rows} empty={empty} />
34
+ ```
35
+
36
+ ## `starci-grammar/no-primary-tabs-misuse`
37
+
38
+ Finding code: `FE_GROUPED_CHOICE_CONTROL` (R380). `Tabs appearance="primary"` (HeroUI's primary variant, a pill in a track) and a card's `{ kind: "switch" }` header zone switch a mode or period of the same data among two to four short, fixed options. An `items` array literal with an item carrying `count`, `href` or `isAttention`, with one item, or with more than four items is a finding; views, filters with counts and destinations are the secondary (underline) `Tabs`. Grammar also refuses these at run time in development, and its types refuse them.
39
+
9
40
  ## `starci-grammar/no-grouped-choice-controls`
10
41
 
11
42
  A JSX element named `ButtonGroup`, `FilterButtonGroup` or `SegmentedControl` (bare or as a member) in product source is a finding; the message names the replacement for that component.
@@ -2,8 +2,8 @@
2
2
 
3
3
  Law module: `surface-card.ts`. Catalogue: R355 FE_SURFACE_CARD_KIND, R366 FE_LABEL_IN_GRID.
4
4
 
5
- `SurfaceCard` is one component whose `kind` the compiler checks: `body` (the default), `figures`, `list`, `accordion`,
6
- `bands` and `tile`. What a kind draws is not drawn by hand around it, and where the name sits follows the kind (ruling
5
+ `SurfaceCard` is one component whose `kind` the compiler checks: `body` (the default), `figures`, `list`, `accordion`
6
+ and `tile`; any kind may carry typed `headers` and `footers` zones. What a kind draws is not drawn by hand around it, and where the name sits follows the kind (ruling
7
7
  `card-label-by-kind`): a card that heads a section has a `label` outside the material, a tile names itself inside.
8
8
 
9
9
  Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline. It applies to product
@@ -15,6 +15,9 @@ Finding code: `FE_SURFACE_CARD_KIND` (R355). The direct children of a `SurfaceCa
15
15
  `kind="body"`) are not a raw `ul`, `ol`, `li` or `dl`, not a `Divider`, and not a `SectionHeader` or `Heading` standing as a
16
16
  second title. A `Section` whose only child is one `SurfaceCard` frames one subject twice. Children are read through
17
17
  `cond && <x/>`, `cond ? <x/> : <y/>` and `.map`.
18
+ On a `SurfaceCard` or a `Board`, the `children` of a `{ kind: "custom" }` zone written in a `headers` or `footers` array literal hold no
19
+ `Tabs`, `SearchField` or `Divider` (`zone`): filter and search are the typed `filter`, `search` and `toolbar` zones and the card draws
20
+ its own seams. Grammar also refuses them at run time in development.
18
21
 
19
22
  **Invalid** (`src/components/blocks/Runs/component.tsx`)
20
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/eslint-grammar-core",
3
- "version": "0.23.2",
3
+ "version": "0.24.0",
4
4
  "description": "ESLint rules for the core Grammar's component, token and composition contracts.",
5
5
  "keywords": [
6
6
  "eslint",