@starci/eslint-grammar-core 0.20.1 → 0.20.2
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 +8 -1
- package/dist/lib/why.js +2 -2
- package/dist/status-colors.d.ts +10 -4
- package/dist/status-colors.js +102 -28
- package/docs/status-colors.md +17 -8
- package/package.json +2 -2
- package/runtime/knowledge/hfs/canon-pins.yaml +6 -6
- package/runtime/knowledge/hfs/rules.yaml +93 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.20.2 - 2026-11-01
|
|
4
|
+
|
|
5
|
+
- Changed: `status-text-uses-soft-foreground` follows the owner's pair rule. It refuses a solid tone painted as text on a `bg-<tone>-soft` tint of the same element (message `onTint`: use `text-<tone>-soft-foreground`) and the soft foreground with no `bg-<tone>-soft` behind it on its element or on an enclosing element of the file (message `alone`: use `text-<tone>`). A bare `text-<tone>`, which the rule refused before, is no longer a finding. Constants and `classes` entries are judged for the first finding only.
|
|
6
|
+
- Changed: with `offset-pop` as the selected Grammar the `alone` finding is not reported (its light theme keeps the soft foreground for a bare mark, owner choice "1. Pastel").
|
|
7
|
+
- Changed: the bundled rule catalog carries R351 to R354 and the new R61 law text.
|
|
8
|
+
- Changed: moves with `@starci/grammar` 0.20.2 (the stat strip's dividers) and requires `@starci/eslint-canon-fe` 9.8.5; the bundled canon pins follow; the status rule changes (below).
|
|
9
|
+
|
|
3
10
|
## 0.20.1 - 2026-11-01
|
|
4
11
|
|
|
5
12
|
- Changed: requires `@starci/eslint-canon-fe` 9.8.4; the bundled canon pins follow hfs 4.16.4; no rule changed.
|
|
@@ -220,7 +227,7 @@
|
|
|
220
227
|
|
|
221
228
|
- Changed: versioned together with Grammar 0.14.0; the bundled canon pins name the 0.14.0 Grammar family.
|
|
222
229
|
- Added: `starci-grammar/chip-label-starts-uppercase` (R322 `FE_CHIP_LABEL_CASE`): a literal `StatusDot` or `Badge` label starts with an uppercase letter, Vietnamese included; the fix uppercases it in place.
|
|
223
|
-
- Changed: `@starci/eslint-canon-fe` 9.3.0 is the peer dependency; the bundled canon pins name `starci-harness` 1.1.0-alpha.1 (`source: cli/package.json`) in place of the retired `@starci/cli`, the one command line a product installs for `starci app`, and follow hfs 4.9.0, canon-fe 9.3.0 and canon-be 3.5.0.
|
|
230
|
+
- Changed: `@starci/eslint-canon-fe` 9.3.0 is the peer dependency; the bundled canon pins name `starci-harness` 1.1.0-alpha.1 (`source: cli/package.json`) in place of the retired `@starci/cli`, the one command line a product installs for `starci app`, and follow hfs 4.9.0, canon-fe 9.3.0 and canon-be 3.5.0. One rule law changes (above).
|
|
224
231
|
|
|
225
232
|
## 0.13.0 - 2026-10-27
|
|
226
233
|
|
package/dist/lib/why.js
CHANGED
|
@@ -91,7 +91,7 @@ export const why = {
|
|
|
91
91
|
},
|
|
92
92
|
"status-text-uses-soft-foreground": {
|
|
93
93
|
code: "FE_STYLE_TOKEN_ONLY",
|
|
94
|
-
en: "`<file>`
|
|
95
|
-
fix: "
|
|
94
|
+
en: "`<file>` colours status content against the owner's pair rule (`<what>`): content on a `bg-<tone>-soft` tint paints with the solid tone (e.g. `bg-success-soft text-success`), or a mark with no tint behind it paints with the soft foreground (e.g. `text-success-soft-foreground` alone).",
|
|
95
|
+
fix: "Content on a background of the tone takes the pair: `bg-<tone>-soft` with `text-<tone>-soft-foreground`. A mark that stands alone, with no background of the tone, takes the tone itself: `text-<tone>`. A solid fill takes `bg-<tone>` with `text-<tone>-foreground`.",
|
|
96
96
|
},
|
|
97
97
|
};
|
package/dist/status-colors.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import type { Rule } from "eslint";
|
|
2
|
-
|
|
3
|
-
export declare const solidTextClasses: (text: string) => {
|
|
2
|
+
type PaintedClass = {
|
|
4
3
|
token: string;
|
|
5
4
|
family: string;
|
|
6
5
|
tone: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
6
|
+
};
|
|
7
|
+
/** Every solid-tone text class in one class string. */
|
|
8
|
+
export declare const solidTextClasses: (text: string) => PaintedClass[];
|
|
9
|
+
/** Every soft-foreground text class in one class string. */
|
|
10
|
+
export declare const softTextClasses: (text: string) => PaintedClass[];
|
|
11
|
+
/** The tones whose soft tint a class string sets as a background. */
|
|
12
|
+
export declare const softBackgroundTones: (text: string) => string[];
|
|
13
|
+
/** Content on a tone's tint wears the soft foreground; a mark with no tint behind it wears the tone. */
|
|
9
14
|
export declare const statusTextUsesSoftForeground: Rule.RuleModule;
|
|
10
15
|
/** The rules this law contributes to the plugin. */
|
|
11
16
|
export declare const rules: Record<string, Rule.RuleModule>;
|
|
12
17
|
/** Every rule of this law is an error. */
|
|
13
18
|
export declare const recommended: Record<string, "error">;
|
|
19
|
+
export {};
|
package/dist/status-colors.js
CHANGED
|
@@ -1,30 +1,44 @@
|
|
|
1
1
|
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
2
2
|
/**
|
|
3
|
-
* The rule that holds `status-colors.md` (HFS R61 `FE_STYLE_TOKEN_ONLY`, the class-name half of the
|
|
3
|
+
* The rule that holds `status-colors.md` (HFS R61 `FE_STYLE_TOKEN_ONLY`, the class-name half of the status-pair contrast
|
|
4
4
|
* obligation; the brand layer's own contrast belongs to `@starci/stylelint-canon` `starci/status-contrast`).
|
|
5
5
|
*
|
|
6
|
-
* A STATUS TONE
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* make that ink readable (3:1 on the tint and on the page); the solid tone is only the mid-luminance hue of the brand
|
|
10
|
-
* and reads 3.8:1 or worse on white, so as a text colour it fails the contrast the soft pair was built to give.
|
|
6
|
+
* A STATUS TONE x PAINTS IN TWO WAYS (owner ruling `status-soft-pair-on-background`). Content that sits ON A BACKGROUND OF THE
|
|
7
|
+
* TONE uses the pair `x-soft` and `x-soft-foreground`, the way a HeroUI flat Chip does. A mark that STANDS ALONE, with no
|
|
8
|
+
* background of the tone behind it, uses `x` itself. A solid fill takes `x-foreground`.
|
|
11
9
|
*
|
|
12
10
|
* WHAT IT READS. Every static class string a component writes: the `className` / `class` attribute of an element (through
|
|
13
|
-
* `cn()`, `clsx()`, conditionals, arrays, template text), and a string in a constant or in a `classes` entry. The tones
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* tone (`text-success`, `fill-danger`, `stroke-warning`, `decoration-info`, with any variant and opacity).
|
|
11
|
+
* `cn()`, `clsx()`, conditionals, arrays, template text), and a string in a constant or in a `classes` entry. The tones are the
|
|
12
|
+
* grammar's `STATUS_TONES` (`lib/status-tones.generated.ts`, generated from the grammar with the stylelint vocabulary), never a
|
|
13
|
+
* list typed here. Two findings:
|
|
17
14
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
15
|
+
* - ON A TINT: a class string that sets `bg-x-soft` and also paints text, an icon or a text decoration with the solid tone
|
|
16
|
+
* (`text-x`, `fill-x`, `stroke-x`, `decoration-x`, with any variant and opacity). The content on the tint takes
|
|
17
|
+
* `text-x-soft-foreground`.
|
|
18
|
+
* - ALONE: the soft foreground (`text-x-soft-foreground`) in the `className` of an element when neither that element nor an
|
|
19
|
+
* enclosing element of the same file sets `bg-x-soft`. A mark with no tint behind it takes `text-x`. A constant, an array in
|
|
20
|
+
* a constant or a `classes` entry is not judged for this finding, since the element that wears it is not in view.
|
|
21
|
+
*
|
|
22
|
+
* OFFSET POP. The family's light-theme tones are pastel fills (1.3 to 1.5:1 as bare text), and the owner chose to keep them
|
|
23
|
+
* ("1. Pastel"): a bare mark wears the soft foreground there. When the selected Grammar is `offset-pop` the ALONE finding is
|
|
24
|
+
* not reported; the ON A TINT finding still is.
|
|
25
|
+
*
|
|
26
|
+
* WHAT IT LEAVES ALONE: a bare solid tone (`text-success` with no `bg-success-soft` on the element), the soft pair on its tint, a
|
|
27
|
+
* solid fill with its own ink (`bg-success text-success-foreground`), a solid border, ring or outline (`border-danger`,
|
|
28
|
+
* `ring-warning`: a boundary is not text), and a class that only shares a prefix (`text-successful`).
|
|
21
29
|
*/
|
|
22
30
|
import { attributeValue } from "@starci/eslint-canon-fe/lib/ast.mjs";
|
|
23
31
|
import { STATUS_TONES } from "./lib/status-tones.generated.js";
|
|
24
32
|
/** The utility families that paint text, an icon or a text decoration. */
|
|
25
33
|
const TEXT_PAINT = ["text", "fill", "stroke", "decoration"];
|
|
34
|
+
/** An optional opacity suffix: `/60` or `/[.4]`. */
|
|
35
|
+
const OPACITY = "(?:/(?:\\d+|\\[[^\\]]*\\]))?";
|
|
26
36
|
/** `text-success`, `text-success/60`, `text-success-hover`, with an optional `!` and any variants before it. */
|
|
27
|
-
const SOLID_TEXT = new RegExp(`^!?(${TEXT_PAINT.join("|")})-(${STATUS_TONES.join("|")})(?:-hover)
|
|
37
|
+
const SOLID_TEXT = new RegExp(`^!?(${TEXT_PAINT.join("|")})-(${STATUS_TONES.join("|")})(?:-hover)?${OPACITY}$`);
|
|
38
|
+
/** `text-success-soft-foreground`, with an optional `!`, opacity and any variants before it. */
|
|
39
|
+
const SOFT_TEXT = new RegExp(`^!?(${TEXT_PAINT.join("|")})-(${STATUS_TONES.join("|")})-soft-foreground${OPACITY}$`);
|
|
40
|
+
/** `bg-success-soft`, `bg-success-soft-hover`, with an optional `!`, opacity and any variants before it. */
|
|
41
|
+
const SOFT_BACKGROUND = new RegExp(`^!?bg-(${STATUS_TONES.join("|")})-soft(?:-hover)?${OPACITY}$`);
|
|
28
42
|
/** The class after its variants: `md:hover:text-success` and `[&>svg]:text-success` both end at `text-success`. */
|
|
29
43
|
const utilityOf = (token) => {
|
|
30
44
|
let depth = 0;
|
|
@@ -39,16 +53,28 @@ const utilityOf = (token) => {
|
|
|
39
53
|
}
|
|
40
54
|
return token.slice(cut + 1);
|
|
41
55
|
};
|
|
42
|
-
/** Every
|
|
43
|
-
|
|
56
|
+
/** Every class of one class string that the pattern reads, as `{ token, family, tone }`. */
|
|
57
|
+
const paintedClasses = (text, pattern) => text
|
|
44
58
|
.split(/\s+/)
|
|
45
59
|
.filter(Boolean)
|
|
46
60
|
.flatMap((token) => {
|
|
47
|
-
const match =
|
|
61
|
+
const match = pattern.exec(utilityOf(token));
|
|
48
62
|
const family = match?.[1];
|
|
49
63
|
const tone = match?.[2];
|
|
50
64
|
return family !== undefined && tone !== undefined ? [{ token, family, tone }] : [];
|
|
51
65
|
});
|
|
66
|
+
/** Every solid-tone text class in one class string. */
|
|
67
|
+
export const solidTextClasses = (text) => paintedClasses(text, SOLID_TEXT);
|
|
68
|
+
/** Every soft-foreground text class in one class string. */
|
|
69
|
+
export const softTextClasses = (text) => paintedClasses(text, SOFT_TEXT);
|
|
70
|
+
/** The tones whose soft tint a class string sets as a background. */
|
|
71
|
+
export const softBackgroundTones = (text) => text
|
|
72
|
+
.split(/\s+/)
|
|
73
|
+
.filter(Boolean)
|
|
74
|
+
.flatMap((token) => {
|
|
75
|
+
const tone = SOFT_BACKGROUND.exec(utilityOf(token))?.[1];
|
|
76
|
+
return tone === undefined ? [] : [tone];
|
|
77
|
+
});
|
|
52
78
|
/** The string nodes inside an expression that builds a class string: literals, template text, keys, and everything a call, array or condition carries. */
|
|
53
79
|
function* stringNodes(node) {
|
|
54
80
|
if (!node || typeof node.type !== "string")
|
|
@@ -97,32 +123,80 @@ function* stringNodes(node) {
|
|
|
97
123
|
default:
|
|
98
124
|
}
|
|
99
125
|
}
|
|
100
|
-
/**
|
|
126
|
+
/** The tones whose soft tint some string of the list sets as a background. */
|
|
127
|
+
const tintsOf = (strings) => new Set(strings.flatMap(({ text }) => softBackgroundTones(text)));
|
|
128
|
+
/** True for the `className` and `class` attributes of an element. */
|
|
129
|
+
const isClassAttribute = (node) => node.type === "JSXAttribute" && node.name.type === "JSXIdentifier" && (node.name.name === "className" || node.name.name === "class");
|
|
130
|
+
/** The tones whose tint an element enclosing the attribute's own element sets in its `className`, in the same file. */
|
|
131
|
+
const enclosingTints = (attribute) => {
|
|
132
|
+
const tones = new Set();
|
|
133
|
+
for (let current = attribute.parent?.parent?.parent; current !== undefined && current !== null; current = current.parent) {
|
|
134
|
+
if (current.type !== "JSXElement")
|
|
135
|
+
continue;
|
|
136
|
+
for (const candidate of current.openingElement.attributes) {
|
|
137
|
+
if (candidate.type !== "JSXAttribute" || !isClassAttribute(candidate))
|
|
138
|
+
continue;
|
|
139
|
+
for (const tone of tintsOf([...stringNodes(attributeValue(candidate))]))
|
|
140
|
+
tones.add(tone);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return tones;
|
|
144
|
+
};
|
|
145
|
+
/** The Grammar the app selected (`settings.starci.hfs.grammar`), or null when the settings carry none. */
|
|
146
|
+
const grammarOf = (settings) => {
|
|
147
|
+
const starci = settings?.["starci"];
|
|
148
|
+
if (typeof starci !== "object" || starci === null)
|
|
149
|
+
return null;
|
|
150
|
+
const hfs = Reflect.get(starci, "hfs");
|
|
151
|
+
if (typeof hfs !== "object" || hfs === null)
|
|
152
|
+
return null;
|
|
153
|
+
const grammar = Reflect.get(hfs, "grammar");
|
|
154
|
+
return typeof grammar === "string" ? grammar : null;
|
|
155
|
+
};
|
|
156
|
+
/** Content on a tone's tint wears the soft foreground; a mark with no tint behind it wears the tone. */
|
|
101
157
|
export const statusTextUsesSoftForeground = defineRule({
|
|
102
158
|
meta: {
|
|
103
159
|
type: "problem",
|
|
104
|
-
docs: { description: "Status
|
|
160
|
+
docs: { description: "Status content on a tone background takes the soft pair; a status mark with no background of the tone takes the tone itself." },
|
|
105
161
|
schema: [],
|
|
106
162
|
messages: {
|
|
107
|
-
|
|
163
|
+
onTint: "`{{token}}` paints text or an icon with the solid `{{tone}}` tone on a `bg-{{tone}}-soft` tint. Content that sits on a background of the tone takes the pair: `{{family}}-{{tone}}-soft-foreground` on `bg-{{tone}}-soft`.",
|
|
164
|
+
alone: "`{{token}}` paints a status mark with the soft foreground, but no `bg-{{tone}}-soft` is behind it on this element or on an element that encloses it in this file. A mark that stands alone, with no background of the tone, takes the tone itself: `{{family}}-{{tone}}`. Put it on a `bg-{{tone}}-soft` tint to keep the soft pair.",
|
|
108
165
|
},
|
|
109
166
|
},
|
|
110
167
|
create(context) {
|
|
111
168
|
// A `classes` entry inside a constant is reached twice (as part of the constant, and as the entry): one finding per string.
|
|
169
|
+
// Offset Pop's light theme draws a bare mark with the soft foreground (owner choice "1. Pastel"), so the lone soft foreground is not judged there.
|
|
170
|
+
const aloneJudged = grammarOf(context.settings) !== "offset-pop";
|
|
112
171
|
const seen = new Set();
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
continue;
|
|
117
|
-
seen.add(node);
|
|
172
|
+
const fresh = (strings) => [...strings].filter(({ node }) => !seen.has(node) && seen.add(node));
|
|
173
|
+
const reportOnTint = (strings, tints) => {
|
|
174
|
+
for (const { node, text } of strings) {
|
|
118
175
|
for (const { token, family, tone } of solidTextClasses(text))
|
|
119
|
-
|
|
176
|
+
if (tints.has(tone))
|
|
177
|
+
context.report({ node, messageId: "onTint", data: { token, family, tone } });
|
|
120
178
|
}
|
|
121
179
|
};
|
|
180
|
+
const check = (root) => {
|
|
181
|
+
const strings = fresh(stringNodes(root));
|
|
182
|
+
reportOnTint(strings, tintsOf(strings));
|
|
183
|
+
};
|
|
122
184
|
return {
|
|
123
185
|
JSXAttribute(node) {
|
|
124
|
-
if (
|
|
125
|
-
|
|
186
|
+
if (!isClassAttribute(node))
|
|
187
|
+
return;
|
|
188
|
+
const strings = fresh(stringNodes(attributeValue(node)));
|
|
189
|
+
const own = tintsOf(strings);
|
|
190
|
+
reportOnTint(strings, own);
|
|
191
|
+
if (!aloneJudged)
|
|
192
|
+
return;
|
|
193
|
+
const enclosing = enclosingTints(node);
|
|
194
|
+
for (const { node: stringNode, text } of strings) {
|
|
195
|
+
for (const { token, family, tone } of softTextClasses(text)) {
|
|
196
|
+
if (!own.has(tone) && !enclosing.has(tone))
|
|
197
|
+
context.report({ node: stringNode, messageId: "alone", data: { token, family, tone } });
|
|
198
|
+
}
|
|
199
|
+
}
|
|
126
200
|
},
|
|
127
201
|
VariableDeclarator(node) {
|
|
128
202
|
check(node.init);
|
package/docs/status-colors.md
CHANGED
|
@@ -1,34 +1,43 @@
|
|
|
1
|
-
# Status
|
|
1
|
+
# Status colors: content on a tone background takes the soft pair, a lone mark takes the tone
|
|
2
2
|
|
|
3
|
-
Law module: `status-colors.ts`. Catalogue: R61 FE_STYLE_TOKEN_ONLY (the class-name half of the
|
|
3
|
+
Law module: `status-colors.ts`. Catalogue: R61 FE_STYLE_TOKEN_ONLY (the class-name half of the status-pair contrast obligation; the brand layer's own contrast is `starci/status-contrast` of @starci/stylelint-canon).
|
|
4
4
|
|
|
5
|
-
A status tone
|
|
5
|
+
A status tone `x` (`success`, `warning`, `danger`, `info`, read from `lib/status-tones.generated.ts`, which is generated from the grammar with the stylelint vocabulary) paints in two ways. Content that sits on a background of the tone uses the pair `x-soft` and `x-soft-foreground`, the way a HeroUI flat Chip does. A mark that stands alone, with no background of the tone behind it, uses `x` itself. A solid fill takes `x-foreground`. The owner's words: "TEXT TRÊN BG THÌ X-SOFT VÀ X-SOFT-FOREGROUND, CÒN NẾU X ĐỘC LẬP THÌ ĐỂ X LUN" (ruling `status-soft-pair-on-background`).
|
|
6
6
|
|
|
7
7
|
Every rule below is an error in `coreGrammarConfig`; none can be switched off or suppressed inline.
|
|
8
8
|
|
|
9
9
|
## `starci-grammar/status-text-uses-soft-foreground`
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Two findings, both read from `className`/`class`, from `cn()`/`clsx()` arguments, conditionals, arrays, constants and `classes` entries, with any variant, opacity or `!`:
|
|
12
|
+
|
|
13
|
+
- **on a tint** (message `onTint`): a class string that sets `bg-<tone>-soft` and also paints text, an icon or a text decoration with the solid tone of the same tone: `text-<tone>`, `fill-<tone>`, `stroke-<tone>`, `decoration-<tone>`. The content on the tint takes `text-<tone>-soft-foreground`.
|
|
14
|
+
- **alone** (message `alone`): `text-<tone>-soft-foreground` (or `fill-`, `stroke-`, `decoration-`) in the `className` of an element when neither that element nor an element that encloses it in the same file sets `bg-<tone>-soft`. A mark with no tint behind it takes `text-<tone>`. A constant, an array in a constant or a `classes` entry is not judged for this finding, since the element that wears it is not in view; a component that receives its tint from another file is judged where the tint is written.
|
|
15
|
+
|
|
16
|
+
On Offset Pop (`settings.starci.hfs.grammar` is `offset-pop`) the **alone** finding is not reported: the family's light-theme tones are pastel fills and a bare mark wears the soft foreground there (owner choice "1. Pastel"); its dark theme keeps bare x, which the rule does not refuse either.
|
|
17
|
+
|
|
18
|
+
A bare solid tone (`text-success` with no `bg-success-soft` on the element), the pair on its tint, a solid fill with its own ink, a solid border, ring or outline, and a tone beside a tint of another tone are not findings.
|
|
12
19
|
|
|
13
20
|
**Invalid** (`src/components/leaves/StatusText/index.tsx`)
|
|
14
21
|
|
|
15
22
|
```tsx
|
|
16
|
-
<span className="text-success" />
|
|
17
|
-
<
|
|
23
|
+
<span className="bg-success-soft text-success" />
|
|
24
|
+
<span className="text-danger-soft-foreground" />
|
|
18
25
|
```
|
|
19
26
|
|
|
20
27
|
**Valid** (`src/components/leaves/StatusText/index.tsx`)
|
|
21
28
|
|
|
22
29
|
```tsx
|
|
23
30
|
<span className="bg-success-soft text-success-soft-foreground" />
|
|
31
|
+
<span className="text-success" />
|
|
32
|
+
<div className="bg-danger-soft"><span className="text-danger-soft-foreground" /></div>
|
|
24
33
|
<button className="bg-success text-success-foreground" />
|
|
25
34
|
<div className="border-danger ring-2 ring-warning" />
|
|
26
35
|
```
|
|
27
36
|
|
|
28
37
|
**Finding code:** `FE_STYLE_TOKEN_ONLY`
|
|
29
38
|
|
|
30
|
-
**Why:** `<file>` colours
|
|
39
|
+
**Why:** `<file>` colours status content against the owner's pair rule (`<what>`): content on a `bg-<tone>-soft` tint paints with the solid tone, or a mark with no tint behind it paints with the soft foreground.
|
|
31
40
|
|
|
32
|
-
**Fix:**
|
|
41
|
+
**Fix:** Content on a background of the tone takes the pair: `bg-<tone>-soft` with `text-<tone>-soft-foreground`. A mark that stands alone, with no background of the tone, takes the tone itself: `text-<tone>`. A solid fill takes `bg-<tone>` with `text-<tone>-foreground`.
|
|
33
42
|
|
|
34
43
|
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.20.
|
|
3
|
+
"version": "0.20.2",
|
|
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.8.
|
|
44
|
+
"@starci/eslint-canon-fe": "9.8.5",
|
|
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.20.
|
|
34
|
+
version: 0.20.2
|
|
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.11.
|
|
41
|
+
version: 3.11.6
|
|
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.8.
|
|
48
|
+
version: 9.8.5
|
|
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.20.
|
|
55
|
+
version: 0.20.2
|
|
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.20.
|
|
62
|
+
version: 0.20.2
|
|
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.16.
|
|
109
|
+
version: 4.16.5
|
|
110
110
|
group: starci
|
|
111
111
|
install: registry
|
|
112
112
|
side: both
|
|
@@ -1253,7 +1253,7 @@ rules:
|
|
|
1253
1253
|
- {path: packages/hfs/src/hfs-i18n-catalog-coverage.spec.mjs, editions: [lite, full]}
|
|
1254
1254
|
- id: R61
|
|
1255
1255
|
code: "FE_STYLE_TOKEN_ONLY"
|
|
1256
|
-
law: "Application CSS uses the selected Grammar tokens for layout and the declared brand owner for brand values; every source declaration resolves. Status foregrounds reach 3:1 against their tinted surface and page background in each theme, body text reaches 4.5:1, and
|
|
1256
|
+
law: "Application CSS uses the selected Grammar tokens for layout and the declared brand owner for brand values; every source declaration resolves. Status foregrounds reach 3:1 against their tinted surface and page background in each theme, body text reaches 4.5:1, content on a tone background uses the tone's soft pair and a mark with no background of the tone uses the tone itself. The selected Grammar owns the concrete token pairs, typography, scale and visual values."
|
|
1257
1257
|
docs: [knowledge/patterns/fe/index.yaml#FE-RULE-OWNERSHIP, packages/stylelint/README.md, packages/eslint/fe/docs/brand-values.md, docs/source-process.md#the-test-ladder, knowledge/hfs/rules.yaml#R225]
|
|
1258
1258
|
kinds: [lint, design]
|
|
1259
1259
|
gates: [pre-commit, settle, land, ci]
|
|
@@ -6187,3 +6187,95 @@ rules:
|
|
|
6187
6187
|
source: owner
|
|
6188
6188
|
quote: "hay full 3 bỏ 4 đi!!! thầy nghĩ nên v"
|
|
6189
6189
|
ruling: "One spacing scale with no 16; every container holds its content 12 in, and an app names relations through role props, never spacing utilities."
|
|
6190
|
+
- id: R351
|
|
6191
|
+
code: "FE_TABLE_IN_CARD"
|
|
6192
|
+
law: "A DataTable is not placed inside a SurfaceCard, on the page or in a pane: plain rows with a few facts are a SurfaceListCard with the label outside and the note in its footer, and a table that belongs to a card is an owner decision named in this rule. The rule reads the JSX of the file: a DataTable enclosed by a SurfaceCard element, or rendered by a component of the same file that a SurfaceCard encloses."
|
|
6193
|
+
kinds: [lint]
|
|
6194
|
+
gates: [pre-commit, settle, land, ci]
|
|
6195
|
+
failureCodes: ["FE_TABLE_IN_CARD"]
|
|
6196
|
+
enforcers:
|
|
6197
|
+
- {kind: eslint-fe, id: no-table-in-card}
|
|
6198
|
+
editions: [lite, full]
|
|
6199
|
+
docs: [contexts/ui/components/list-table.md]
|
|
6200
|
+
templateNa: "A template draws no table in a card; an app adds one with its list screens."
|
|
6201
|
+
proves:
|
|
6202
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_TABLE_IN_CARD]}
|
|
6203
|
+
exemplifiedBy:
|
|
6204
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_TABLE_IN_CARD]}
|
|
6205
|
+
witness:
|
|
6206
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_TABLE_IN_CARD]}
|
|
6207
|
+
cases:
|
|
6208
|
+
- id: case-1
|
|
6209
|
+
date: "2026-11-01"
|
|
6210
|
+
source: owner
|
|
6211
|
+
quote: "quá phức tạp mới nhét bảng vào card"
|
|
6212
|
+
ruling: "Plain rows are a SurfaceListCard with a bottom note in its footer; a DataTable is not put in a SurfaceCard."
|
|
6213
|
+
- id: R352
|
|
6214
|
+
code: "FE_COMMAND_FILLS_HEADER"
|
|
6215
|
+
law: "A page or pane command hugs its label and sits at the end of its header row: a Grammar Button with width=\"fill\" in the actions of a PageHeader or the labelEnd of a SurfaceCard or SurfaceListCard is refused; width=\"fill\" is for a form submit, an auth panel and a phone action bar, which a file cannot show and the rule does not judge."
|
|
6216
|
+
kinds: [lint]
|
|
6217
|
+
gates: [pre-commit, settle, land, ci]
|
|
6218
|
+
failureCodes: ["FE_COMMAND_FILLS_HEADER"]
|
|
6219
|
+
enforcers:
|
|
6220
|
+
- {kind: eslint-fe, id: no-fill-command-in-header}
|
|
6221
|
+
editions: [lite, full]
|
|
6222
|
+
docs: [contexts/ui/components/button.md]
|
|
6223
|
+
templateNa: "A template draws no header command with a fill width."
|
|
6224
|
+
proves:
|
|
6225
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_COMMAND_FILLS_HEADER]}
|
|
6226
|
+
exemplifiedBy:
|
|
6227
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_COMMAND_FILLS_HEADER]}
|
|
6228
|
+
witness:
|
|
6229
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_COMMAND_FILLS_HEADER]}
|
|
6230
|
+
cases:
|
|
6231
|
+
- id: case-1
|
|
6232
|
+
date: "2026-11-01"
|
|
6233
|
+
source: owner
|
|
6234
|
+
quote: "(owner order relayed by the coordinator, 2026-11-01) a page or pane command hugs its label and sits at the end of its header row; Button width=fill is only for a form submit, an auth panel, or a phone action bar"
|
|
6235
|
+
ruling: "A header command is never width fill; fill is for a form submit, an auth panel and a phone action bar."
|
|
6236
|
+
- id: R353
|
|
6237
|
+
code: "FE_TAG_GROUP_SELECTION"
|
|
6238
|
+
law: "A TagGroup holds values the user entered, to remove or to order, and has no selection: selectionMode, selectedIds, defaultSelectedIds and onSelectionChange on it are refused. Peer values that filter a collection that stays in place are a FilterButtonGroup (sm toggle buttons on one row, the rest behind a +n search list)."
|
|
6239
|
+
kinds: [lint]
|
|
6240
|
+
gates: [pre-commit, settle, land, ci]
|
|
6241
|
+
failureCodes: ["FE_TAG_GROUP_SELECTION"]
|
|
6242
|
+
enforcers:
|
|
6243
|
+
- {kind: eslint-fe, id: no-selectable-tag-group}
|
|
6244
|
+
editions: [lite, full]
|
|
6245
|
+
docs: [contexts/ui/components/chip.md]
|
|
6246
|
+
templateNa: "A template draws no filter row."
|
|
6247
|
+
proves:
|
|
6248
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_TAG_GROUP_SELECTION]}
|
|
6249
|
+
exemplifiedBy:
|
|
6250
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_TAG_GROUP_SELECTION]}
|
|
6251
|
+
witness:
|
|
6252
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_TAG_GROUP_SELECTION]}
|
|
6253
|
+
cases:
|
|
6254
|
+
- id: case-1
|
|
6255
|
+
date: "2026-11-01"
|
|
6256
|
+
source: owner
|
|
6257
|
+
quote: "sao cái này không phải cụm button... button size xs kiểu nhóm button"
|
|
6258
|
+
ruling: "A filter over a collection is a FilterButtonGroup of sm toggle buttons; the TagGroup has no selection."
|
|
6259
|
+
- id: R354
|
|
6260
|
+
code: "FE_HEADING_ABOVE_CARD"
|
|
6261
|
+
law: "A card has a label by design, so a hand heading above it is wrong: a SectionHeader directly followed, in the same parent, by one SurfaceCard, SurfaceListCard or SurfaceAccordionCard, and a card whose ariaLabel is the header title, are refused; the title moves to the label, the count to fact, the action to labelEnd and the note to footer. Several cards under one header stay legal."
|
|
6262
|
+
kinds: [lint]
|
|
6263
|
+
gates: [pre-commit, settle, land, ci]
|
|
6264
|
+
failureCodes: ["FE_HEADING_ABOVE_CARD"]
|
|
6265
|
+
enforcers:
|
|
6266
|
+
- {kind: eslint-fe, id: no-heading-above-card}
|
|
6267
|
+
editions: [lite, full]
|
|
6268
|
+
docs: [contexts/ui/components/card.md]
|
|
6269
|
+
templateNa: "A template draws no section header above a card."
|
|
6270
|
+
proves:
|
|
6271
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_HEADING_ABOVE_CARD]}
|
|
6272
|
+
exemplifiedBy:
|
|
6273
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_HEADING_ABOVE_CARD]}
|
|
6274
|
+
witness:
|
|
6275
|
+
- {path: packages/eslint-canon-fe/src/surface-rules.spec.ts, editions: [lite, full], codes: [FE_HEADING_ABOVE_CARD]}
|
|
6276
|
+
cases:
|
|
6277
|
+
- id: case-1
|
|
6278
|
+
date: "2026-11-01"
|
|
6279
|
+
source: owner
|
|
6280
|
+
quote: "bản thân card đã có label, vốn là mục đích thiết kế"
|
|
6281
|
+
ruling: "A card carries its own title, count, action and note; a SectionHeader above a single card is refused."
|