@starci/eslint-grammar-core 0.57.0 → 0.59.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 +3 -953
- package/README.md +4 -4
- package/dist/app-shell.js +1 -1
- package/dist/avatar-row-uses-group.js +1 -2
- package/dist/button-arrow.d.ts +2 -2
- package/dist/button-arrow.js +2 -2
- package/dist/choice-controls.d.ts +0 -18
- package/dist/choice-controls.js +7 -47
- package/dist/field-label.js +2 -2
- package/dist/gap-proximity.js +2 -2
- package/dist/index.js +0 -2
- package/dist/layout-two-axis.js +1 -1
- package/dist/lib/grammar-jsx.js +1 -1
- package/dist/lib/site-scope.d.ts +1 -2
- package/dist/lib/site-scope.js +1 -2
- package/dist/lib/why.js +5 -15
- package/dist/link-look.js +1 -1
- package/dist/no-card-lead-description.js +1 -1
- package/dist/no-nested-label.js +1 -1
- package/dist/no-raw-scroll.js +1 -1
- package/dist/no-raw-spacing-style.d.ts +1 -1
- package/dist/no-raw-spacing-style.js +1 -1
- package/dist/no-raw-type-size.d.ts +1 -1
- package/dist/no-raw-type-size.js +1 -1
- package/dist/outline-icons.js +1 -1
- package/dist/page-breadcrumbs.js +1 -1
- package/dist/page.d.ts +1 -1
- package/dist/page.js +4 -17
- package/dist/pane.js +4 -4
- package/dist/same-line-size.js +1 -1
- package/dist/section-head-action.js +2 -2
- package/dist/site-type-role.d.ts +2 -2
- package/dist/site-type-role.js +3 -3
- package/dist/surface-depth.js +1 -1
- package/dist/surface-in-surface.js +1 -1
- package/dist/table-cell-type.js +1 -1
- package/dist/tabs.d.ts +2 -2
- package/dist/tabs.js +5 -5
- package/dist/text-rules.js +1 -1
- package/docs/avatar-row-uses-group.md +1 -1
- package/docs/button-arrow.md +2 -2
- package/docs/card-is-object.md +1 -1
- package/docs/choice-controls.md +1 -13
- package/docs/field-label.md +1 -1
- package/docs/no-raw-scroll.md +2 -2
- package/docs/no-raw-type-size.md +1 -1
- package/docs/page.md +0 -52
- package/docs/pane.md +1 -1
- package/docs/section-head-action.md +1 -1
- package/docs/site-type-role.md +1 -1
- package/docs/tabs.md +1 -1
- package/package.json +3 -3
- package/runtime/knowledge/ui/presentation/grammar-laws.yaml +15 -16
- package/dist/lib/grammar-imports.d.ts +0 -16
- package/dist/lib/grammar-imports.js +0 -37
- package/dist/page-header.d.ts +0 -17
- package/dist/page-header.js +0 -36
- package/docs/page-header.md +0 -37
package/dist/site-type-role.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Rule } from "eslint";
|
|
2
2
|
/**
|
|
3
|
-
* THE SITE GROUP (
|
|
3
|
+
* THE SITE GROUP (SITE-TYPE-ROLES). The Grammar has five type roles for the public
|
|
4
4
|
* marketing site: `display.hero`, `display.section`, `display.figure`, `lead` and `title.card`. They are the site's and never the
|
|
5
|
-
* console's: a console draws with the ten roles
|
|
5
|
+
* console's: a console draws with the ten roles, so a display size there is a second, louder type scale.
|
|
6
6
|
*
|
|
7
7
|
* WHAT IT READS, in product source outside the site (`isSiteFile`: the `Site…`/`Marketing…` owners, the `(site)` route group,
|
|
8
8
|
* `modules/site…`, or the proposed `fe.site` slot):
|
package/dist/site-type-role.js
CHANGED
|
@@ -3,9 +3,9 @@ import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
|
3
3
|
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
4
4
|
import { isSiteFile } from "./lib/site-scope.js";
|
|
5
5
|
/**
|
|
6
|
-
* THE SITE GROUP (
|
|
6
|
+
* THE SITE GROUP (SITE-TYPE-ROLES). The Grammar has five type roles for the public
|
|
7
7
|
* marketing site: `display.hero`, `display.section`, `display.figure`, `lead` and `title.card`. They are the site's and never the
|
|
8
|
-
* console's: a console draws with the ten roles
|
|
8
|
+
* console's: a console draws with the ten roles, so a display size there is a second, louder type scale.
|
|
9
9
|
*
|
|
10
10
|
* WHAT IT READS, in product source outside the site (`isSiteFile`: the `Site…`/`Marketing…` owners, the `(site)` route group,
|
|
11
11
|
* `modules/site…`, or the proposed `fe.site` slot):
|
|
@@ -34,7 +34,7 @@ export const siteTypeRole = defineRule({
|
|
|
34
34
|
docs: { description: "SITE-TYPE-ROLES: display.hero, display.section, display.figure, lead and title.card are the public site's roles, never the console's." },
|
|
35
35
|
schema: [],
|
|
36
36
|
messages: {
|
|
37
|
-
role: "`{{role}}` is a role of the public marketing site (
|
|
37
|
+
role: "`{{role}}` is a role of the public marketing site (the site group), and this file is not the site. A console draws with the ten roles: title.page for a page heading, title.section for a section or card title, figure for a value, body for copy.",
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
create(context) {
|
package/dist/surface-depth.js
CHANGED
|
@@ -3,7 +3,7 @@ import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
|
3
3
|
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
4
4
|
/**
|
|
5
5
|
* The surface nesting law (HFS R340 `FE_RAISED_SURFACE_IN_SURFACE`): a surface never stands inside another surface. A
|
|
6
|
-
* `SurfaceCard` inside another `SurfaceCard` is refused (
|
|
6
|
+
* `SurfaceCard` inside another `SurfaceCard` is refused (a card inside a card is the only nesting refused; a white `Pane surface`, `Drawer`,
|
|
7
7
|
* `Dialog` or `Popover` hosts cards, drawn bordered with no shadow). The Grammar throws the same refusal in development; this is its
|
|
8
8
|
* same-file half, and R356 closes it across files.
|
|
9
9
|
*
|
|
@@ -2,7 +2,7 @@ import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
|
2
2
|
import { elementNameOf, grammarName, nameOf, renderedChildren, stringProp } from "./lib/grammar-jsx.js";
|
|
3
3
|
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
4
4
|
/**
|
|
5
|
-
* The row list law (
|
|
5
|
+
* The row list law (SURFACE-IN-SURFACE; LIST-ONE-LOOK): rows divided by lines that stand
|
|
6
6
|
* inside a surface are the Grammar list, `Section kind="list"`, the same flat rows divided by hairlines wherever it stands (a card
|
|
7
7
|
* body, a drawer, a dialog, a pane band or a rail). The bare form an app can still reach is a hand-made row list.
|
|
8
8
|
*
|
package/dist/table-cell-type.js
CHANGED
|
@@ -16,7 +16,7 @@ import { attributeOf, descendants, elementOf, grammarBindings, isListRow, keyNam
|
|
|
16
16
|
*/
|
|
17
17
|
/** The Text sizes a cell or row takes: 14 (md, sm) and 12 (xs). */
|
|
18
18
|
const CELL_SIZES = new Set(["xs", "sm", "md"]);
|
|
19
|
-
/** The type roles above the row sizes (
|
|
19
|
+
/** The type roles above the row sizes (and the site group): a figure or a title in a cell or a row is a heading drawn in a list. */
|
|
20
20
|
const HEADING_ROLES = new Set(["figure", "title.page", "title.section", "display.hero", "display.section", "display.figure", "lead", "title.card"]);
|
|
21
21
|
const HEADING_TAGS = new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
22
22
|
const isFunction = (node) => node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression" || node.type === "FunctionDeclaration";
|
package/dist/tabs.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ export declare const tabsSwitchZone: Rule.RuleModule;
|
|
|
4
4
|
/** At most two underline layers. */
|
|
5
5
|
export declare const tabsDepth: Rule.RuleModule;
|
|
6
6
|
/**
|
|
7
|
-
* The second tab layer stands in the white header band (
|
|
7
|
+
* The second tab layer stands in the white header band (TABS-IN-WELL): `Page header={{ tabs, subTabs }}`, on its own
|
|
8
8
|
* full-width separator, flush with the band's left inset. An underline `Tabs` written as a child of a `Page`, `Pane` or `PaneSection`
|
|
9
9
|
* stands on the pink well or in a pane body, so it is a finding, unless it narrows a list or a region from the header row of its own: a
|
|
10
|
-
* `Tabs kind="filter"` in a `Section`'s `filter` row
|
|
10
|
+
* `Tabs kind="filter"` in a `Section`'s `filter` row. A drawer, dialog, modal, popover or sheet starts its own surface.
|
|
11
11
|
*/
|
|
12
12
|
export declare const tabsInWell: Rule.RuleModule;
|
|
13
13
|
/** The rules this law contributes to the plugin. */
|
package/dist/tabs.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
2
2
|
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
3
3
|
/**
|
|
4
|
-
* The Tabs laws (`contexts/ui/components/tabs.md
|
|
4
|
+
* The Tabs laws (`contexts/ui/components/tabs.md`): where the pill stands, and how many
|
|
5
5
|
* underline layers a page stacks.
|
|
6
6
|
*
|
|
7
7
|
* `tabs-switch-zone`. The pill (`Tabs appearance="primary"`) is a mode or period switch of one block. It stands as the `action` of the block's
|
|
8
8
|
* `Section` (`<Section title action={<Tabs appearance="primary" label items selectedKey onSelect />} />`); a `<Tabs appearance="primary">` written in JSX
|
|
9
|
-
* anywhere else (a page body, under the page tabs, a pane, a drawer) is a finding. One more place
|
|
9
|
+
* anywhere else (a page body, under the page tabs, a pane, a drawer) is a finding. One more place: a row-level mode choice
|
|
10
10
|
* ("Tu dong | Hoi" on an agent's ability row) lives in the row's `control` slot, so a pill that is the value of a `control` (an object property named
|
|
11
11
|
* `control` in a list row literal, or a JSX attribute `control={...}`) is allowed. The item checks (two to four, no count, no href) stay in `no-primary-tabs-misuse`.
|
|
12
12
|
*
|
|
@@ -164,13 +164,13 @@ export const tabsDepth = defineRule({
|
|
|
164
164
|
});
|
|
165
165
|
/** The pink well and the panes: underline Tabs written in their children sit on the well, not in the white header band. */
|
|
166
166
|
const WELL_HOSTS = new Set(["Page", "Pane", "PaneSection"]);
|
|
167
|
-
/** Whether a JSX attribute is the `filter` row of a `Section` (a list's or a region's alike
|
|
167
|
+
/** Whether a JSX attribute is the `filter` row of a `Section` (a list's or a region's alike). */
|
|
168
168
|
const isSectionFilter = (node) => node.name.type === "JSXIdentifier" && node.name.name === "filter" && node.parent.type === "JSXOpeningElement" && elementName(node.parent) === "Section";
|
|
169
169
|
/**
|
|
170
|
-
* The second tab layer stands in the white header band (
|
|
170
|
+
* The second tab layer stands in the white header band (TABS-IN-WELL): `Page header={{ tabs, subTabs }}`, on its own
|
|
171
171
|
* full-width separator, flush with the band's left inset. An underline `Tabs` written as a child of a `Page`, `Pane` or `PaneSection`
|
|
172
172
|
* stands on the pink well or in a pane body, so it is a finding, unless it narrows a list or a region from the header row of its own: a
|
|
173
|
-
* `Tabs kind="filter"` in a `Section`'s `filter` row
|
|
173
|
+
* `Tabs kind="filter"` in a `Section`'s `filter` row. A drawer, dialog, modal, popover or sheet starts its own surface.
|
|
174
174
|
*/
|
|
175
175
|
export const tabsInWell = defineRule({
|
|
176
176
|
meta: {
|
package/dist/text-rules.js
CHANGED
|
@@ -15,7 +15,7 @@ import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
|
15
15
|
export const BLOCK_COMPONENTS = new Set([
|
|
16
16
|
"Stack", "Cluster", "Grid", "Section", "SurfaceCard", "DataTable", "Heading", "DescriptionList",
|
|
17
17
|
"Divider", "Page", "Pane", "PaneGrid", "PaneSection", "Form", "Fieldset", "Quote", "Alert", "Stepper", "Timeline", "MarkdownArticle", "EmptyNotice",
|
|
18
|
-
"ListRow", "
|
|
18
|
+
"ListRow", "Tabs",
|
|
19
19
|
]);
|
|
20
20
|
/** Plain elements that are blocks. */
|
|
21
21
|
const BLOCK_TAGS = new Set(["div", "p", "ul", "ol", "li", "section", "article", "table", "form", "h1", "h2", "h3", "h4", "h5", "h6", "pre", "blockquote"]);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Law module: `avatar-row-uses-group.ts`. Finding code: `FE_AVATAR_ROW_USES_GROUP`. Law: `contexts/grammars/contract.yaml#DNA-COMMON-AVATAR-ROW-GROUP`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Avatars that stand side by side, or come out of a list, are one `AvatarGroup`: it overlaps them, shows `max - 1` items and a "+N" tile, rings a broken account (`tone: "danger"`), names every member on hover (`memberNames`), and takes people (`name`, `seed`) and provider or channel marks (`mark`) alike. A hand-made row of `Avatar` has none of that and every app draws its own overflow.
|
|
6
6
|
|
|
7
7
|
Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
|
|
8
8
|
|
package/docs/button-arrow.md
CHANGED
|
@@ -8,14 +8,14 @@ Every rule below is an error in `coreGrammarConfig`; none can be switched off or
|
|
|
8
8
|
|
|
9
9
|
## `starci-grammar/no-typed-arrow`
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
No typed arrow characters; a direction is a Grammar icon.
|
|
12
12
|
In product source, an arrow character in rendered text is a finding (`FE_NO_TYPED_ARROW`, message `typed`) on ANY element, not only a Button:
|
|
13
13
|
|
|
14
14
|
- JSX text, a string or template literal rendered as a child, and the branches of a conditional;
|
|
15
15
|
- a string attribute that is rendered text (`label`, `title`, `aria-label`, `description`, ...); `className`, `href`, `src`, `id`, `key`, `role`, `data-*` and event handlers are not text.
|
|
16
16
|
|
|
17
17
|
The characters: the Unicode Arrows block U+2190-U+21FF (→ ← ↑ ↓ ↗ ⇒ …), the dingbat arrows U+2794-U+27BF (➔ ➜ …), the long arrows U+27F0-U+27FF (⟶),
|
|
18
|
-
and ASCII `->`. i18n message values are JSON the lint does not read; contexts/ui/content.md holds them. That gap is accepted
|
|
18
|
+
and ASCII `->`. i18n message values are JSON the lint does not read; contexts/ui/content.md holds them. That gap is accepted.
|
|
19
19
|
|
|
20
20
|
```tsx
|
|
21
21
|
<Text>Xem đơn →</Text> // refused
|
package/docs/card-is-object.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Law module: `card-is-object.ts`. Finding code: `FE_CARD_IS_OBJECT`. Knowledge: `knowledge/ui/presentation/grammar-laws.yaml#CARD-OBJECT`.
|
|
4
4
|
|
|
5
|
-
A `SurfaceCard` is ONE object: a customer, an agent, a provider, a plan, a message, an approval, a dialog or an overlay. Its body holds the object's name, its facts and a control. A collection (a list, a table, facts, figures, disclosures, a choice), a form and a placeholder stand flat: in a `Section`, or on their own.
|
|
5
|
+
A `SurfaceCard` is ONE object: a customer, an agent, a provider, a plan, a message, an approval, a dialog or an overlay. Its body holds the object's name, its facts and a control. A collection (a list, a table, facts, figures, disclosures, a choice), a form and a placeholder stand flat: in a `Section`, or on their own. This rule refuses those shapes written as the body of a card.
|
|
6
6
|
|
|
7
7
|
Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
|
|
8
8
|
|
package/docs/choice-controls.md
CHANGED
|
@@ -2,18 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Law module: `choice-controls.ts`. Catalogue: R380 FE_GROUPED_CHOICE_CONTROL.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A choice among a few has one component by meaning (owned by `contexts/ui/components/select.md` for a form value and `tabs.md` for views). The rules below hold what is still writable: buttons dressed as tabs and misused primary tabs.
|
|
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 `filter` row of the block's `Section`, one line under the strip.
|
|
12
|
-
- `ChoiceButtons` (options with the weight of a button, as tall as a Button), `ChoiceChips` (short options, as tall as a Chip) 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 `action` of the block's `Section`.
|
|
15
|
-
- Two joined buttons or pills acting as tabs are banned. `SegmentedControl` is removed.
|
|
16
|
-
|
|
17
9
|
## `starci-grammar/no-button-view-switch`
|
|
18
10
|
|
|
19
11
|
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`.
|
|
@@ -36,7 +28,3 @@ Finding code: `FE_GROUPED_CHOICE_CONTROL` (R380). Two or more adjacent `Button`
|
|
|
36
28
|
## `starci-grammar/no-primary-tabs-misuse`
|
|
37
29
|
|
|
38
30
|
Finding code: `FE_GROUPED_CHOICE_CONTROL` (R380). `Tabs appearance="primary"` (HeroUI's primary variant, a pill in a track) in a `Section action` 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
|
-
|
|
40
|
-
## `starci-grammar/no-grouped-choice-controls`
|
|
41
|
-
|
|
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.
|
package/docs/field-label.md
CHANGED
|
@@ -8,7 +8,7 @@ Every rule below is an error in `coreGrammarConfig`; none can be switched off or
|
|
|
8
8
|
|
|
9
9
|
## `starci-grammar/field-label`
|
|
10
10
|
|
|
11
|
-
A Grammar `Text` or `Label`, or a plain `label` or `span` with literal text, standing immediately before a Grammar form control (Input, Select, Textarea, NumberField, ComboBox, Autocomplete, CheckboxGroup, RadioGroup,
|
|
11
|
+
A Grammar `Text` or `Label`, or a plain `label` or `span` with literal text, standing immediately before a Grammar form control (Input, Select, Textarea, NumberField, ComboBox, Autocomplete, CheckboxGroup, RadioGroup, Switch, DatePicker, DateField, TimeField, SearchField, Slider, CopyField) among the same parent's children (looked through fragments, conditions and `.map`), when the control has no `label` prop (an `aria-label` alone does not count), is refused. A control with a spread is not judged.
|
|
12
12
|
|
|
13
13
|
**Invalid**
|
|
14
14
|
|
package/docs/no-raw-scroll.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Law module: `no-raw-scroll.ts`. Finding code: `FE_NO_RAW_SCROLL`. Knowledge: `runtime/knowledge/ui/presentation/grammar-laws.yaml#NO-RAW-SCROLL`.
|
|
4
4
|
|
|
5
|
-
Grammar never shows scrollbars
|
|
5
|
+
Grammar never shows scrollbars. Every scroll area is drawn by Grammar with HeroUI's ScrollShadow behaviour: a fading edge where content continues, the bar hidden, wheel, touch and keyboard scrolling kept. An app element that makes its own scroll area with an `overflow-y-auto` or `overflow-auto` class has no fading edge.
|
|
6
6
|
|
|
7
7
|
Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ The `className` (or `class`) of any element in product source is a finding when
|
|
|
21
21
|
**Valid**
|
|
22
22
|
|
|
23
23
|
```tsx
|
|
24
|
-
<PaneSection scroll={{ label: "Messages"
|
|
24
|
+
<PaneSection scroll={{ label: "Messages" }}>{messages}</PaneSection>
|
|
25
25
|
<VerticalScrollRegion isScrollable aria-label="Files">{rows}</VerticalScrollRegion>
|
|
26
26
|
```
|
|
27
27
|
|
package/docs/no-raw-type-size.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Law module: `no-raw-type-size.ts`. Finding code: `FE_RAW_TYPE_SIZE`. Knowledge: `runtime/knowledge/ui/presentation/grammar-laws.yaml#TYPE-ROLES`.
|
|
4
4
|
|
|
5
|
-
Type is a Grammar role
|
|
5
|
+
Type is a Grammar role. An app draws text with `<Text role="label.item">`, or puts the public class of a role (`starci-type-label-item`, dots as dashes) on an element of its own. The ten roles are figure, title.page, title.section, label.item, body, label.field, label.group, caption, badge and code ([presentation](../../../contexts/ui/presentation.md) "The type roles").
|
|
6
6
|
|
|
7
7
|
## `starci-grammar/no-raw-type-size`
|
|
8
8
|
|
package/docs/page.md
CHANGED
|
@@ -10,58 +10,6 @@ Every rule below is an error in `coreGrammarConfig`; none can be switched off or
|
|
|
10
10
|
|
|
11
11
|
A `Tabs` element that is the first element child of a `Page` is a finding, reported on the `Tabs`. Whitespace text and JSX comments are not children. A `Tabs` lower in the body, or inside a body section, is region tabs and is not judged.
|
|
12
12
|
|
|
13
|
-
**Invalid** (`src/features/pages/ConnectionPage/component.tsx`)
|
|
14
|
-
|
|
15
|
-
```tsx
|
|
16
|
-
<Page header={{ title: "Main account" }}>
|
|
17
|
-
<Tabs label="Connection" items={items} selectedKey={tab} onSelect={setTab} />
|
|
18
|
-
<WebhookCard />
|
|
19
|
-
</Page>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
**Valid**
|
|
23
|
-
|
|
24
|
-
```tsx
|
|
25
|
-
<Page header={{ title: "Main account", tabs: { label: "Connection", items, selectedKey: tab, onSelect: setTab } }}>
|
|
26
|
-
<WebhookCard />
|
|
27
|
-
</Page>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
**Finding code:** `FE_PAGE_TABS_OUTSIDE_HEADER`
|
|
31
|
-
|
|
32
|
-
## `starci-grammar/route-page-is-one-page`
|
|
33
|
-
|
|
34
|
-
A route draws exactly one `Page`. In a page owner (`fe.feature`, kind `pages`) or a layout owner (`fe.feature`, kind `layouts`) the element that draws it is a `Page`, or an element of one of the app's connected blocks (`fe.components`, kind `blocks`, imported from `@/` or a relative path) whose source draws a `Page` in its connected half or in the pure half it draws through (`./component`). The rule reads that block one level deep: a block the block relays to is not followed. This is how a server owner gets a header built from client data: it renders that block as its root and passes the page's content as the block's children.
|
|
35
|
-
|
|
36
|
-
A tabbed segment has its `Page` in its layout. A route segment `layout` file (`src/app/**/layout.tsx`) frames every route `page` below it; when it, or a layout owner it renders (through that owner, its pure half or its one root block, as above), draws a `Page` whose `header` carries `tabs` (an object literal written in place or held in a `const` of the same file), that `Page` is the one `Page` of every route under the segment. For a page owner the rule finds the route `page` files that import it, walks up from each through the `layout` files of the segments above it to the app folder, and resolves each layout's owner. A layout whose `Page` carries no `tabs` frames no segment: the pages under it draw their own.
|
|
37
|
-
|
|
38
|
-
Findings, each reported on the element:
|
|
39
|
-
|
|
40
|
-
- `sibling`: an element that draws the `Page` has an element sibling in its parent, in a page owner or a layout owner.
|
|
41
|
-
- `twice`: an element that draws a `Page` sits inside another one (a `Page` in a `Page`, or a block that draws one inside a `Page` or inside the root block), or sits in a page owner mounted by a route under a segment layout that draws the `Page`; the finding names that layout.
|
|
42
|
-
- `part`: a `PageHeader` or `PageContainer` imported from `@starci/grammar` (by name or through a namespace) in a page or layout owner: both are Page's own parts and are not exported, so this finding is the import.
|
|
43
|
-
- `missing`: a page owner file draws JSX but nothing that draws the `Page`, and draws no element imported from its own pure half, reported on its first element: the page has no frame at all.
|
|
44
|
-
|
|
45
|
-
A `Page` (or the root block) alone in a fragment or a provider, and one per branch of a conditional, are legal; the root block's children are the page body. Not judged for `missing`:
|
|
46
|
-
|
|
47
|
-
- files outside a page owner, a layout owner (a pure frame draws no `Page`), and a page owner that draws no JSX: its body only calls `redirect()` or `notFound()`, or returns null, so it draws no UI;
|
|
48
|
-
- a page owner every route of which lies under a segment layout that draws the `Page`: it draws body content only;
|
|
49
|
-
- the segment boundary owners of FE-BOUNDARY-1 (`*ErrorPage`, `*LoadingPage`, `*NotFoundPage`): an app-level boundary stands in for whichever page failed or waits and draws its notice;
|
|
50
|
-
- an auth page: every route `page` file of the app (`src/app/**/page.tsx`) that imports the owner (`@/features/pages/<Owner>`) lies under the route group `(auth)`, and that group has its own `layout`. The Grammar ships no auth frame; the app's `(auth)` layout draws it, and it is the page frame of the sign-in, sign-up, password and callback pages it holds. An owner no route mounts, one also mounted outside the group, or a group without a layout gets no exemption.
|
|
51
|
-
|
|
52
|
-
A workbench page is an ordinary page: it draws its `Page` like any other, usually through its root block.
|
|
53
|
-
|
|
54
|
-
**Invalid** (`src/features/pages/ConnectionPage/component.tsx`)
|
|
55
|
-
|
|
56
|
-
```tsx
|
|
57
|
-
import { PageHeader, PageContainer } from "@starci/grammar/core"
|
|
58
|
-
|
|
59
|
-
<>
|
|
60
|
-
<PageHeader title="Main account" />
|
|
61
|
-
<PageContainer><WebhookCard /></PageContainer>
|
|
62
|
-
</>
|
|
63
|
-
```
|
|
64
|
-
|
|
65
13
|
**Invalid** (`src/features/pages/HomePage/component.tsx`)
|
|
66
14
|
|
|
67
15
|
```tsx
|
package/docs/pane.md
CHANGED
|
@@ -44,7 +44,7 @@ finding: its cell renders blank.
|
|
|
44
44
|
|
|
45
45
|
## `starci-grammar/pane-children`
|
|
46
46
|
|
|
47
|
-
A raw element, or a Grammar component other than `PaneSection`, `PaneGrid` and `Freestyle`, placed directly in a `Pane` is a
|
|
47
|
+
A raw element, or a Grammar component other than `PaneSection`, `PaneGrid`, `ChatFrame` (the one child of a chat pane) and `Freestyle`, placed directly in a `Pane` is a
|
|
48
48
|
finding: it skips the inset the pane publishes. A project component is allowed here and judged in its own file.
|
|
49
49
|
|
|
50
50
|
**Invalid**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Law module: `section-head-action.ts`. Finding code: `FE_SECTION_HEAD_ACTION`. Knowledge: `knowledge/ui/presentation/grammar-laws.yaml#SECTION-HEAD-ACTION`.
|
|
4
4
|
|
|
5
|
-
A `Section` head is ONE row: the label (14, weight 500) and an optional count chip at the start, and at the end at most ONE thing: a navigation `Link variant="head"` (the label then an arrow that slides about 3px on hover), an info `IconButton`, or a neutral small text `Button
|
|
5
|
+
A `Section` head is ONE row: the label (14, weight 500) and an optional count chip at the start, and at the end at most ONE thing: a navigation `Link variant="head"` (the label then an arrow that slides about 3px on hover), an info `IconButton`, or a neutral small text `Button`. A `description` is not under the label: it is a caption below the body.
|
|
6
6
|
|
|
7
7
|
Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
|
|
8
8
|
|
package/docs/site-type-role.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Law module: `site-type-role.ts`. Finding code: `FE_SITE_TYPE_ROLE`. Knowledge: `runtime/knowledge/ui/presentation/grammar-laws.yaml#SITE-TYPE-ROLES`.
|
|
4
4
|
|
|
5
|
-
Grammar
|
|
5
|
+
The Grammar has a site group of five type roles for the public marketing site: `display.hero`, `display.section`, `display.figure`, `lead` and `title.card` ([presentation](../../../contexts/ui/presentation.md) "The site group"). The group is for the public site only, never the console.
|
|
6
6
|
|
|
7
7
|
## `starci-grammar/site-type-role`
|
|
8
8
|
|
package/docs/tabs.md
CHANGED
|
@@ -6,7 +6,7 @@ Underline tabs switch panels: the page tabs (`Page header.tabs`) and, inside a t
|
|
|
6
6
|
|
|
7
7
|
## `starci-grammar/tabs-switch-zone`
|
|
8
8
|
|
|
9
|
-
Finding code: `FE_TABS_SWITCH_ZONE`. A `<Tabs appearance="primary">` written in JSX is a finding wherever it stands (a page body, under the page tabs, a pane, a drawer). The pill stands as the `action` of the block's `Section` (`action={<Tabs appearance="primary" ... />}`) and
|
|
9
|
+
Finding code: `FE_TABS_SWITCH_ZONE`. A `<Tabs appearance="primary">` written in JSX is a finding wherever it stands (a page body, under the page tabs, a pane, a drawer). The pill stands as the `action` of the block's `Section` (`action={<Tabs appearance="primary" ... />}`) and as the value of a row `control` (an object property named `control` in a list row literal, or a JSX attribute `control={...}`, directly or through a fragment, conditional or `&&`): a row-level mode choice such as "Auto | Ask" lives in the row. The item checks (two to four options, no `count`, `href` or `isAttention`) stay in `no-primary-tabs-misuse` (R380).
|
|
10
10
|
|
|
11
11
|
**Invalid**
|
|
12
12
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starci/eslint-grammar-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"description": "ESLint rules for the core Grammar's component, token and composition contracts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -68,6 +68,6 @@
|
|
|
68
68
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
69
69
|
"typescript": "^6.0.3"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
72
|
-
"starciSource": "
|
|
71
|
+
"gitHead": "af3b3ca9902514ffa789eaee4290e5ce5b79ebfa",
|
|
72
|
+
"starciSource": "73cff709a285cc66731908910b61b6e4d58d91be9c4d94949487e51638461347"
|
|
73
73
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
schema: starci/knowledge-source@1
|
|
2
2
|
id: ui.presentation.grammar-laws
|
|
3
|
-
title: Grammar presentation laws
|
|
3
|
+
title: Grammar presentation laws
|
|
4
4
|
appliesTo: [ui, frontend]
|
|
5
5
|
family: presentation
|
|
6
6
|
purpose: |-
|
|
7
|
-
The spacing, surface, field, typography, link and button laws
|
|
7
|
+
The spacing, surface, field, typography, link and button laws. The core Grammar
|
|
8
8
|
owns the values; these rules say what an app composition may not do against them.
|
|
9
9
|
provenance:
|
|
10
10
|
reviewedAt: 2026-11-09
|
|
@@ -24,14 +24,14 @@ rules:
|
|
|
24
24
|
region 32). A field stack (fields 24 apart) inside a Form or a Drawer body is the Field rule's own rhythm.
|
|
25
25
|
- id: LIST-ONE-LOOK
|
|
26
26
|
title: A list is one thing, flat rows on the surface, never a card
|
|
27
|
-
governs: Every list of rows, on the page canvas, in a card body, a drawer, a dialog, a pane band or a rail
|
|
27
|
+
governs: Every list of rows, on the page canvas, in a card body, a drawer, a dialog, a pane band or a rail.
|
|
28
28
|
cases:
|
|
29
29
|
- id: case-1
|
|
30
30
|
when: Rows of peers are listed (a worklist, a collection, the facts of a record as key-value rows, the replies a message card offers)
|
|
31
31
|
assert: |-
|
|
32
32
|
They are `Section kind="list"` of `ListRow`s: plain rows on the surface, divided by hairlines, the rows aligned with the section
|
|
33
33
|
title, with no frame, fill, radius or shadow, by default and with no theme hook. A list is never a card: `SurfaceCard` has no
|
|
34
|
-
`list` kind
|
|
34
|
+
`list` kind and `SurfaceCard kind="list"` is refused. Cards stay for real objects.
|
|
35
35
|
- id: SURFACE-IN-SURFACE
|
|
36
36
|
title: A list of rows inside a surface is the Grammar list
|
|
37
37
|
governs: Row lists placed inside a card body, a drawer, a dialog or a pane band.
|
|
@@ -76,8 +76,7 @@ rules:
|
|
|
76
76
|
- id: case-3
|
|
77
77
|
when: Any rendered text (JSX text, a literal child, a text attribute) would show a direction
|
|
78
78
|
assert: |-
|
|
79
|
-
No typed arrow character (U+2190-U+21FF, U+2794-U+27BF, U+27F0-U+27FF, `->`) appears in it
|
|
80
|
-
mũi tên gõ tay; hướng đi là icon của Grammar"). Direction is `Button endArrow`, `Link`'s own arrow or the Grammar arrow or chevron
|
|
79
|
+
No typed arrow character (U+2190-U+21FF, U+2794-U+27BF, U+27F0-U+27FF, `->`) appears in it. Direction is `Button endArrow`, `Link`'s own arrow or the Grammar arrow or chevron
|
|
81
80
|
icon (lint `no-typed-arrow`).
|
|
82
81
|
- id: LAYOUT-TWO-AXIS
|
|
83
82
|
title: A report page stacks its cards in one direction
|
|
@@ -100,8 +99,8 @@ rules:
|
|
|
100
99
|
- id: case-1
|
|
101
100
|
when: A chat thread with messages is drawn (team chat, an agent's chat, an inbox thread, the assistant)
|
|
102
101
|
assert: |-
|
|
103
|
-
The thread is
|
|
104
|
-
(`MessageBubble` incoming, `MessageCard`) is one
|
|
102
|
+
The thread is the `ChatFrame` thread on the page tone `--background`; a message of someone else
|
|
103
|
+
(`MessageBubble` incoming, `MessageCard`) is one flat look, `--surface` with no border and no shadow; the reader's own
|
|
105
104
|
message is `--accent` with `--accent-foreground`. No class or style reaches a bubble, a card or the thread ground.
|
|
106
105
|
- id: case-2
|
|
107
106
|
when: A message card offers replies to send
|
|
@@ -122,7 +121,7 @@ rules:
|
|
|
122
121
|
when: A suggestion, quick reply or empty-state shortcut is drawn
|
|
123
122
|
assert: |-
|
|
124
123
|
It is a `Cluster gap="inline"` (with `label`) of neutral `Button size="sm"`, which every Button size draws as a
|
|
125
|
-
pill; a Link row,
|
|
124
|
+
pill; a Link row, TagGroup, Badge or Chip is never a suggestion.
|
|
126
125
|
- id: TABLE-CELL-TYPE
|
|
127
126
|
title: Table and row cells take the row type sizes
|
|
128
127
|
governs: Text inside a DataTable cell or a ListRow.
|
|
@@ -215,12 +214,12 @@ rules:
|
|
|
215
214
|
never a second `title` / `label`; groups stand 24px apart. A Section or SurfaceCard with `sublabel` and a Label together is refused by the types.
|
|
216
215
|
- id: AVATAR-ROW-GROUP
|
|
217
216
|
title: Avatars in a row or from a list are one AvatarGroup
|
|
218
|
-
governs: Grammar `Avatar` elements that stand side by side or are returned from a `.map()` (contract DNA-COMMON-AVATAR-ROW-GROUP
|
|
217
|
+
governs: Grammar `Avatar` elements that stand side by side or are returned from a `.map()` (contract DNA-COMMON-AVATAR-ROW-GROUP).
|
|
219
218
|
cases:
|
|
220
219
|
- id: case-1
|
|
221
220
|
when: Two or more `Avatar` elements are siblings, or an `Avatar` is returned from a `.map()`, with no `AvatarGroup` around them
|
|
222
221
|
assert: |-
|
|
223
|
-
They are refused.
|
|
222
|
+
They are refused.
|
|
224
223
|
A row of people, providers or channels is `<AvatarGroup items max>`: it overlaps the items, shows `max - 1` and a "+N" tile, rings a broken account
|
|
225
224
|
(`tone: "danger"`) and lists every name on hover (`memberNames`); a person is `name` and `seed`, a provider or channel is a `mark`.
|
|
226
225
|
- id: SECTION-HEAD-ACTION
|
|
@@ -231,7 +230,7 @@ rules:
|
|
|
231
230
|
when: A Section head carries an action
|
|
232
231
|
assert: |-
|
|
233
232
|
The head is ONE row: the label (14, 500) and an optional count chip (12) at the start, at most ONE thing at the end, a navigation
|
|
234
|
-
Link variant="head" (the label then an arrow that slides about 3px on hover), an info IconButton, or
|
|
233
|
+
Link variant="head" (the label then an arrow that slides about 3px on hover), an info IconButton, or a neutral small text Button
|
|
235
234
|
(border, size sm, no icon: "Add provider"). A primary or commit Button, another size or an icon Button is refused, and so are two commands. There is no description under the label: it is a caption (12, muted) below the card or list.
|
|
236
235
|
- id: TAB-COUNT-CHIP
|
|
237
236
|
title: A tab count is a 12px chip, grey unless it is work waiting for the owner
|
|
@@ -283,7 +282,7 @@ rules:
|
|
|
283
282
|
(the sign-in form with no page around it) and a `kind="tile"` card are not judged.
|
|
284
283
|
- id: DATA-TABLE-SURFACE
|
|
285
284
|
title: A table has one flat look
|
|
286
|
-
governs: The `surface` prop of a DataTable
|
|
285
|
+
governs: The `surface` prop of a DataTable.
|
|
287
286
|
cases:
|
|
288
287
|
- id: case-1
|
|
289
288
|
when: A DataTable is written with a `surface` attribute
|
|
@@ -296,7 +295,7 @@ rules:
|
|
|
296
295
|
- id: case-1
|
|
297
296
|
when: An app sets the size of text it draws
|
|
298
297
|
assert: |-
|
|
299
|
-
The size is a type role
|
|
298
|
+
The size is a type role: `<Text role>` or the public class `starci-type-<role>` (figure, title.page,
|
|
300
299
|
title.section, label.item, body, label.field, label.group, caption, badge, code; dots as dashes in the class). A Tailwind
|
|
301
300
|
text-size utility, a `fontSize` or a CSS `font-size` in app source is reported (`starci-grammar/no-raw-type-size`, a
|
|
302
301
|
counting rule at warn until both apps migrate, then blocking).
|
|
@@ -307,7 +306,7 @@ rules:
|
|
|
307
306
|
- id: case-1
|
|
308
307
|
when: A file draws display.hero, display.section, display.figure, lead or title.card
|
|
309
308
|
assert: |-
|
|
310
|
-
The file is the public marketing site
|
|
309
|
+
The file is the public marketing site: a `Site…` or `Marketing…` owner of fe.components or
|
|
311
310
|
fe.feature, a route under the `(site)` or `(marketing)` group, a `site…` capability of fe.modules, or the proposed fe.site slot.
|
|
312
311
|
In any other file `<Text role>` or the class `starci-type-<role>` of the group is refused (`starci-grammar/site-type-role`).
|
|
313
312
|
- id: NO-RAW-SCROLL
|
|
@@ -327,7 +326,7 @@ rules:
|
|
|
327
326
|
- id: case-1
|
|
328
327
|
when: An app separates two things it places, or pads content inside a box
|
|
329
328
|
assert: |-
|
|
330
|
-
The distance is a role the Grammar resolves (
|
|
329
|
+
The distance is a role the Grammar resolves (contexts/ui/scale.md "The spacing roles"): identity 4, inline 8,
|
|
331
330
|
row 12, section 24 and region 32 on a Stack, Cluster or Grid `gap`, and the inset of the Grammar box that holds the content.
|
|
332
331
|
A spacing utility in a class string is `starci-fe/no-spacing-utility` (R350); a gap, padding or margin key in a JSX `style`
|
|
333
332
|
is reported (`starci-grammar/no-raw-spacing-style`, a counting rule at warn until both apps migrate, then blocking).
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { TSESTree } from "@typescript-eslint/types";
|
|
2
|
-
/** Where a name was reached: a named import specifier, or a member of a Grammar namespace import. */
|
|
3
|
-
export interface RemovedImport {
|
|
4
|
-
readonly node: TSESTree.Node;
|
|
5
|
-
readonly name: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* The visitor of a law that reduces to imports: a Grammar export that no longer exists is refused where it is imported
|
|
9
|
-
* (`import { Name }`) or reached through a namespace (`G.Name`, in an expression or a JSX tag). The law needs no
|
|
10
|
-
* structural reading, because the export is the whole of the thing it forbids.
|
|
11
|
-
*/
|
|
12
|
-
export declare const refuseGrammarExports: (names: ReadonlySet<string>, refuse: (found: RemovedImport) => void) => {
|
|
13
|
-
ImportDeclaration(declaration: TSESTree.ImportDeclaration): void;
|
|
14
|
-
MemberExpression(node: TSESTree.MemberExpression): void;
|
|
15
|
-
JSXMemberExpression(node: TSESTree.JSXMemberExpression): void;
|
|
16
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/** A module that is the Grammar package or one of its entries (`@starci/grammar`, `@starci/grammar/core`, `/common`, `/offset-pop`). */
|
|
2
|
-
const GRAMMAR_SOURCE = /^@starci\/grammar(?:\/|$)/;
|
|
3
|
-
/**
|
|
4
|
-
* The visitor of a law that reduces to imports: a Grammar export that no longer exists is refused where it is imported
|
|
5
|
-
* (`import { Name }`) or reached through a namespace (`G.Name`, in an expression or a JSX tag). The law needs no
|
|
6
|
-
* structural reading, because the export is the whole of the thing it forbids.
|
|
7
|
-
*/
|
|
8
|
-
export const refuseGrammarExports = (names, refuse) => {
|
|
9
|
-
const namespaces = new Set();
|
|
10
|
-
const member = (object, property, node) => {
|
|
11
|
-
const owner = object.type === "Identifier" || object.type === "JSXIdentifier" ? object.name : null;
|
|
12
|
-
const name = property.type === "Identifier" || property.type === "JSXIdentifier" ? property.name : null;
|
|
13
|
-
if (owner !== null && name !== null && namespaces.has(owner) && names.has(name))
|
|
14
|
-
refuse({ node, name });
|
|
15
|
-
};
|
|
16
|
-
return {
|
|
17
|
-
ImportDeclaration(declaration) {
|
|
18
|
-
if (!GRAMMAR_SOURCE.test(String(declaration.source.value)))
|
|
19
|
-
return;
|
|
20
|
-
for (const specifier of declaration.specifiers) {
|
|
21
|
-
if (specifier.type === "ImportNamespaceSpecifier")
|
|
22
|
-
namespaces.add(specifier.local.name);
|
|
23
|
-
else if (specifier.type === "ImportSpecifier") {
|
|
24
|
-
const imported = specifier.imported.type === "Identifier" ? specifier.imported.name : String(specifier.imported.value);
|
|
25
|
-
if (names.has(imported))
|
|
26
|
-
refuse({ node: specifier, name: imported });
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
MemberExpression(node) { member(node.object, node.property, node); },
|
|
31
|
-
JSXMemberExpression(node) {
|
|
32
|
-
if (node.parent.type === "JSXClosingElement")
|
|
33
|
-
return;
|
|
34
|
-
member(node.object, node.property, node);
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
};
|
package/dist/page-header.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Rule } from "eslint";
|
|
2
|
-
/**
|
|
3
|
-
* The rule that holds the page header law (HFS R323, `FE_PAGE_HEADER_HAND_ROLLED`): a page is headed by Grammar's `Page`,
|
|
4
|
-
* whose `header` is the band. `PageHeader` and `Breadcrumbs` are Page's own parts and are not exported; a page head
|
|
5
|
-
* composed from them by hand has no band, no top inset and no separator, and every page re-decides its spacing.
|
|
6
|
-
*
|
|
7
|
-
* WHAT IT READS. The imports of a file: a `PageHeader` or `Breadcrumbs` imported from `@starci/grammar` (by name, or
|
|
8
|
-
* as a member of a namespace import) is the finding. The law is the export that is gone, so it reads nothing else.
|
|
9
|
-
*/
|
|
10
|
-
/** The Grammar exports that are Page's parts and no longer public. */
|
|
11
|
-
export declare const PAGE_HEAD_PARTS: ReadonlySet<string>;
|
|
12
|
-
/** A page head is Page `header`, never `PageHeader` or `Breadcrumbs` reached for by hand. */
|
|
13
|
-
export declare const noHandRolledPageHeader: Rule.RuleModule;
|
|
14
|
-
/** The rules this law contributes to the plugin. */
|
|
15
|
-
export declare const rules: Record<string, Rule.RuleModule>;
|
|
16
|
-
/** Every rule of this law is an error. */
|
|
17
|
-
export declare const recommended: Record<string, "error">;
|
package/dist/page-header.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
2
|
-
import { refuseGrammarExports } from "./lib/grammar-imports.js";
|
|
3
|
-
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
4
|
-
/**
|
|
5
|
-
* The rule that holds the page header law (HFS R323, `FE_PAGE_HEADER_HAND_ROLLED`): a page is headed by Grammar's `Page`,
|
|
6
|
-
* whose `header` is the band. `PageHeader` and `Breadcrumbs` are Page's own parts and are not exported; a page head
|
|
7
|
-
* composed from them by hand has no band, no top inset and no separator, and every page re-decides its spacing.
|
|
8
|
-
*
|
|
9
|
-
* WHAT IT READS. The imports of a file: a `PageHeader` or `Breadcrumbs` imported from `@starci/grammar` (by name, or
|
|
10
|
-
* as a member of a namespace import) is the finding. The law is the export that is gone, so it reads nothing else.
|
|
11
|
-
*/
|
|
12
|
-
/** The Grammar exports that are Page's parts and no longer public. */
|
|
13
|
-
export const PAGE_HEAD_PARTS = new Set(["PageHeader", "Breadcrumbs"]);
|
|
14
|
-
/** A page head is Page `header`, never `PageHeader` or `Breadcrumbs` reached for by hand. */
|
|
15
|
-
export const noHandRolledPageHeader = defineRule({
|
|
16
|
-
meta: {
|
|
17
|
-
type: "problem",
|
|
18
|
-
docs: { description: "R323: a page head is Page header (title, breadcrumbs, slots), never PageHeader or Breadcrumbs imported by hand." },
|
|
19
|
-
schema: [],
|
|
20
|
-
messages: {
|
|
21
|
-
handRolled: "`{{name}}` is a part of `Page`, not an export to compose: a head built from it has no band, no top inset and no separator, and each page re-decides its spacing. Pass the head as `header` of `Page`: `{ breadcrumbs, title, description, meta, status, mark, actions, tabs }`.",
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
create(context) {
|
|
25
|
-
if (!isProductSource(context))
|
|
26
|
-
return {};
|
|
27
|
-
return refuseGrammarExports(PAGE_HEAD_PARTS, ({ node, name }) => { context.report({ node, messageId: "handRolled", data: { name } }); });
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
/** The rules this law contributes to the plugin. */
|
|
31
|
-
export const rules = {
|
|
32
|
-
"no-hand-rolled-page-header": noHandRolledPageHeader,
|
|
33
|
-
};
|
|
34
|
-
defineFamilyRules(rules, "knowledge/hfs/rules.yaml#R323");
|
|
35
|
-
/** Every rule of this law is an error. */
|
|
36
|
-
export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, "error"]));
|