@starci/eslint-grammar-core 0.15.2 → 0.15.3
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 +5 -0
- package/README.md +1 -1
- package/dist/index.js +2 -0
- package/dist/lib/why.js +5 -0
- package/dist/page-header.d.ts +10 -0
- package/dist/page-header.js +66 -0
- package/docs/page-header.md +34 -0
- package/package.json +2 -2
- package/runtime/knowledge/hfs/canon-pins.yaml +6 -6
- package/runtime/knowledge/hfs/rules.yaml +23 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.15.3 - 2026-10-28
|
|
4
|
+
|
|
5
|
+
- Added: `starci-grammar/no-hand-rolled-page-header` (R323, `FE_PAGE_HEADER_HAND_ROLLED`): a `Breadcrumbs` followed by a `SectionHeader` among one parent's element children is a page head composed by hand; compose Grammar 0.15.3's `PageHeader`. Spec: `src/page-header.spec.ts`; docs: `docs/page-header.md`.
|
|
6
|
+
- Changed: versioned together with Grammar 0.15.3; `@starci/eslint-canon-fe` 9.4.3 is the peer dependency; the bundled rule catalog carries R323, and the bundled canon pins follow release F (Grammar family 0.15.3, hfs 4.9.4, canon-fe 9.4.3, canon-be 3.6.3, ai-router 0.3.0).
|
|
7
|
+
|
|
3
8
|
## 0.15.2 - 2026-10-28
|
|
4
9
|
|
|
5
10
|
- Changed: versioned together with Grammar 0.15.2; `@starci/eslint-canon-fe` 9.4.2 is the peer dependency, and the bundled canon pins follow release E (Grammar family 0.15.2, hfs 4.9.3, canon-fe 9.4.2, canon-be 3.6.2, ai-router 0.3.0) and pin no `starci-harness`. No rule changed.
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ 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, heading and token scales, vendor ownership and slot-status composition. Each rule's metadata cites
|
|
22
|
+
chip labels that start uppercase, the page head composed by `PageHeader`, heading and token scales, vendor ownership and slot-status composition. 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
|
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { rules as drawingRules } from "./drawing.js";
|
|
|
6
6
|
import { rules as grammarBoundaryRules } from "./grammar-boundary.js";
|
|
7
7
|
import { rules as iconRules } from "./icon.js";
|
|
8
8
|
import { rules as menuEntriesRules } from "./menu-entries.js";
|
|
9
|
+
import { rules as pageHeaderRules } from "./page-header.js";
|
|
9
10
|
import { rules as statusColorsRules } from "./status-colors.js";
|
|
10
11
|
import { rules as tokensRules } from "./tokens.js";
|
|
11
12
|
import { rules as typographyRules } from "./typography.js";
|
|
@@ -18,6 +19,7 @@ const CONTRIBUTIONS = [
|
|
|
18
19
|
{ law: "grammar-boundary", rules: grammarBoundaryRules },
|
|
19
20
|
{ law: "icon", rules: iconRules },
|
|
20
21
|
{ law: "menu-entries", rules: menuEntriesRules },
|
|
22
|
+
{ law: "page-header", rules: pageHeaderRules },
|
|
21
23
|
{ law: "status-colors", rules: statusColorsRules },
|
|
22
24
|
{ law: "tokens", rules: tokensRules },
|
|
23
25
|
{ law: "typography", rules: typographyRules },
|
package/dist/lib/why.js
CHANGED
|
@@ -29,6 +29,11 @@ export const why = {
|
|
|
29
29
|
en: "Raw `<tag>` in `<file>`. Page structure and text are composed from grammar components, not hand-written HTML.",
|
|
30
30
|
fix: "Replace it with the matching grammar component (`Heading`, `Text`, `SurfaceCard`, ...); if grammar lacks it, add it to grammar or the ui package instead of drawing it in place.",
|
|
31
31
|
},
|
|
32
|
+
"no-hand-rolled-page-header": {
|
|
33
|
+
code: "FE_PAGE_HEADER_HAND_ROLLED",
|
|
34
|
+
en: "A page head in `<file>` is a Breadcrumbs trail and a SectionHeader composed by hand.",
|
|
35
|
+
fix: "Compose Grammar PageHeader with breadcrumbs, title and the slots the head needs (description, meta, status, mark, actions, tabs).",
|
|
36
|
+
},
|
|
32
37
|
"no-shell-bottom-tabs": {
|
|
33
38
|
code: "FE_APP_SHELL_BOTTOM_TABS",
|
|
34
39
|
en: "Bottom tab navigation replaces the required mobile sidebar drawer.",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Rule } from "eslint";
|
|
2
|
+
import type { TSESTree } from "@typescript-eslint/types";
|
|
3
|
+
/** The `SectionHeader` that follows a `Breadcrumbs` among the element children, or null. */
|
|
4
|
+
export declare const handRolledHead: (children: readonly TSESTree.JSXChild[]) => TSESTree.JSXElement | null;
|
|
5
|
+
/** A page head is Grammar's `PageHeader`, never a `Breadcrumbs` and a `SectionHeader` composed by hand. */
|
|
6
|
+
export declare const noHandRolledPageHeader: Rule.RuleModule;
|
|
7
|
+
/** The rules this law contributes to the plugin. */
|
|
8
|
+
export declare const rules: Record<string, Rule.RuleModule>;
|
|
9
|
+
/** Every rule of this law is an error. */
|
|
10
|
+
export declare const recommended: Record<string, "error">;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
2
|
+
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
3
|
+
/**
|
|
4
|
+
* The rule that holds the page header law (HFS R323, `FE_PAGE_HEADER_HAND_ROLLED`): a page is headed by Grammar's
|
|
5
|
+
* `PageHeader`. A page head composed by hand from a `Breadcrumbs` trail and a `SectionHeader` has no band, no top
|
|
6
|
+
* inset and no separator, and every page re-decides its spacing, so the heads of an app drift apart.
|
|
7
|
+
*
|
|
8
|
+
* WHAT IT READS. The children of one JSX element or fragment. A `Breadcrumbs` element followed, among the same parent's
|
|
9
|
+
* element children, by a `SectionHeader` element is the hand-rolled head: the trail and the heading of one page, which
|
|
10
|
+
* is exactly what `PageHeader` composes. A `Breadcrumbs` and a `SectionHeader` in different parents, a `SectionHeader`
|
|
11
|
+
* before the trail, or either alone are not judged: a region's `SectionHeader` under the page head stays legal.
|
|
12
|
+
*/
|
|
13
|
+
/** The element name of a JSX opening element (`SectionHeader`, or `Grammar.SectionHeader` as `SectionHeader`). */
|
|
14
|
+
const elementName = (child) => {
|
|
15
|
+
if (child.type !== "JSXElement")
|
|
16
|
+
return null;
|
|
17
|
+
const name = child.openingElement.name;
|
|
18
|
+
if (name.type === "JSXIdentifier")
|
|
19
|
+
return name.name;
|
|
20
|
+
if (name.type === "JSXMemberExpression")
|
|
21
|
+
return name.property.name;
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
/** The `SectionHeader` that follows a `Breadcrumbs` among the element children, or null. */
|
|
25
|
+
export const handRolledHead = (children) => {
|
|
26
|
+
let trail = false;
|
|
27
|
+
for (const child of children) {
|
|
28
|
+
const name = elementName(child);
|
|
29
|
+
if (name === "Breadcrumbs")
|
|
30
|
+
trail = true;
|
|
31
|
+
if (name === "SectionHeader" && trail && child.type === "JSXElement")
|
|
32
|
+
return child;
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
};
|
|
36
|
+
/** A page head is Grammar's `PageHeader`, never a `Breadcrumbs` and a `SectionHeader` composed by hand. */
|
|
37
|
+
export const noHandRolledPageHeader = defineRule({
|
|
38
|
+
meta: {
|
|
39
|
+
type: "problem",
|
|
40
|
+
docs: { description: "R323: a page head is Grammar's PageHeader, never Breadcrumbs and SectionHeader composed by hand." },
|
|
41
|
+
schema: [],
|
|
42
|
+
messages: {
|
|
43
|
+
handRolled: "A `Breadcrumbs` trail followed by a `SectionHeader` is a page head composed by hand: it has no band, no top inset and no separator, and each page re-decides its spacing. Use Grammar's `PageHeader` with `breadcrumbs`, `title` and the slots the head needs (`description`, `meta`, `status`, `mark`, `actions`, `tabs`).",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
create(context) {
|
|
47
|
+
if (!isProductSource(context))
|
|
48
|
+
return {};
|
|
49
|
+
const judge = (children) => {
|
|
50
|
+
const header = handRolledHead(children);
|
|
51
|
+
if (header !== null)
|
|
52
|
+
context.report({ node: header, messageId: "handRolled" });
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
JSXElement(element) { judge(element.children); },
|
|
56
|
+
JSXFragment(fragment) { judge(fragment.children); },
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
/** The rules this law contributes to the plugin. */
|
|
61
|
+
export const rules = {
|
|
62
|
+
"no-hand-rolled-page-header": noHandRolledPageHeader,
|
|
63
|
+
};
|
|
64
|
+
defineFamilyRules(rules, "knowledge/hfs/rules.yaml#R323");
|
|
65
|
+
/** Every rule of this law is an error. */
|
|
66
|
+
export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, "error"]));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Page heads are PageHeader
|
|
2
|
+
|
|
3
|
+
Law module: `page-header.ts`. Catalogue: R323 FE_PAGE_HEADER_HAND_ROLLED.
|
|
4
|
+
|
|
5
|
+
A page is headed by Grammar's `PageHeader`: the trail, the page heading with its mark, status and summary, the page's commands and the page tabs, on a surface band whose content shares the page content's edges and which ends in its own full-width separator. A head composed by hand from `Breadcrumbs` and `SectionHeader` has no band, no top inset and no separator, and every page re-decides its spacing.
|
|
6
|
+
|
|
7
|
+
Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
|
|
8
|
+
|
|
9
|
+
## `starci-grammar/no-hand-rolled-page-header`
|
|
10
|
+
|
|
11
|
+
Among the element children of one JSX element or fragment, a `Breadcrumbs` element followed by a `SectionHeader` element is a finding, reported on the `SectionHeader`. A trail and a heading in different parents, a heading before the trail, and either alone are not judged, so a region's `SectionHeader` under the page head stays legal.
|
|
12
|
+
|
|
13
|
+
**Invalid** (`src/components/blocks/ConnectionPage/component.tsx`)
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<div>
|
|
17
|
+
<Breadcrumbs label="Breadcrumb" items={trail} />
|
|
18
|
+
<SectionHeader title="Main account" level={1} action={<Button intent="neutral">Disconnect</Button>} />
|
|
19
|
+
</div>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Valid** (`src/components/blocks/ConnectionPage/component.tsx`)
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
<PageHeader
|
|
26
|
+
breadcrumbs={{ label: "Breadcrumb", items: trail }}
|
|
27
|
+
title="Main account"
|
|
28
|
+
actions={<Button intent="neutral">Disconnect</Button>}
|
|
29
|
+
/>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Finding code:** `FE_PAGE_HEADER_HAND_ROLLED`
|
|
33
|
+
|
|
34
|
+
Rule ownership: [FE-RULE-OWNERSHIP](../../../contexts/code/fe/README.md#the-placement-test-fe-rule-ownership).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starci/eslint-grammar-core",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"description": "ESLint rules for the core Grammar's component, token and composition contracts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"node": ">=22"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@starci/eslint-canon-fe": "9.4.
|
|
44
|
+
"@starci/eslint-canon-fe": "9.4.3",
|
|
45
45
|
"eslint": ">=9",
|
|
46
46
|
"typescript": ">=5.9"
|
|
47
47
|
},
|
|
@@ -31,35 +31,35 @@ pins:
|
|
|
31
31
|
source: packages/event-stream/package.json
|
|
32
32
|
why: 'the one server-sent-events client of every front end (fe-stack event-stream, owner:event-stream-package): the transport client layer (modules/api/sse/clients) creates one instance for the app with the bearer token source and the stream operations follow on it; it carries Last-Event-ID resume, the capped doubling backoff, the heartbeat timeout, the single 401 renewal and the useSWRSubscription adapter, so no app keeps a hand-written reader.'
|
|
33
33
|
'@starci/grammar':
|
|
34
|
-
version: 0.15.
|
|
34
|
+
version: 0.15.3
|
|
35
35
|
group: starci
|
|
36
36
|
install: registry
|
|
37
37
|
side: fe
|
|
38
38
|
source: packages/grammar/package.json
|
|
39
39
|
why: 'the grammar front ends read: the brand layer sets `--font-sans` and `--font-mono` and the grammar reads them; it carries the Input tel kind, the copyable and read-only Input, the IconButton disclosure props and count badge, ChatBubble, FillViewport, Textarea mentions and Enter-to-send, the leading PrimaryRailLayout rail, the plate-less Image, ListRow, the soft Alert, Progress steps, the floating primary IconButton, FlowGraph, the STATE-8 loading views and the bordered selectable TagGroup chips. The runtime source version wins for a @starci package.'
|
|
40
40
|
'@starci/eslint-canon-be':
|
|
41
|
-
version: 3.6.
|
|
41
|
+
version: 3.6.3
|
|
42
42
|
group: starci
|
|
43
43
|
install: registry
|
|
44
44
|
side: be
|
|
45
45
|
source: packages/eslint-canon-be/package.json
|
|
46
46
|
why: 'the back-end ESLint canon: `loadHfs(import.meta.url)` of be/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the be side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; `starciBeConfig({ hfs: loadHfs(import.meta.url) })` is the typed factory and the BE-CONVENTION laws are its rules.'
|
|
47
47
|
'@starci/eslint-canon-fe':
|
|
48
|
-
version: 9.4.
|
|
48
|
+
version: 9.4.3
|
|
49
49
|
group: starci
|
|
50
50
|
install: registry
|
|
51
51
|
side: fe
|
|
52
52
|
source: packages/eslint-canon-fe/package.json
|
|
53
53
|
why: 'the front-end ESLint canon: `loadHfs(import.meta.url)` of fe/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the fe side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; the front end has no tests (FE_NO_TESTS R97 in hfs) and no-vietnamese-in-source (R91) applies.'
|
|
54
54
|
'@starci/eslint-grammar-core':
|
|
55
|
-
version: 0.15.
|
|
55
|
+
version: 0.15.3
|
|
56
56
|
group: starci
|
|
57
57
|
install: registry
|
|
58
58
|
side: fe
|
|
59
59
|
source: packages/eslint-grammar-core/package.json
|
|
60
60
|
why: 'the StarCi Grammar component API lint, versioned with @starci/grammar; front ends compose this family package with the universal FE canon.'
|
|
61
61
|
'@starci/eslint-grammar-offset-pop':
|
|
62
|
-
version: 0.15.
|
|
62
|
+
version: 0.15.3
|
|
63
63
|
group: starci
|
|
64
64
|
install: registry
|
|
65
65
|
side: fe
|
|
@@ -106,7 +106,7 @@ pins:
|
|
|
106
106
|
source: packages/ai-router/package.json
|
|
107
107
|
why: 'the AI pool router of a back end: a NestJS module that routes OpenAI-compatible chat, stream and embeddings calls across keys, models and providers, with @starci/ai-router/testing for its specs; @starci/jest-preset compiles it as an ESM-only dependency.'
|
|
108
108
|
'@starci/hfs':
|
|
109
|
-
version: 4.9.
|
|
109
|
+
version: 4.9.4
|
|
110
110
|
group: starci
|
|
111
111
|
install: registry
|
|
112
112
|
side: both
|
|
@@ -5687,3 +5687,26 @@ rules:
|
|
|
5687
5687
|
source: owner
|
|
5688
5688
|
quote: "A chip label starts uppercase."
|
|
5689
5689
|
ruling: "The label of a status chip starts with an uppercase letter (owner ruling chip-label-uppercase); StatusDot capitalises a text label it renders, and the lint refuses a lowercase literal label at its source."
|
|
5690
|
+
- id: R323
|
|
5691
|
+
code: "FE_PAGE_HEADER_HAND_ROLLED"
|
|
5692
|
+
law: "A page is headed by Grammar's PageHeader; a Breadcrumbs trail followed by a SectionHeader in one parent is a page head composed by hand, with no band, no top inset and no separator."
|
|
5693
|
+
kinds: [lint]
|
|
5694
|
+
gates: [pre-commit, settle, land, ci]
|
|
5695
|
+
failureCodes: ["FE_PAGE_HEADER_HAND_ROLLED"]
|
|
5696
|
+
enforcers:
|
|
5697
|
+
- {kind: eslint-grammar-core, id: no-hand-rolled-page-header}
|
|
5698
|
+
editions: [lite, full]
|
|
5699
|
+
docs: [knowledge/patterns/fe/index.yaml#FE-RULE-OWNERSHIP]
|
|
5700
|
+
templateNa: "A template states no page head; the pages are the app's."
|
|
5701
|
+
proves:
|
|
5702
|
+
- packages/eslint-grammar-core/src/page-header.spec.ts
|
|
5703
|
+
exemplifiedBy:
|
|
5704
|
+
- {path: packages/eslint-grammar-core/src/page-header.spec.ts, editions: [lite, full], codes: [FE_PAGE_HEADER_HAND_ROLLED]}
|
|
5705
|
+
witness:
|
|
5706
|
+
- {path: packages/eslint-grammar-core/src/page-header.spec.ts, editions: [lite, full], codes: [FE_PAGE_HEADER_HAND_ROLLED]}
|
|
5707
|
+
cases:
|
|
5708
|
+
- id: case-1
|
|
5709
|
+
date: "2026-10-28"
|
|
5710
|
+
source: owner
|
|
5711
|
+
quote: "Publish Grammar 0.15.3 with PageHeader now, then move all 18 pages to it before deploying. (translated from Vietnamese)"
|
|
5712
|
+
ruling: "A page is headed by Grammar's PageHeader (owner ruling page-header-band): a surface band whose content shares the page content's edges and which ends in its own full-width separator, page tabs standing on it; the lint refuses a page head composed by hand from Breadcrumbs and SectionHeader."
|