@starci/eslint-grammar-core 0.52.2 → 0.54.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 +9 -0
- package/README.md +8 -14
- package/dist/app-shell.d.ts +0 -11
- package/dist/app-shell.js +2 -190
- package/dist/button-arrow.d.ts +0 -7
- package/dist/button-arrow.js +1 -50
- package/dist/index.d.ts +13 -3
- package/dist/index.js +18 -19
- package/dist/lib/app-shell-scope.d.ts +0 -2
- package/dist/lib/app-shell-scope.js +0 -19
- package/dist/lib/app-shell.d.ts +0 -4
- package/dist/lib/app-shell.js +0 -25
- package/dist/lib/cross-file-inputs.js +2 -3
- package/dist/lib/why.js +5 -65
- package/dist/mascot.d.ts +0 -21
- package/dist/mascot.js +4 -69
- package/dist/no-raw-type-size.d.ts +27 -0
- package/dist/no-raw-type-size.js +107 -0
- package/dist/same-line-size.js +9 -0
- package/dist/table-cell-type.js +4 -0
- package/docs/app-shell.md +1 -37
- package/docs/button-arrow.md +1 -26
- package/docs/mascot.md +6 -34
- package/docs/no-raw-type-size.md +35 -0
- package/docs/rows-in-card.md +1 -1
- package/package.json +3 -3
- package/runtime/knowledge/patterns/fe/ui.yaml +0 -7
- package/runtime/knowledge/ui/composition/app-shell.yaml +4 -4
- package/runtime/knowledge/ui/presentation/grammar-laws.yaml +11 -0
- package/runtime/modules/goal/source-phrases.yaml +0 -4
- package/dist/chip-label.d.ts +0 -14
- package/dist/chip-label.js +0 -117
- package/dist/data-table-surface.d.ts +0 -18
- package/dist/data-table-surface.js +0 -57
- package/dist/lib/app-shell-cluster.d.ts +0 -6
- package/dist/lib/app-shell-cluster.js +0 -75
- package/dist/lib/app-shell-create.d.ts +0 -5
- package/dist/lib/app-shell-create.js +0 -37
- package/dist/lib/app-shell-owner.d.ts +0 -7
- package/dist/lib/app-shell-owner.js +0 -97
- package/dist/lib/status-tones.generated.d.ts +0 -2
- package/dist/lib/status-tones.generated.js +0 -8
- package/dist/message-surfaces.d.ts +0 -6
- package/dist/message-surfaces.js +0 -158
- package/dist/status-colors.d.ts +0 -19
- package/dist/status-colors.js +0 -217
- package/dist/suggestion-buttons.d.ts +0 -6
- package/dist/suggestion-buttons.js +0 -181
- package/dist/surface-card-list.d.ts +0 -20
- package/dist/surface-card-list.js +0 -47
- package/dist/tab-count-chip.d.ts +0 -7
- package/dist/tab-count-chip.js +0 -65
- package/docs/chip-label.md +0 -30
- package/docs/data-table-surface.md +0 -27
- package/docs/message-surfaces.md +0 -37
- package/docs/status-colors.md +0 -43
- package/docs/suggestion-buttons.md +0 -34
- package/docs/surface-card-list.md +0 -33
- package/docs/tab-count-chip.md +0 -26
package/dist/message-surfaces.js
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
2
|
-
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
3
|
-
import { attributeOf, elementOf, grammarBindings, keyName, propertyOf } from "./lib/row-context.js";
|
|
4
|
-
/**
|
|
5
|
-
* The chat surfaces law (`FE_MESSAGE_SURFACES`, Grammar 0.37.31, DNA-COMMON-CHAT-SURFACES): every chat draws the same three faces, and they are Grammar's
|
|
6
|
-
* alone. The thread is the page tone (`--background`), a message of someone else (`MessageBubble` incoming, `MessageCard`) is one outlined look (0.52.0: the
|
|
7
|
-
* 1px `--border` edge, no fill, no shadow), the reader's own message is `--accent` with `--accent-foreground`. An app never restyles them. The law flags, in cheap static shapes only:
|
|
8
|
-
* - a `className`, `class`, `style` or `UNSAFE_className` attribute on a Grammar `MessageBubble` or `MessageCard` (their props carry none; a cast or a
|
|
9
|
-
* spread that smuggles one past the type is still a restyle);
|
|
10
|
-
* - a static class string or a style key in product source that names a Grammar message part (`starci-core-message-bubble…`, `starci-core-message-card…`):
|
|
11
|
-
* an arbitrary-variant utility (`[&_.starci-core-message-bubble-body]:bg-white`) or a selector reaching into the bubble;
|
|
12
|
-
* - a `PaneSection` whose `scroll` object literal states `role: "log"` with `tone: "surface"`: a thread is always the page tone (the Grammar ignores the
|
|
13
|
-
* tone), so the word misleads the reader of the code;
|
|
14
|
-
* - a surface tone on a chat frame (0.37.33, DNA-COMMON-CHAT-FRAME): `surface` on a `Pane` with `content="chat"`, or on a `Pane` whose own children
|
|
15
|
-
* hold a `PaneSection` with `scroll.role: "log"`. A chat frame (head, thread, composer footer) is `--background` wherever it stands; the Grammar ignores
|
|
16
|
-
* the tone there, so the word misleads.
|
|
17
|
-
* A spread, a computed class or a tone held in a variable is not read; a thread drawn by a component of the app's own is not seen through.
|
|
18
|
-
*/
|
|
19
|
-
const MESSAGE_PARTS = /starci-core-message-(?:bubble|card)/;
|
|
20
|
-
const STYLE_ATTRIBUTES = new Set(["className", "class", "style", "UNSAFE_className", "UNSAFE_style"]);
|
|
21
|
-
const FACES = new Set(["MessageBubble", "MessageCard"]);
|
|
22
|
-
/** The static string a literal or a template without expressions holds, or null. */
|
|
23
|
-
const staticString = (node) => {
|
|
24
|
-
if (node.type === "Literal" && typeof node.value === "string")
|
|
25
|
-
return node.value;
|
|
26
|
-
if (node.type === "TemplateLiteral")
|
|
27
|
-
return node.quasis.map((quasi) => quasi.value.cooked ?? "").join(" ");
|
|
28
|
-
return null;
|
|
29
|
-
};
|
|
30
|
-
/** Whether a `scroll` attribute states `role: "log"` in an object literal. */
|
|
31
|
-
const isLogScroll = (opening) => {
|
|
32
|
-
const value = attributeOf(opening, "scroll")?.value;
|
|
33
|
-
if (value?.type !== "JSXExpressionContainer" || value.expression.type !== "ObjectExpression")
|
|
34
|
-
return false;
|
|
35
|
-
const role = propertyOf(value.expression, "role")?.value;
|
|
36
|
-
return role?.type === "Literal" && role.value === "log";
|
|
37
|
-
};
|
|
38
|
-
/** Whether a Pane states `content="chat"`. */
|
|
39
|
-
const isChatContent = (opening) => {
|
|
40
|
-
const value = attributeOf(opening, "content")?.value;
|
|
41
|
-
if (value == null)
|
|
42
|
-
return false;
|
|
43
|
-
if (value.type === "Literal")
|
|
44
|
-
return value.value === "chat";
|
|
45
|
-
return value.type === "JSXExpressionContainer" && value.expression.type === "Literal" && value.expression.value === "chat";
|
|
46
|
-
};
|
|
47
|
-
/** Whether a Pane's own JSX children (a fragment opened) hold a Grammar `PaneSection` thread. */
|
|
48
|
-
const holdsThread = (opening, bound) => {
|
|
49
|
-
const element = opening.parent;
|
|
50
|
-
if (element.type !== "JSXElement")
|
|
51
|
-
return false;
|
|
52
|
-
const walk = (children) => children.some((child) => {
|
|
53
|
-
if (child.type === "JSXFragment")
|
|
54
|
-
return walk(child.children);
|
|
55
|
-
if (child.type !== "JSXElement")
|
|
56
|
-
return false;
|
|
57
|
-
return elementOf(child.openingElement, bound).grammar === "PaneSection" && isLogScroll(child.openingElement);
|
|
58
|
-
});
|
|
59
|
-
return walk(element.children);
|
|
60
|
-
};
|
|
61
|
-
export const messageSurfaces = defineRule({
|
|
62
|
-
meta: {
|
|
63
|
-
type: "problem",
|
|
64
|
-
docs: { description: "FE_MESSAGE_SURFACES: chat bubbles, message cards and the thread ground are Grammar's faces; an app never restyles them." },
|
|
65
|
-
schema: [],
|
|
66
|
-
messages: {
|
|
67
|
-
attribute: "`{{component}}` takes no `{{attribute}}`: every chat draws the same faces (the thread on `--background`, others' messages outlined with no fill, your own `--accent`). Remove it.",
|
|
68
|
-
part: "This class or style reaches into a Grammar message part (`{{part}}`). Chat faces are Grammar's (DNA-COMMON-CHAT-SURFACES); remove the override.",
|
|
69
|
-
tone: "A chat thread (`scroll.role: \"log\"`) is always the page tone; `tone: \"surface\"` is ignored. Remove `tone`.",
|
|
70
|
-
frame: "A chat frame (`Pane content=\"chat\"`, or a Pane that holds a `scroll.role: \"log\"` thread) is `--background` wherever it stands (DNA-COMMON-CHAT-FRAME); `surface` is ignored there. Remove `surface` and give the pane `content=\"chat\"`.",
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
create(context) {
|
|
74
|
-
if (!isProductSource(context))
|
|
75
|
-
return {};
|
|
76
|
-
let bound = new Map();
|
|
77
|
-
const reportPart = (node, text) => {
|
|
78
|
-
const part = MESSAGE_PARTS.exec(text)?.[0];
|
|
79
|
-
if (part !== undefined)
|
|
80
|
-
context.report({ node, messageId: "part", data: { part } });
|
|
81
|
-
};
|
|
82
|
-
return {
|
|
83
|
-
Program(program) {
|
|
84
|
-
bound = grammarBindings(program);
|
|
85
|
-
},
|
|
86
|
-
JSXOpeningElement(opening) {
|
|
87
|
-
const { grammar } = elementOf(opening, bound);
|
|
88
|
-
if (grammar !== null && FACES.has(grammar)) {
|
|
89
|
-
for (const entry of opening.attributes) {
|
|
90
|
-
if (entry.type !== "JSXAttribute" || entry.name.type !== "JSXIdentifier" || !STYLE_ATTRIBUTES.has(entry.name.name))
|
|
91
|
-
continue;
|
|
92
|
-
context.report({ node: entry, messageId: "attribute", data: { component: grammar, attribute: entry.name.name } });
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (grammar === "Pane") {
|
|
96
|
-
const surface = attributeOf(opening, "surface");
|
|
97
|
-
const off = surface?.value?.type === "JSXExpressionContainer" && surface.value.expression.type === "Literal" && surface.value.expression.value === false;
|
|
98
|
-
if (surface !== null && !off && (isChatContent(opening) || holdsThread(opening, bound))) {
|
|
99
|
-
context.report({ node: surface, messageId: "frame" });
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (grammar === "PaneSection") {
|
|
103
|
-
const value = attributeOf(opening, "scroll")?.value;
|
|
104
|
-
if (value?.type !== "JSXExpressionContainer" || value.expression.type !== "ObjectExpression")
|
|
105
|
-
return;
|
|
106
|
-
const role = propertyOf(value.expression, "role")?.value;
|
|
107
|
-
const tone = propertyOf(value.expression, "tone");
|
|
108
|
-
if (role?.type === "Literal" && role.value === "log" && tone?.value.type === "Literal" && tone.value.value === "surface") {
|
|
109
|
-
context.report({ node: tone, messageId: "tone" });
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
JSXAttribute(attribute) {
|
|
114
|
-
if (attribute.name.type !== "JSXIdentifier" || !STYLE_ATTRIBUTES.has(attribute.name.name) || attribute.value == null)
|
|
115
|
-
return;
|
|
116
|
-
if (attribute.value.type === "Literal") {
|
|
117
|
-
if (typeof attribute.value.value === "string")
|
|
118
|
-
reportPart(attribute.value, attribute.value.value);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
if (attribute.value.type !== "JSXExpressionContainer")
|
|
122
|
-
return;
|
|
123
|
-
const expression = attribute.value.expression;
|
|
124
|
-
const text = staticString(expression);
|
|
125
|
-
if (text !== null) {
|
|
126
|
-
reportPart(expression, text);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
if (expression.type === "ObjectExpression") {
|
|
130
|
-
for (const property of expression.properties) {
|
|
131
|
-
if (property.type !== "Property")
|
|
132
|
-
continue;
|
|
133
|
-
const key = keyName(property);
|
|
134
|
-
if (key !== null)
|
|
135
|
-
reportPart(property, key);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
CallExpression(call) {
|
|
140
|
-
// a class builder (`cn(...)`, `clsx(...)`): its static string arguments are class strings
|
|
141
|
-
if (call.callee.type !== "Identifier" || !/^(cn|clsx|cx|classNames|classnames|twMerge|twJoin)$/.test(call.callee.name))
|
|
142
|
-
return;
|
|
143
|
-
for (const argument of call.arguments) {
|
|
144
|
-
const text = staticString(argument);
|
|
145
|
-
if (text !== null)
|
|
146
|
-
reportPart(argument, text);
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
/** The rules this law contributes to the plugin. */
|
|
153
|
-
export const rules = {
|
|
154
|
-
"message-surfaces": messageSurfaces,
|
|
155
|
-
};
|
|
156
|
-
defineFamilyRules(rules, "knowledge/ui/presentation/grammar-laws.yaml#MESSAGE-SURFACES");
|
|
157
|
-
/** Every rule of this law is an error. */
|
|
158
|
-
export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, "error"]));
|
package/dist/status-colors.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Rule } from "eslint";
|
|
2
|
-
type PaintedClass = {
|
|
3
|
-
token: string;
|
|
4
|
-
family: string;
|
|
5
|
-
tone: string;
|
|
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. */
|
|
14
|
-
export declare const statusTextUsesSoftForeground: Rule.RuleModule;
|
|
15
|
-
/** The rules this law contributes to the plugin. */
|
|
16
|
-
export declare const rules: Record<string, Rule.RuleModule>;
|
|
17
|
-
/** Every rule of this law is an error. */
|
|
18
|
-
export declare const recommended: Record<string, "error">;
|
|
19
|
-
export {};
|
package/dist/status-colors.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
2
|
-
/**
|
|
3
|
-
* The rule that holds `status-colors.md` (HFS R61 `FE_STYLE_TOKEN_ONLY`, the status-pair rule for class names; no gate
|
|
4
|
-
* judges the colours an app's theme gives the pair).
|
|
5
|
-
*
|
|
6
|
-
* A STATUS TONE x PAINTS IN TWO WAYS. 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`.
|
|
9
|
-
*
|
|
10
|
-
* WHAT IT READS. Every static class string a component writes: the `className` / `class` attribute of an element (through
|
|
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:
|
|
14
|
-
*
|
|
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 they stay
|
|
23
|
-
* 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`).
|
|
29
|
-
*/
|
|
30
|
-
import { attributeValue } from "@starci/eslint-canon-fe/lib/ast.mjs";
|
|
31
|
-
import { STATUS_TONES } from "./lib/status-tones.generated.js";
|
|
32
|
-
/** The utility families that paint text, an icon or a text decoration. */
|
|
33
|
-
const TEXT_PAINT = ["text", "fill", "stroke", "decoration"];
|
|
34
|
-
/** An optional opacity suffix: `/60` or `/[.4]`. */
|
|
35
|
-
const OPACITY = "(?:/(?:\\d+|\\[[^\\]]*\\]))?";
|
|
36
|
-
/** `text-success`, `text-success/60`, `text-success-hover`, with an optional `!` and any variants before it. */
|
|
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}$`);
|
|
42
|
-
/** The class after its variants: `md:hover:text-success` and `[&>svg]:text-success` both end at `text-success`. */
|
|
43
|
-
const utilityOf = (token) => {
|
|
44
|
-
let depth = 0;
|
|
45
|
-
let cut = -1;
|
|
46
|
-
for (let i = 0; i < token.length; i += 1) {
|
|
47
|
-
if (token[i] === "[")
|
|
48
|
-
depth += 1;
|
|
49
|
-
else if (token[i] === "]")
|
|
50
|
-
depth -= 1;
|
|
51
|
-
else if (token[i] === ":" && depth === 0)
|
|
52
|
-
cut = i;
|
|
53
|
-
}
|
|
54
|
-
return token.slice(cut + 1);
|
|
55
|
-
};
|
|
56
|
-
/** Every class of one class string that the pattern reads, as `{ token, family, tone }`. */
|
|
57
|
-
const paintedClasses = (text, pattern) => text
|
|
58
|
-
.split(/\s+/)
|
|
59
|
-
.filter(Boolean)
|
|
60
|
-
.flatMap((token) => {
|
|
61
|
-
const match = pattern.exec(utilityOf(token));
|
|
62
|
-
const family = match?.[1];
|
|
63
|
-
const tone = match?.[2];
|
|
64
|
-
return family !== undefined && tone !== undefined ? [{ token, family, tone }] : [];
|
|
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
|
-
});
|
|
78
|
-
/** The string nodes inside an expression that builds a class string: literals, template text, keys, and everything a call, array or condition carries. */
|
|
79
|
-
function* stringNodes(node) {
|
|
80
|
-
if (!node || typeof node.type !== "string")
|
|
81
|
-
return;
|
|
82
|
-
switch (node.type) {
|
|
83
|
-
case "Literal":
|
|
84
|
-
if (typeof node.value === "string")
|
|
85
|
-
yield { node, text: node.value };
|
|
86
|
-
return;
|
|
87
|
-
case "TemplateLiteral":
|
|
88
|
-
yield { node, text: node.quasis.map((quasi) => quasi.value.cooked ?? "").join(" ") };
|
|
89
|
-
return;
|
|
90
|
-
case "JSXExpressionContainer":
|
|
91
|
-
yield* stringNodes(node.expression);
|
|
92
|
-
return;
|
|
93
|
-
case "ConditionalExpression":
|
|
94
|
-
yield* stringNodes(node.consequent);
|
|
95
|
-
yield* stringNodes(node.alternate);
|
|
96
|
-
return;
|
|
97
|
-
case "LogicalExpression":
|
|
98
|
-
yield* stringNodes(node.left);
|
|
99
|
-
yield* stringNodes(node.right);
|
|
100
|
-
return;
|
|
101
|
-
case "TSAsExpression":
|
|
102
|
-
case "TSSatisfiesExpression":
|
|
103
|
-
case "TSNonNullExpression":
|
|
104
|
-
yield* stringNodes(node.expression);
|
|
105
|
-
return;
|
|
106
|
-
case "ArrayExpression":
|
|
107
|
-
for (const element of node.elements)
|
|
108
|
-
yield* stringNodes(element);
|
|
109
|
-
return;
|
|
110
|
-
case "CallExpression":
|
|
111
|
-
for (const argument of node.arguments)
|
|
112
|
-
yield* stringNodes(argument);
|
|
113
|
-
return;
|
|
114
|
-
case "ObjectExpression":
|
|
115
|
-
for (const property of node.properties) {
|
|
116
|
-
if (property.type !== "Property")
|
|
117
|
-
continue;
|
|
118
|
-
if (!property.computed && property.key.type === "Literal")
|
|
119
|
-
yield* stringNodes(property.key);
|
|
120
|
-
yield* stringNodes(property.value);
|
|
121
|
-
}
|
|
122
|
-
return;
|
|
123
|
-
default:
|
|
124
|
-
}
|
|
125
|
-
}
|
|
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. */
|
|
157
|
-
export const statusTextUsesSoftForeground = defineRule({
|
|
158
|
-
meta: {
|
|
159
|
-
type: "problem",
|
|
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." },
|
|
161
|
-
schema: [],
|
|
162
|
-
messages: {
|
|
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.",
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
create(context) {
|
|
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, so the lone soft foreground is not judged there.
|
|
170
|
-
const aloneJudged = grammarOf(context.settings) !== "offset-pop";
|
|
171
|
-
const seen = new Set();
|
|
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) {
|
|
175
|
-
for (const { token, family, tone } of solidTextClasses(text))
|
|
176
|
-
if (tints.has(tone))
|
|
177
|
-
context.report({ node, messageId: "onTint", data: { token, family, tone } });
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
const check = (root) => {
|
|
181
|
-
const strings = fresh(stringNodes(root));
|
|
182
|
-
reportOnTint(strings, tintsOf(strings));
|
|
183
|
-
};
|
|
184
|
-
return {
|
|
185
|
-
JSXAttribute(node) {
|
|
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
|
-
}
|
|
200
|
-
},
|
|
201
|
-
VariableDeclarator(node) {
|
|
202
|
-
check(node.init);
|
|
203
|
-
},
|
|
204
|
-
Property(node) {
|
|
205
|
-
if (!node.computed && node.key.type === "Identifier" && node.key.name === "classes")
|
|
206
|
-
check(node.value);
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
},
|
|
210
|
-
});
|
|
211
|
-
/** The rules this law contributes to the plugin. */
|
|
212
|
-
export const rules = {
|
|
213
|
-
"status-text-uses-soft-foreground": statusTextUsesSoftForeground,
|
|
214
|
-
};
|
|
215
|
-
defineFamilyRules(rules, "knowledge/hfs/rules.yaml#R61");
|
|
216
|
-
/** Every rule of this law is an error. */
|
|
217
|
-
export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, "error"]));
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Rule } from "eslint";
|
|
2
|
-
export declare const suggestionButtons: Rule.RuleModule;
|
|
3
|
-
/** The rules this law contributes to the plugin. */
|
|
4
|
-
export declare const rules: Record<string, Rule.RuleModule>;
|
|
5
|
-
/** Every rule of this law is an error. */
|
|
6
|
-
export declare const recommended: Record<string, "error">;
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
2
|
-
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
3
|
-
import { renderedChildren } from "./lib/grammar-jsx.js";
|
|
4
|
-
import { attributeOf, elementOf, grammarBindings, literalAttribute } from "./lib/row-context.js";
|
|
5
|
-
/**
|
|
6
|
-
* The suggestion buttons law (`FE_SUGGESTION_BUTTONS`): suggestions, quick replies and empty-state shortcuts have ONE pattern,
|
|
7
|
-
* a `Cluster gap="inline"` of neutral `Button size="sm"` (every Button size draws a pill). The law flags the ALTERNATIVES
|
|
8
|
-
* drawn as suggestions, in cheap static shapes only:
|
|
9
|
-
* - a row (two or more siblings, or one drawn by a `.map`) of Grammar `Link`s whose `onFollow` or `onPress` is an inline arrow
|
|
10
|
-
* that passes the Link's own label (`{q}` and `send(q)`, `{item.label}` and `ask(item.label)`, or an equal string literal)
|
|
11
|
-
* and whose `href` is absent or `"#"`;
|
|
12
|
-
* - a Grammar `ChoiceChips` whose `onValueChange` is an inline arrow that calls something that is not a state setter with the
|
|
13
|
-
* value, or is a bare send-like function (`send`, `ask`, `submit`, `reply`, `post`, `dispatch`): it sends the choice instead
|
|
14
|
-
* of keeping it selected;
|
|
15
|
-
* - a HeroUI `Chip` (imported from `@heroui/react`) with an `onPress` or `onClick` that passes its own label. Grammar `Badge`
|
|
16
|
-
* takes no action prop and Grammar `TagGroup` only `onRemove(ids)`/`onReorder(ids)`, so neither can send its own label.
|
|
17
|
-
* A spread, a computed prop, a handler that is not readable, a callee named `set*`, `on*`, `handle*` or `update*` is not flagged.
|
|
18
|
-
*/
|
|
19
|
-
const PARENTS = new Set(["Cluster", "Stack"]);
|
|
20
|
-
const SENDERS = /^(send|ask|submit|reply|post|dispatch)/;
|
|
21
|
-
const NOT_SENDING = /^(set[A-Z]|on[A-Z]|handle|update)/;
|
|
22
|
-
/** The single expression or text an element states as its label: `{q}` as the node `q`, text as its string. */
|
|
23
|
-
const labelOf = (element) => {
|
|
24
|
-
const children = element.children.filter((child) => !(child.type === "JSXText" && child.value.trim() === ""));
|
|
25
|
-
if (children.length !== 1)
|
|
26
|
-
return null;
|
|
27
|
-
const child = children[0];
|
|
28
|
-
if (child.type === "JSXText")
|
|
29
|
-
return { text: child.value.trim() };
|
|
30
|
-
if (child.type !== "JSXExpressionContainer" || child.expression.type === "JSXEmptyExpression")
|
|
31
|
-
return null;
|
|
32
|
-
if (child.expression.type === "Literal" && typeof child.expression.value === "string")
|
|
33
|
-
return { text: child.expression.value };
|
|
34
|
-
return { node: child.expression };
|
|
35
|
-
};
|
|
36
|
-
/** The one call an inline arrow makes, or null. */
|
|
37
|
-
const callOf = (handler) => {
|
|
38
|
-
let body = handler.body;
|
|
39
|
-
if (body.type === "BlockStatement") {
|
|
40
|
-
const only = body.body.length === 1 ? body.body[0] : undefined;
|
|
41
|
-
body = only?.type === "ExpressionStatement" ? only.expression : null;
|
|
42
|
-
}
|
|
43
|
-
return body !== null && body.type === "CallExpression" ? body : null;
|
|
44
|
-
};
|
|
45
|
-
/** The last name of a callee (`send`, `chat.send` as `send`), or null. */
|
|
46
|
-
const calleeName = (callee) => {
|
|
47
|
-
if (callee.type === "Identifier")
|
|
48
|
-
return callee.name;
|
|
49
|
-
if (callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier")
|
|
50
|
-
return callee.property.name;
|
|
51
|
-
return null;
|
|
52
|
-
};
|
|
53
|
-
/** The inline arrow an attribute holds, or null. */
|
|
54
|
-
const arrowOf = (opening, name) => {
|
|
55
|
-
const value = attributeOf(opening, name)?.value;
|
|
56
|
-
if (value == null || value.type !== "JSXExpressionContainer" || value.expression.type !== "ArrowFunctionExpression")
|
|
57
|
-
return null;
|
|
58
|
-
return value.expression;
|
|
59
|
-
};
|
|
60
|
-
/** True when an inline handler arrow of the element passes the element's own label. */
|
|
61
|
-
const sendsOwnLabel = (element, names, source) => {
|
|
62
|
-
const label = labelOf(element);
|
|
63
|
-
if (label === null)
|
|
64
|
-
return false;
|
|
65
|
-
return names.some((name) => {
|
|
66
|
-
const handler = arrowOf(element.openingElement, name);
|
|
67
|
-
const call = handler === null ? null : callOf(handler);
|
|
68
|
-
if (call === null)
|
|
69
|
-
return false;
|
|
70
|
-
return call.arguments.some((arg) => ("text" in label ? arg.type === "Literal" && arg.value === label.text : arg.type !== "Literal" && source.getText(arg) === source.getText(label.node)));
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
/** True when an element sits inside a `.map` callback below its parent. */
|
|
74
|
-
const inMap = (element, parent) => {
|
|
75
|
-
for (let node = element.parent; node !== undefined && node !== parent; node = node.parent) {
|
|
76
|
-
if (node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression")
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
return false;
|
|
80
|
-
};
|
|
81
|
-
/** The HeroUI `Chip` local names a file imports from `@heroui/react`. */
|
|
82
|
-
const heroChips = (program) => {
|
|
83
|
-
const names = new Set();
|
|
84
|
-
for (const statement of program.body) {
|
|
85
|
-
if (statement.type !== "ImportDeclaration" || statement.source.value !== "@heroui/react")
|
|
86
|
-
continue;
|
|
87
|
-
for (const specifier of statement.specifiers) {
|
|
88
|
-
if (specifier.type === "ImportSpecifier" && specifier.imported.type === "Identifier" && specifier.imported.name === "Chip")
|
|
89
|
-
names.add(specifier.local.name);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return names;
|
|
93
|
-
};
|
|
94
|
-
export const suggestionButtons = defineRule({
|
|
95
|
-
meta: {
|
|
96
|
-
type: "problem",
|
|
97
|
-
docs: { description: "FE_SUGGESTION_BUTTONS: suggestions and quick replies are a Cluster of neutral sm Buttons, not Links, ChoiceChips or Chips." },
|
|
98
|
-
schema: [],
|
|
99
|
-
messages: {
|
|
100
|
-
element: "Suggestions and quick replies have one pattern: a `Cluster gap=\"inline\"` of neutral `Button size=\"sm\"` (a pill). {{element}} here runs an action or sends its own label; draw it as a Button.",
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
create(context) {
|
|
104
|
-
if (!isProductSource(context))
|
|
105
|
-
return {};
|
|
106
|
-
let bound = new Map();
|
|
107
|
-
let chips = new Set();
|
|
108
|
-
const source = context.sourceCode;
|
|
109
|
-
/** A Grammar Link that passes its own label and goes nowhere. */
|
|
110
|
-
const isLinkSuggestion = (node) => {
|
|
111
|
-
if (node.type !== "JSXElement")
|
|
112
|
-
return false;
|
|
113
|
-
const opening = node.openingElement;
|
|
114
|
-
if (elementOf(opening, bound).grammar !== "Link")
|
|
115
|
-
return false;
|
|
116
|
-
if (opening.attributes.some((entry) => entry.type === "JSXSpreadAttribute"))
|
|
117
|
-
return false;
|
|
118
|
-
if (attributeOf(opening, "href") !== null && literalAttribute(opening, "href") !== "#")
|
|
119
|
-
return false;
|
|
120
|
-
return sendsOwnLabel(node, ["onFollow", "onPress"], source);
|
|
121
|
-
};
|
|
122
|
-
return {
|
|
123
|
-
Program(program) {
|
|
124
|
-
bound = grammarBindings(program);
|
|
125
|
-
chips = heroChips(program);
|
|
126
|
-
},
|
|
127
|
-
JSXElement(element) {
|
|
128
|
-
const opening = element.openingElement;
|
|
129
|
-
const { grammar, tag } = elementOf(opening, bound);
|
|
130
|
-
const report = (name) => context.report({ node: opening, messageId: "element", data: { element: name } });
|
|
131
|
-
if (grammar === "ChoiceChips" || grammar === "ChoiceButtons") {
|
|
132
|
-
if (opening.attributes.some((entry) => entry.type === "JSXSpreadAttribute"))
|
|
133
|
-
return;
|
|
134
|
-
const value = attributeOf(opening, "onValueChange")?.value;
|
|
135
|
-
if (value == null || value.type !== "JSXExpressionContainer")
|
|
136
|
-
return;
|
|
137
|
-
const handler = value.expression;
|
|
138
|
-
if (handler.type === "Identifier" || handler.type === "MemberExpression") {
|
|
139
|
-
const name = calleeName(handler);
|
|
140
|
-
if (name !== null && SENDERS.test(name) && !NOT_SENDING.test(name))
|
|
141
|
-
report(`\`${grammar}\``);
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (handler.type !== "ArrowFunctionExpression")
|
|
145
|
-
return;
|
|
146
|
-
const param = handler.params[0];
|
|
147
|
-
const call = callOf(handler);
|
|
148
|
-
if (param?.type !== "Identifier" || call === null)
|
|
149
|
-
return;
|
|
150
|
-
const name = calleeName(call.callee);
|
|
151
|
-
if (name === null || NOT_SENDING.test(name))
|
|
152
|
-
return;
|
|
153
|
-
if (call.arguments.some((arg) => arg.type === "Identifier" && arg.name === param.name))
|
|
154
|
-
report(`\`${grammar}\``);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (grammar === null && tag === null && opening.name.type === "JSXIdentifier" && chips.has(opening.name.name)) {
|
|
158
|
-
if (opening.attributes.some((entry) => entry.type === "JSXSpreadAttribute"))
|
|
159
|
-
return;
|
|
160
|
-
if (sendsOwnLabel(element, ["onPress", "onClick"], source))
|
|
161
|
-
report("`Chip`");
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (!(grammar !== null && PARENTS.has(grammar)) && tag !== "div")
|
|
165
|
-
return;
|
|
166
|
-
const found = renderedChildren(element.children).filter(isLinkSuggestion);
|
|
167
|
-
if (found.length < 2 && !found.some((entry) => inMap(entry, element)))
|
|
168
|
-
return;
|
|
169
|
-
for (const entry of found)
|
|
170
|
-
context.report({ node: entry.openingElement, messageId: "element", data: { element: "`Link`" } });
|
|
171
|
-
},
|
|
172
|
-
};
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
/** The rules this law contributes to the plugin. */
|
|
176
|
-
export const rules = {
|
|
177
|
-
"suggestion-buttons": suggestionButtons,
|
|
178
|
-
};
|
|
179
|
-
defineFamilyRules(rules, "knowledge/ui/presentation/grammar-laws.yaml#SUGGESTION-BUTTONS");
|
|
180
|
-
/** Every rule of this law is an error. */
|
|
181
|
-
export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, "error"]));
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Rule } from "eslint";
|
|
2
|
-
/**
|
|
3
|
-
* ONE LOOK FOR A LIST (owner, 2026-11-17, LIST-ONE-LOOK). A list is one thing: `Section kind="list"` of `ListRow`s, plain rows on the
|
|
4
|
-
* surface divided by hairlines and aligned with the section title, with no frame, fill, radius or shadow. A list is never a card;
|
|
5
|
-
* cards stay for real objects. The Grammar family 0.43.0 removed `SurfaceCard kind="list"`, so the compiler refuses it where the types
|
|
6
|
-
* are read; this rule says how to fix it where an app still writes it (a pinned older Grammar, a JavaScript file, an `any` prop).
|
|
7
|
-
*
|
|
8
|
-
* WHAT IT READS. In product source, a Grammar `SurfaceCard` (named or `G.SurfaceCard`) whose `kind` is the literal `"list"`.
|
|
9
|
-
*
|
|
10
|
-
* WHAT IT LEAVES ALONE. A `kind` that is not a literal, another source's `SurfaceCard`, and non-product source.
|
|
11
|
-
*
|
|
12
|
-
* NO AUTOFIX. The move is not one rename: `label` becomes `title`, `labelEnd` becomes `action`, a card's filter or search is the list's `filter`,
|
|
13
|
-
* the import changes, and the look changes from a card to flat rows, which the author should see.
|
|
14
|
-
*/
|
|
15
|
-
/** `SurfaceCard kind="list"` is refused: the list is `Section kind="list"`. */
|
|
16
|
-
export declare const surfaceCardList: Rule.RuleModule;
|
|
17
|
-
/** The rules this law contributes to the plugin. */
|
|
18
|
-
export declare const rules: Record<string, Rule.RuleModule>;
|
|
19
|
-
/** Every rule of this law is an error. */
|
|
20
|
-
export declare const recommended: Record<string, "error">;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { isProductSource } from "@starci/eslint-canon-fe/lib/scope.mjs";
|
|
2
|
-
import { grammarName, stringProp } from "./lib/grammar-jsx.js";
|
|
3
|
-
import { defineFamilyRules, defineRule } from "./lib/rule-contract.js";
|
|
4
|
-
/**
|
|
5
|
-
* ONE LOOK FOR A LIST (owner, 2026-11-17, LIST-ONE-LOOK). A list is one thing: `Section kind="list"` of `ListRow`s, plain rows on the
|
|
6
|
-
* surface divided by hairlines and aligned with the section title, with no frame, fill, radius or shadow. A list is never a card;
|
|
7
|
-
* cards stay for real objects. The Grammar family 0.43.0 removed `SurfaceCard kind="list"`, so the compiler refuses it where the types
|
|
8
|
-
* are read; this rule says how to fix it where an app still writes it (a pinned older Grammar, a JavaScript file, an `any` prop).
|
|
9
|
-
*
|
|
10
|
-
* WHAT IT READS. In product source, a Grammar `SurfaceCard` (named or `G.SurfaceCard`) whose `kind` is the literal `"list"`.
|
|
11
|
-
*
|
|
12
|
-
* WHAT IT LEAVES ALONE. A `kind` that is not a literal, another source's `SurfaceCard`, and non-product source.
|
|
13
|
-
*
|
|
14
|
-
* NO AUTOFIX. The move is not one rename: `label` becomes `title`, `labelEnd` becomes `action`, a card's filter or search is the list's `filter`,
|
|
15
|
-
* the import changes, and the look changes from a card to flat rows, which the author should see.
|
|
16
|
-
*/
|
|
17
|
-
/** `SurfaceCard kind="list"` is refused: the list is `Section kind="list"`. */
|
|
18
|
-
export const surfaceCardList = defineRule({
|
|
19
|
-
meta: {
|
|
20
|
-
type: "problem",
|
|
21
|
-
docs: { description: "LIST-ONE-LOOK: a list is `Section kind=\"list\"` with `ListRow` rows, never `SurfaceCard kind=\"list\"` (removed in the Grammar family 0.43.0)." },
|
|
22
|
-
schema: [],
|
|
23
|
-
messages: {
|
|
24
|
-
list: "`SurfaceCard kind=\"list\"` is removed: a list is never a card. Use `<Section kind=\"list\" title=\"…\" items={rows} empty={…} />` with `ListRow` rows (flat rows divided by hairlines, aligned with the title): `label` becomes `title`, `labelEnd` becomes `action`, a filter or search goes in the list's `filter`, and `layout=\"keyValue\" | \"suggestions\"` stays on the Section.",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
create(context) {
|
|
28
|
-
if (!isProductSource(context))
|
|
29
|
-
return {};
|
|
30
|
-
return {
|
|
31
|
-
JSXOpeningElement(opening) {
|
|
32
|
-
if (grammarName(context, opening) !== "SurfaceCard")
|
|
33
|
-
return;
|
|
34
|
-
if (stringProp(opening, "kind") !== "list")
|
|
35
|
-
return;
|
|
36
|
-
context.report({ node: opening, messageId: "list" });
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
/** The rules this law contributes to the plugin. */
|
|
42
|
-
export const rules = {
|
|
43
|
-
"surface-card-list": surfaceCardList,
|
|
44
|
-
};
|
|
45
|
-
defineFamilyRules(rules, "knowledge/ui/presentation/grammar-laws.yaml#LIST-ONE-LOOK");
|
|
46
|
-
/** Every rule of this law is an error. */
|
|
47
|
-
export const recommended = Object.fromEntries(Object.keys(rules).map((name) => [`starci-grammar/${name}`, "error"]));
|