@starci/eslint-grammar-core 0.21.19 → 0.21.20
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 +4 -0
- package/dist/lib/why.js +2 -2
- package/dist/pane.d.ts +1 -1
- package/dist/pane.js +56 -15
- package/package.json +2 -2
- package/runtime/engine/runtime-root.mjs +30 -3
- package/runtime/knowledge/hfs/canon-pins.yaml +6 -6
- package/runtime/knowledge/hfs/rules.yaml +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.21.20 - 2026-11-04
|
|
4
|
+
|
|
5
|
+
- Changed: `pane-grid-page` (R348) refuses a `Page chrome="panes"` whose child is not one `PaneGrid` element written there: a wrapper or component that renders the grid, a fragment, a variable, a condition, no child or several, each of which Page throws `PAGE_PANES_CHILD_NOT_PANE_GRID` for at run time; the grid-side "wrapped" finding is this one. Requires `@starci/eslint-canon-fe` 9.13.3. the runtime copies carry `engine/runtime-root.mjs`, which moves an installed copy's legacy state with its owner and mode (`@starci/hfs` 5.6.1), and the release-5 canon pins.
|
|
6
|
+
|
|
3
7
|
## 0.21.19 - 2026-11-04
|
|
4
8
|
|
|
5
9
|
- Changed: version stamp only, with `@starci/grammar` 0.21.19; requires `@starci/eslint-canon-fe` 9.13.2. the runtime copies carry `engine/runtime-root.mjs` with the per-user state base of an installed copy (`@starci/hfs` 5.6.0) and the canon pins of release 4 (`@starci/auth` 0.4.0, `@starci/auth-oidc` 0.1.3).
|
package/dist/lib/why.js
CHANGED
|
@@ -61,8 +61,8 @@ export const why = {
|
|
|
61
61
|
},
|
|
62
62
|
"pane-grid-page": {
|
|
63
63
|
code: "FE_PANE_GRID_FRAME",
|
|
64
|
-
en: "A `PaneGrid` in `<file>` is drawn in a card or a page chrome other than `panes`, or
|
|
65
|
-
fix: "
|
|
64
|
+
en: "A `PaneGrid` in `<file>` is drawn in a card or a page chrome other than `panes`, or a `Page chrome=\"panes\"` there holds something other than one written `PaneGrid` element (a wrapper, a component that renders the grid, a fragment, a variable).",
|
|
65
|
+
fix: "Write the `<PaneGrid>` element as the one child of `<Page chrome=\"panes\">` (or as the one child of a `Pane`, nested), pass the panes into it, and drop the card or wrapper around it.",
|
|
66
66
|
},
|
|
67
67
|
"route-page-is-one-page": {
|
|
68
68
|
code: "FE_ROUTE_PAGE_OUTSIDE_PAGE",
|
package/dist/pane.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const paneGridChildren: Rule.RuleModule;
|
|
|
5
5
|
export declare const paneChildren: Rule.RuleModule;
|
|
6
6
|
/** What a `PaneSection` renders carries no padding or margin utility on its outermost elements. */
|
|
7
7
|
export declare const noPaneSectionPadding: Rule.RuleModule;
|
|
8
|
-
/** A `PaneGrid` stands in `Page chrome="panes"` or in a `Pane
|
|
8
|
+
/** A `PaneGrid` stands in `Page chrome="panes"` or in a `Pane`, and `Page chrome="panes"` holds one written `PaneGrid` element. */
|
|
9
9
|
export declare const paneGridPage: Rule.RuleModule;
|
|
10
10
|
/** The rules this law contributes to the plugin. */
|
|
11
11
|
export declare const rules: Record<string, Rule.RuleModule>;
|
package/dist/pane.js
CHANGED
|
@@ -6,7 +6,9 @@ import { defineFamilyRules, defineRule, exemptFreestyle } from "./lib/rule-contr
|
|
|
6
6
|
/**
|
|
7
7
|
* The pane laws (HFS R345 `FE_PANE_GRID_CHILD_NOT_PANE`, R346 `FE_PANE_CHILD_NOT_SECTION`, R347 `FE_PANE_SECTION_PADDING`, R348
|
|
8
8
|
* `FE_PANE_GRID_FRAME`): a `PaneGrid` holds `Pane`s, a `Pane` holds `PaneSection`s (or one nested `PaneGrid`), a
|
|
9
|
-
* `PaneSection` takes its inset from the pane it stands in, and a `PaneGrid` stands in a `Page chrome="panes"` or in a `Pane
|
|
9
|
+
* `PaneSection` takes its inset from the pane it stands in, and a `PaneGrid` stands in a `Page chrome="panes"` or in a `Pane`;
|
|
10
|
+
* the one child of `Page chrome="panes"` is a `PaneGrid` element written there, never a component that renders one (Page throws
|
|
11
|
+
* `PAGE_PANES_CHILD_NOT_PANE_GRID` at run time for anything else).
|
|
10
12
|
*
|
|
11
13
|
* `PaneGrid` places each child by the `area` of a `Pane` element and drops a child that is not one: a wrapper component
|
|
12
14
|
* renders nothing in its cell. A `Pane` owns its content inset and publishes it to its `PaneSection`s; a raw element or
|
|
@@ -21,8 +23,8 @@ import { defineFamilyRules, defineRule, exemptFreestyle } from "./lib/rule-contr
|
|
|
21
23
|
* roots of components declared in the same file and the class strings of imported constants through the type program.
|
|
22
24
|
* Auto and zero values (`mx-auto`, `p-0`) place or reset and inset nothing, so they are not padding.
|
|
23
25
|
*
|
|
24
|
-
* THE EXEMPTION. A raw element inside a `Freestyle` subtree is the app's own (`exemptFreestyle`); a `PaneGrid`
|
|
25
|
-
* not judged by `pane-grid-page`.
|
|
26
|
+
* THE EXEMPTION. A raw element inside a `Freestyle` subtree is the app's own (`exemptFreestyle`); a `PaneGrid` or a `Page`
|
|
27
|
+
* inside one is not judged by `pane-grid-page`.
|
|
26
28
|
*
|
|
27
29
|
* WHERE THEY APPLY. Product source (`isProductSource`).
|
|
28
30
|
*/
|
|
@@ -374,7 +376,6 @@ const chromeOf = (element) => {
|
|
|
374
376
|
/** Where a `PaneGrid` stands wrongly, or null when it stands in a pane, in the panes page, or where this file cannot tell. */
|
|
375
377
|
const wrongFrame = (grid) => {
|
|
376
378
|
const frames = [];
|
|
377
|
-
let wrapped = false;
|
|
378
379
|
for (let current = grid.parent; current !== undefined && current !== null; current = current.parent) {
|
|
379
380
|
if (current.type !== "JSXElement")
|
|
380
381
|
continue;
|
|
@@ -383,8 +384,6 @@ const wrongFrame = (grid) => {
|
|
|
383
384
|
return null;
|
|
384
385
|
if (name === "Pane" || name === "Page" || (name !== null && SURFACES.has(name)))
|
|
385
386
|
frames.push(current);
|
|
386
|
-
else if (frames.length === 0)
|
|
387
|
-
wrapped = true;
|
|
388
387
|
}
|
|
389
388
|
const frame = frames[0];
|
|
390
389
|
if (frame === undefined)
|
|
@@ -396,20 +395,55 @@ const wrongFrame = (grid) => {
|
|
|
396
395
|
const chrome = chromeOf(frame);
|
|
397
396
|
if (!chrome.known)
|
|
398
397
|
return null;
|
|
399
|
-
if (chrome.text
|
|
400
|
-
return
|
|
401
|
-
return
|
|
398
|
+
if (chrome.text === "panes")
|
|
399
|
+
return null;
|
|
400
|
+
return chrome.text === null ? "a `Page` without `chrome=\"panes\"`" : `a \`Page chrome="${chrome.text}"\``;
|
|
402
401
|
}
|
|
403
402
|
return `a \`${name ?? "frame"}\``;
|
|
404
403
|
};
|
|
405
|
-
/**
|
|
404
|
+
/** True when an element stands inside a `Freestyle` subtree. */
|
|
405
|
+
const inFreestyle = (element) => {
|
|
406
|
+
for (let current = element.parent; current !== undefined && current !== null; current = current.parent) {
|
|
407
|
+
if (current.type === "JSXElement" && nameOf(current.openingElement.name) === "Freestyle")
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
return false;
|
|
411
|
+
};
|
|
412
|
+
/** The written element an expression is, through type assertions, or null for anything else (a variable, a call, a condition). */
|
|
413
|
+
const writtenElement = (expression) => {
|
|
414
|
+
if (expression.type === "JSXElement")
|
|
415
|
+
return expression;
|
|
416
|
+
if (expression.type === "TSAsExpression" || expression.type === "TSNonNullExpression" || expression.type === "TSSatisfiesExpression")
|
|
417
|
+
return writtenElement(expression.expression);
|
|
418
|
+
return null;
|
|
419
|
+
};
|
|
420
|
+
/** What `Page chrome="panes"` holds instead of one written `PaneGrid` element, or null when it holds one. */
|
|
421
|
+
const panesChildProblem = (page) => {
|
|
422
|
+
const children = renderedChildren(page.children);
|
|
423
|
+
const [child] = children;
|
|
424
|
+
if (child === undefined)
|
|
425
|
+
return "no child";
|
|
426
|
+
if (children.length > 1)
|
|
427
|
+
return `${String(children.length)} children`;
|
|
428
|
+
if (child.type === "JSXFragment")
|
|
429
|
+
return "a fragment";
|
|
430
|
+
const element = child.type === "JSXElement" ? child : child.type === "JSXExpressionContainer" && child.expression.type !== "JSXEmptyExpression" ? writtenElement(child.expression) : null;
|
|
431
|
+
if (element === null)
|
|
432
|
+
return "a value it can only know at run time (a variable, a call or a condition)";
|
|
433
|
+
const name = nameOf(element.openingElement.name);
|
|
434
|
+
if (name === "PaneGrid")
|
|
435
|
+
return null;
|
|
436
|
+
return `\`<${name ?? "element"}>\`, which is not a \`PaneGrid\` element (a component that renders one is not one)`;
|
|
437
|
+
};
|
|
438
|
+
/** A `PaneGrid` stands in `Page chrome="panes"` or in a `Pane`, and `Page chrome="panes"` holds one written `PaneGrid` element. */
|
|
406
439
|
export const paneGridPage = defineRule({
|
|
407
440
|
meta: {
|
|
408
441
|
type: "problem",
|
|
409
|
-
docs: { description: "R348: a PaneGrid is the one child of Page chrome=\"panes\" or stands inside a Pane, never in a card or another page chrome.", url: "knowledge/hfs/rules.yaml#R348" },
|
|
442
|
+
docs: { description: "R348: a PaneGrid is the one child of Page chrome=\"panes\", written there as an element, or stands inside a Pane, never in a card or another page chrome.", url: "knowledge/hfs/rules.yaml#R348" },
|
|
410
443
|
schema: [],
|
|
411
444
|
messages: {
|
|
412
445
|
frame: "This `PaneGrid` is drawn in {{where}}. A grid is the whole body of a page that is panes, so `<Page chrome=\"panes\">` attaches it flush under the header, full width and to the viewport bottom, with no card, radius or gap; inside a pane it nests as the pane's one child. Make it the child of `Page chrome=\"panes\"` (or of a `Pane`) and drop the wrapper.",
|
|
446
|
+
child: "This `Page chrome=\"panes\"` holds {{found}}. The page lays out exactly one `PaneGrid` element written as its child and throws PAGE_PANES_CHILD_NOT_PANE_GRID at run time for anything else. Write the `<PaneGrid>` here and pass the panes into it from the component, instead of a wrapper that renders the grid.",
|
|
413
447
|
},
|
|
414
448
|
},
|
|
415
449
|
create(context) {
|
|
@@ -417,11 +451,18 @@ export const paneGridPage = defineRule({
|
|
|
417
451
|
return {};
|
|
418
452
|
return {
|
|
419
453
|
JSXElement(node) {
|
|
420
|
-
|
|
454
|
+
const name = nameOf(node.openingElement.name);
|
|
455
|
+
if (name === "PaneGrid") {
|
|
456
|
+
const where = wrongFrame(node);
|
|
457
|
+
if (where !== null)
|
|
458
|
+
context.report({ node: node.openingElement, messageId: "frame", data: { where } });
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
if (name !== "Page" || chromeOf(node).text !== "panes" || inFreestyle(node))
|
|
421
462
|
return;
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
424
|
-
context.report({ node: node.openingElement, messageId: "
|
|
463
|
+
const found = panesChildProblem(node);
|
|
464
|
+
if (found !== null)
|
|
465
|
+
context.report({ node: node.openingElement, messageId: "child", data: { found } });
|
|
425
466
|
},
|
|
426
467
|
};
|
|
427
468
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starci/eslint-grammar-core",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.20",
|
|
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.13.
|
|
44
|
+
"@starci/eslint-canon-fe": "9.13.3",
|
|
45
45
|
"eslint": ">=9",
|
|
46
46
|
"typescript": ">=5.9"
|
|
47
47
|
},
|
|
@@ -58,10 +58,36 @@ export class LegacyStateHeld extends Error {
|
|
|
58
58
|
}
|
|
59
59
|
const HELD = new Set(['EPERM', 'EBUSY', 'EACCES']);
|
|
60
60
|
const isHeld = (error) => HELD.has(String(error?.code));
|
|
61
|
+
/** Gives `to` and everything below it the mode, owner and group of the matching entry of `from` (a copy keeps neither on its own). */
|
|
62
|
+
function keepOwnership(from, to) {
|
|
63
|
+
const source = fs.lstatSync(from);
|
|
64
|
+
const target = fs.lstatSync(to);
|
|
65
|
+
if (!source.isSymbolicLink())
|
|
66
|
+
fs.chmodSync(to, source.mode & 0o7777);
|
|
67
|
+
if (source.uid !== target.uid || source.gid !== target.gid)
|
|
68
|
+
fs.lchownSync(to, source.uid, source.gid);
|
|
69
|
+
if (source.isDirectory())
|
|
70
|
+
for (const name of fs.readdirSync(from))
|
|
71
|
+
keepOwnership(path.join(from, name), path.join(to, name));
|
|
72
|
+
}
|
|
73
|
+
/** Moves one entry by rename, which keeps its owner and mode; across volumes (EXDEV) it is copied, its ownership restored, then removed. */
|
|
74
|
+
function moveEntry(from, to) {
|
|
75
|
+
try {
|
|
76
|
+
fs.renameSync(from, to);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (error?.code !== 'EXDEV')
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
fs.cpSync(from, to, { recursive: true, verbatimSymlinks: true, errorOnExist: true, force: false });
|
|
84
|
+
keepOwnership(from, to);
|
|
85
|
+
fs.rmSync(from, { recursive: true, force: true });
|
|
86
|
+
}
|
|
61
87
|
/**
|
|
62
88
|
* Moves the state an installed copy kept inside itself (<copy>/.runtime, before installedStateBase) out to the state base, once: the
|
|
63
|
-
* folder is first renamed to <copy>/.runtime.adopting (a rename a running stack's open files refuse, LegacyStateHeld), then
|
|
64
|
-
*
|
|
89
|
+
* folder is first renamed to <copy>/.runtime.adopting (a rename a running stack's open files refuse, LegacyStateHeld), then each entry
|
|
90
|
+
* is moved with its owner and mode (a bind folder a container user owns stays that user's) and the folder removed. An entry the state base already holds is kept beside it under legacy-<stamp>/, never overwritten. An
|
|
65
91
|
* interrupted adoption resumes from .runtime.adopting. Null when there is nothing to adopt: a checkout, LOCAL_ROOT_ENV set, or no
|
|
66
92
|
* legacy folder.
|
|
67
93
|
*/
|
|
@@ -88,7 +114,8 @@ export function adoptLegacyState(env = process.env, root = skillRoot, now = () =
|
|
|
88
114
|
const kept = [];
|
|
89
115
|
for (const name of fs.readdirSync(parked).sort()) {
|
|
90
116
|
const taken = fs.existsSync(path.join(to, name));
|
|
91
|
-
fs.
|
|
117
|
+
fs.mkdirSync(taken ? aside : to, { recursive: true });
|
|
118
|
+
moveEntry(path.join(parked, name), path.join(taken ? aside : to, name));
|
|
92
119
|
(taken ? kept : moved).push(name);
|
|
93
120
|
}
|
|
94
121
|
fs.rmSync(parked, { recursive: true, force: true });
|
|
@@ -38,7 +38,7 @@ pins:
|
|
|
38
38
|
source: packages/next-data/package.json
|
|
39
39
|
why: 'the SWR data helpers of every front end (fe-stack data, owner:next-data-package): pollingRestart, the viewer and tenant key helpers, viewerSwrConfig and the viewer cache; each operation hook stays in the app and the package holds no component.'
|
|
40
40
|
'@starci/grammar':
|
|
41
|
-
version: 0.21.
|
|
41
|
+
version: 0.21.20
|
|
42
42
|
group: starci
|
|
43
43
|
install: registry
|
|
44
44
|
side: fe
|
|
@@ -52,28 +52,28 @@ pins:
|
|
|
52
52
|
source: packages/next-i18n/package.json
|
|
53
53
|
why: 'the next-intl stack of every front end (fe-stack i18n, owner:next-i18n-package): defineI18n over the locales of the app, the locale-negotiating proxy, the locale-aware navigation, the request config that loads the catalogs of the app and the locale read of the [locale] layout; the app keeps its message catalogs and writes none of the stack.'
|
|
54
54
|
'@starci/eslint-canon-be':
|
|
55
|
-
version: 3.15.
|
|
55
|
+
version: 3.15.3
|
|
56
56
|
group: starci
|
|
57
57
|
install: registry
|
|
58
58
|
side: be
|
|
59
59
|
source: packages/eslint-canon-be/package.json
|
|
60
60
|
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.'
|
|
61
61
|
'@starci/eslint-canon-fe':
|
|
62
|
-
version: 9.13.
|
|
62
|
+
version: 9.13.3
|
|
63
63
|
group: starci
|
|
64
64
|
install: registry
|
|
65
65
|
side: fe
|
|
66
66
|
source: packages/eslint-canon-fe/package.json
|
|
67
67
|
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.'
|
|
68
68
|
'@starci/eslint-grammar-core':
|
|
69
|
-
version: 0.21.
|
|
69
|
+
version: 0.21.20
|
|
70
70
|
group: starci
|
|
71
71
|
install: registry
|
|
72
72
|
side: fe
|
|
73
73
|
source: packages/eslint-grammar-core/package.json
|
|
74
74
|
why: 'the StarCi Grammar component API lint, versioned with @starci/grammar; front ends compose this family package with the universal FE canon.'
|
|
75
75
|
'@starci/eslint-grammar-offset-pop':
|
|
76
|
-
version: 0.21.
|
|
76
|
+
version: 0.21.20
|
|
77
77
|
group: starci
|
|
78
78
|
install: registry
|
|
79
79
|
side: fe
|
|
@@ -155,7 +155,7 @@ pins:
|
|
|
155
155
|
source: packages/mail/package.json
|
|
156
156
|
why: 'outgoing mail of a back end: a NestJS module and the Mailer port over SMTP (connect, greeting, socket and total timeouts, STARTTLS required by default, recipient, message and attachment checks, a shared SMTP target policy, coded errors, typed escaping render helpers returning { subject, text, html }), with @starci/mail/testing for its specs; the only importer of nodemailer (R90).'
|
|
157
157
|
'@starci/hfs':
|
|
158
|
-
version: 5.6.
|
|
158
|
+
version: 5.6.1
|
|
159
159
|
group: starci
|
|
160
160
|
install: registry
|
|
161
161
|
side: both
|
|
@@ -6151,7 +6151,7 @@ rules:
|
|
|
6151
6151
|
ruling: "One padding system for everything placed in a PaneGrid: the Pane publishes the inset and the PaneSection applies it, so no band adds its own."
|
|
6152
6152
|
- id: R348
|
|
6153
6153
|
code: "FE_PANE_GRID_FRAME"
|
|
6154
|
-
law: "A Grammar PaneGrid is the one child of `Page chrome=\"panes\"
|
|
6154
|
+
law: "A Grammar PaneGrid is the one child of `Page chrome=\"panes\"`, written there as a PaneGrid element, or stands inside a Pane; a PaneGrid drawn in a SurfaceCard of any kind or a Page of another chrome re-decides the frame and the bottom edge that Page owns, and `Page chrome=\"panes\"` holding anything but one written PaneGrid element (a wrapper element, a component that renders the grid, a fragment, a variable, a condition) throws PAGE_PANES_CHILD_NOT_PANE_GRID at run time. A grid whose frame lives in another file is judged where the frame is, and a Freestyle subtree is not judged."
|
|
6155
6155
|
kinds: [lint]
|
|
6156
6156
|
gates: [pre-commit, settle, land, ci]
|
|
6157
6157
|
failureCodes: ["FE_PANE_GRID_FRAME"]
|