@actioneer/ads-lint 1.0.65 → 1.0.67

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/README.md CHANGED
@@ -10,8 +10,10 @@ isn't — so it works in a fresh repo before `npm i`.
10
10
 
11
11
  ## Install it at the same version as `@actioneer/ads`
12
12
 
13
- The linter ships with every ADS release, at the same version number. Install
14
- and update the two together:
13
+ From 1.0.67 the linter ships **inside** `@actioneer/ads`: run `npx ads lint`
14
+ (same flags as below) and there is nothing else to install. This package keeps
15
+ publishing the same code at the same version for projects that already use
16
+ `ads-lint`; install it at your `@actioneer/ads` version:
15
17
 
16
18
  ```bash
17
19
  npm install -D @actioneer/ads-lint@<your @actioneer/ads version>
@@ -29,13 +31,13 @@ error (`versionCheck: false` in the config turns this off for a deliberate pin).
29
31
  | `deep-import` — reaching past the barrel (`@actioneer/ads/button`) | error | P7 |
30
32
  | `barrel-default-import` / `-namespace-import` / `-aliased-import` | error | P7 |
31
33
  | `icon-package-import` — importing Phosphor or another icon package outside the registry | error | P4 icons |
32
- | `hardcoded-hex` — a raw `#rrggbb` in code | error | tokens-only |
34
+ | `hardcoded-hex` — a raw `#rrggbb` in code (not in comments: "PR #836" is not a color) | error | tokens-only |
33
35
  | `arbitrary-color` — `bg-[#fff]` / `text-[rgb(...)]` | error | tokens-only |
34
36
  | `arbitrary-dimension` — `w-[13px]` / `gap-[1.5rem]` | warn | tokens-only |
35
37
  | Motion: `unbounded-transition`, `sluggish-easing`, `zero-scale-entrance`, `undersized-zoom-entrance`, `legacy-motion-token`, `raw-spring-config`, `layout-property-transition`, `layout-keyframe-disclosure` | error | P3 motion |
36
38
  | Tables: `table-column-icon` (any `icon=` but `{null}`/`{undefined}`, or a glyph child), `table-cell-stacked` (`<br>`, a `flex-col`/`grid`/`space-y-*` stack of two, two children one of them block-level, an `<Avatar>`), `table-pagination` ("Page N of", "Rows per page", Previous + Next, "Next page" after a `Table`), plus the actions-column and record-name rules | error | tables |
37
39
  | Collections: `collection-toolbar-missing` (a search/filter row or a header Search button with no `CollectionToolbar`), `search-full-width` (a full-width field typed search, led by the Search glyph, or labelled "Search…"), `page-content-top-padding` (class or `style` top spacing on the content or its first wrapper; a toolbar with no gap under an `mb-0` header) | error | P11, collection screens |
38
- | Recipes: `call-panel-hand-rolled` (a Drawer with a Transcript or AudioWaveform — use `CallPanel`), `filter-menu-hand-rolled` (a Popover of Checkboxes — use the column filter or `Filters`), `filter-chip-clear-button` (a Chip with its own clear button — use `Chip onClose`), `script-opening-line-hand-rolled` (use `ScriptOpeningLine`), `script-character-limit` ("893 / 2,000,000 chars") | error | screen recipes |
40
+ | Recipes: `call-panel-hand-rolled` (a Drawer with a Transcript or AudioWaveform — use `CallPanel`), `filter-menu-hand-rolled` (a Popover of Checkboxes — use the column filter or `Filters`), `filter-chip-clear-button` (a Chip with its own clear button — use `Chip onClose`), `script-opening-line-hand-rolled` (use `ScriptOpeningLine`), `script-character-limit` ("893 / 2,000,000 chars"), `script-ai-review-hand-rolled` (a hand-drawn `<del>`/`<ins>` review — use `ScriptEditor mode="review"` + `ScriptReviewBar`), `script-ask-hand-rolled` (use `ScriptAskBar`) | error | screen recipes |
39
41
  | `ads-lint-stale` — this linter is older than the installed `@actioneer/ads` | error | release lockstep |
40
42
  | `collection-toolbar-icon-action` — an icon-only `Button` / `TooltipIconButton` in `CollectionToolbar actions` that is not `SearchDisclosure`, `Filters` or `TableColumnsMenu` (a setting such as Caller numbers is a labelled header button) | error | collection screens, workspace setting modals |
41
43
  | `modal-footer-done` — a `ModalFooter` whose only action is a `Button` (or `ModalClose`) labelled Done, Close, OK or Got it | error | workspace setting modals |
@@ -47,7 +49,8 @@ error (`versionCheck: false` in the config turns this off for a deliberate pin).
47
49
  | `shadow-static-surface` — `shadow-card` on a `div`/`section`/`Card` nobody can press (no `onClick`, `href`, `isPressable`, `role="button"`) | error | elevation |
48
50
  | `selected-edge-action` — a strong `border`/`ring`/`outline` on a selection prefix (`aria-selected:`, `data-[state=on]:` …) or in a `selected ? "…"` / `isActive && "…"` class | error | selection |
49
51
  | `insight-findings-hand-rolled` (a "What changed" heading without `InsightFindings`), `insight-finding-action` (a button or link inside `InsightFindings`), `monitor-outcome-grid` ("Outcome distribution", an outcomes-by-day table) | error | charts, P15 Program dashboard |
50
- | `chart-dual-axis` (any `dualAxis` but `{false}`), `export-button-no-icon` (`Export`, `{"Export"}`, `{t("export")}`, "Download CSV"), `empty-state-no-description` (missing or empty) | error | charts, P8 |
52
+ | `chart-dual-axis` (any `dualAxis` but `{false}`), `export-button-no-icon` (`Export`, `{"Export"}`, `{t("export")}`, "Download CSV"), `empty-state-no-description` (missing or empty), `link-underline` (`underline` / `hover:underline` on an `<a>`, `<Link>` or `<button>`) | error | charts, P4, P8 |
53
+ | `ads-internal-override` (`[&_[data-slot=…]]`, `[&>[data-slot=…]]` restyling an ADS component from outside; `overrides.allow` exempts the library itself) | error | P7 |
51
54
  | Screen kinds: every rule of the declared kind (`screen-collection-…`, `screen-monitor-…` — order, required parts, forbidden parts, one hero, charts in `ChartCard`), `screen-kind-unknown`, and `screen-kind-missing` (warn: a `BodyPageHeader` screen with a `Table`, `StatStrip` or `ChartCard` that never declares its kind). The rules are generated from `@actioneer/ads`'s `SCREEN_KINDS`, the same rules `AdsScreen` checks at runtime | error / warn | P16, screen kinds |
52
55
 
53
56
  Errors fail the run (exit 1); warnings don't unless `--strict`.
package/bin/ads-lint.mjs CHANGED
@@ -12,67 +12,6 @@
12
12
  // Config: ads-lint.config.mjs at the repo root (deep-merged over defaults).
13
13
 
14
14
  import process from "node:process";
15
- import { loadConfig } from "../src/config.mjs";
16
- import { resolveFiles, lintFiles, formatFindings } from "../src/runner.mjs";
17
- import { staleLinterFinding } from "../src/version-check.mjs";
15
+ import { runLint } from "../src/cli.mjs";
18
16
 
19
- function parseArgs(argv) {
20
- const opts = { files: [], staged: false, diff: null, all: false, strict: false, quiet: false };
21
- for (let i = 0; i < argv.length; i++) {
22
- const a = argv[i];
23
- if (a === "--staged") opts.staged = true;
24
- else if (a === "--all") opts.all = true;
25
- else if (a === "--strict") opts.strict = true;
26
- else if (a === "--quiet") opts.quiet = true;
27
- else if (a === "--diff") opts.diff = argv[++i];
28
- else if (a === "-h" || a === "--help") opts.help = true;
29
- else if (a.startsWith("-")) {
30
- console.error(`ads-lint: unknown flag ${a}`);
31
- process.exit(2);
32
- } else opts.files.push(a);
33
- }
34
- return opts;
35
- }
36
-
37
- const HELP = `ads-lint — Actioneer Design System linter
38
-
39
- ads-lint [files...] Lint the given files
40
- ads-lint --staged Lint files staged for commit
41
- ads-lint --diff <ref> Lint files changed vs <ref> (e.g. origin/main)
42
- ads-lint --all Lint everything under the configured root
43
- ads-lint --strict Fail on warnings too (default: errors only)
44
- ads-lint --quiet Print only the summary line`;
45
-
46
- async function main() {
47
- const opts = parseArgs(process.argv.slice(2));
48
- if (opts.help) {
49
- console.log(HELP);
50
- return 0;
51
- }
52
-
53
- const cwd = process.cwd();
54
- const cfg = await loadConfig(cwd);
55
- const files = resolveFiles(opts, cfg, cwd);
56
- const { findings, fileCount } = lintFiles(files, cfg, cwd);
57
- // An older linter than the installed ADS skips every newer rule: say so first.
58
- const stale = staleLinterFinding(cwd, cfg);
59
- if (stale) findings.unshift(stale);
60
-
61
- const errors = findings.filter((f) => f.severity === "error");
62
- const warns = findings.filter((f) => f.severity === "warn");
63
-
64
- if (findings.length && !opts.quiet) {
65
- console.error(formatFindings(findings));
66
- console.error("");
67
- }
68
-
69
- const summary = `ads-lint: ${fileCount} file(s) · ${errors.length} error(s) · ${warns.length} warning(s)`;
70
- if (errors.length || (opts.strict && warns.length)) {
71
- console.error(summary);
72
- return 1;
73
- }
74
- console.log(summary);
75
- return 0;
76
- }
77
-
78
- main().then((code) => process.exit(code));
17
+ runLint(process.argv.slice(2)).then((code) => process.exit(code));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actioneer/ads-lint",
3
- "version": "1.0.65",
3
+ "version": "1.0.67",
4
4
  "description": "Design linter for the Actioneer Design System (ADS 1.0). Ships in lockstep with @actioneer/ads: install the same version. Flags deviations from ADS principles on changed files.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs ADDED
@@ -0,0 +1,72 @@
1
+ // ads-lint CLI — the command, as a function. Both the ads-lint bin and
2
+ // `npx @actioneer/ads lint` call runLint(argv), so the two never diverge.
3
+
4
+ import process from "node:process";
5
+ import { loadConfig } from "./config.mjs";
6
+ import { resolveFiles, lintFiles, formatFindings } from "./runner.mjs";
7
+ import { staleLinterFinding } from "./version-check.mjs";
8
+
9
+ function parseArgs(argv) {
10
+ const opts = { files: [], staged: false, diff: null, all: false, strict: false, quiet: false };
11
+ for (let i = 0; i < argv.length; i++) {
12
+ const a = argv[i];
13
+ if (a === "--staged") opts.staged = true;
14
+ else if (a === "--all") opts.all = true;
15
+ else if (a === "--strict") opts.strict = true;
16
+ else if (a === "--quiet") opts.quiet = true;
17
+ else if (a === "--diff") opts.diff = argv[++i];
18
+ else if (a === "-h" || a === "--help") opts.help = true;
19
+ else if (a.startsWith("-")) {
20
+ console.error(`ads-lint: unknown flag ${a}`);
21
+ process.exit(2);
22
+ } else opts.files.push(a);
23
+ }
24
+ return opts;
25
+ }
26
+
27
+ const HELP = `ads-lint — Actioneer Design System linter
28
+
29
+ ads-lint [files...] Lint the given files
30
+ ads-lint --staged Lint files staged for commit
31
+ ads-lint --diff <ref> Lint files changed vs <ref> (e.g. origin/main)
32
+ ads-lint --all Lint everything under the configured root
33
+ ads-lint --strict Fail on warnings too (default: errors only)
34
+ ads-lint --quiet Print only the summary line`;
35
+
36
+ /**
37
+ * Run the linter with CLI arguments (without the program name).
38
+ * @param {string[]} argv
39
+ * @param {{prog?: string}} [opts]
40
+ * @returns {Promise<number>} exit code
41
+ */
42
+ export async function runLint(argv, { prog = "ads-lint" } = {}) {
43
+ const opts = parseArgs(argv);
44
+ if (opts.help) {
45
+ console.log(prog === "ads-lint" ? HELP : HELP.replaceAll("ads-lint ", `${prog} `));
46
+ return 0;
47
+ }
48
+
49
+ const cwd = process.cwd();
50
+ const cfg = await loadConfig(cwd);
51
+ const files = resolveFiles(opts, cfg, cwd);
52
+ const { findings, fileCount } = lintFiles(files, cfg, cwd);
53
+ // An older linter than the installed ADS skips every newer rule: say so first.
54
+ const stale = staleLinterFinding(cwd, cfg);
55
+ if (stale) findings.unshift(stale);
56
+
57
+ const errors = findings.filter((f) => f.severity === "error");
58
+ const warns = findings.filter((f) => f.severity === "warn");
59
+
60
+ if (findings.length && !opts.quiet) {
61
+ console.error(formatFindings(findings));
62
+ console.error("");
63
+ }
64
+
65
+ const summary = `ads-lint: ${fileCount} file(s) · ${errors.length} error(s) · ${warns.length} warning(s)`;
66
+ if (errors.length || (opts.strict && warns.length)) {
67
+ console.error(summary);
68
+ return 1;
69
+ }
70
+ console.log(summary);
71
+ return 0;
72
+ }
package/src/config.mjs CHANGED
@@ -107,6 +107,9 @@ export const DEFAULT_CONFIG = {
107
107
  tableAllow: ["src/components/**"],
108
108
  },
109
109
  buttons: { enabled: true, allow: [] },
110
+ // Restyling an ADS component from outside through its slots (2026-12-01).
111
+ // The library styles its own parts; products never do.
112
+ overrides: { enabled: true, allow: ["src/components/**"] },
110
113
  // Selected items take the subtle T5 edge (border-border-selected).
111
114
  selection: { enabled: true, allow: [] },
112
115
  // shadow-ask is the AskActioneer button's own lift (user-mandated 2026-11-29):
package/src/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  // eventual ESLint bridge). The CLI in bin/ads-lint.mjs is a thin wrapper.
3
3
 
4
4
  export { loadConfig, DEFAULT_CONFIG } from "./config.mjs";
5
- export { resolveFiles, lintFiles, formatFindings } from "./runner.mjs";
5
+ export { resolveFiles, lintFiles, lintSource, RULE_FNS, formatFindings } from "./runner.mjs";
6
6
  export { lintImports } from "./rules/imports.mjs";
7
7
  export { lintMotion } from "./rules/motion.mjs";
8
8
  export { lintLiterals } from "./rules/literals.mjs";
@@ -18,4 +18,5 @@ export { lintControls, CONTROL_RULES } from "./rules/controls.mjs";
18
18
  export { staleLinterFinding, compareVersions, VERSION_RULE } from "./version-check.mjs";
19
19
  export { lintRecipes, RECIPE_RULES } from "./rules/recipes.mjs";
20
20
  export { lintScreens, SCREEN_RULES } from "./rules/screens.mjs";
21
+ export { lintOverrides, OVERRIDE_RULES } from "./rules/overrides.mjs";
21
22
  export { SCREEN_KINDS, validateScreen } from "./screen-grammar.gen.mjs";
@@ -3,6 +3,12 @@
3
3
  // Buttons are text-only by default (principle 8), with one named exception:
4
4
  // an Export action always leads with the Download glyph, so it reads as "this
5
5
  // gives you a file" at a glance and looks the same on every screen.
6
+ //
7
+ // Text links never underline (principle 4; user-reported 2026-11-30 on the
8
+ // Voice campaigns list, where every Journey cell was underlined): a link reads
9
+ // as a bare label that turns teal on hover, like the ADS link Button. A table
10
+ // row's record name doesn't underline either (user-mandated 2026-12-01), so
11
+ // buttons styled as text links are checked too.
6
12
 
7
13
  import { matchesAny } from "../config.mjs";
8
14
 
@@ -13,13 +19,19 @@ export const BUTTON_RULES = [
13
19
  guidance:
14
20
  "Lead every Export button with the Download glyph: `<Button variant=\"outline\" startContent={<Download />}>Export</Button>` (Download from @/lib/icons). On a page it sits in the header bar, with the page's filters to its right.",
15
21
  },
22
+ {
23
+ name: "link-underline",
24
+ severity: "error",
25
+ guidance:
26
+ "Text links never underline (principle 4). Drop `underline` / `hover:underline`: a link is a bare label that turns teal on hover — `text-on-white-primary hover:text-action-primary-text` (or the ADS `Button variant=\"link\"`). A record's name in its own column is `TableRecordName`, which turns teal on hover without an underline (2026-12-01).",
27
+ },
16
28
  ];
17
29
 
18
30
  const RULE = Object.fromEntries(BUTTON_RULES.map((r) => [r.name, r]));
19
31
 
20
- /** Finds each `<Button …>` opening tag, attribute expressions included, and the text after it. */
21
- function* buttonTags(source) {
22
- for (const m of source.matchAll(/<Button\b/g)) {
32
+ /** Finds each `<Button …>` (or other named) opening tag, attribute expressions included, and the text after it. */
33
+ function* buttonTags(source, pattern = /<Button\b/g) {
34
+ for (const m of source.matchAll(pattern)) {
23
35
  let i = m.index + m[0].length;
24
36
  let depth = 0;
25
37
  let quote = null;
@@ -56,9 +68,25 @@ export function lintButtons(relPath, source, cfg) {
56
68
  if (cfg.buttons?.enabled === false) return [];
57
69
  if (matchesAny(relPath, cfg.buttons?.allow ?? [])) return [];
58
70
  if (!/\.(tsx|jsx)$/.test(relPath)) return [];
59
- if (!/<Button\b/.test(source)) return [];
60
-
61
71
  const findings = [];
72
+ // A link styled with an underline: `underline` or any `…:underline` variant,
73
+ // never `no-underline` or `underline-offset-*`.
74
+ for (const { index, tag } of buttonTags(source, /<(?:a|Link|NextLink|button)\b/g)) {
75
+ const cls = tag.match(/\bclassName=(?:"([^"]*)"|\{([\s\S]*?)\}(?=\s|\/?>))/);
76
+ if (!cls) continue;
77
+ const text = cls[1] ?? cls[2] ?? "";
78
+ if (!/(?:^|[\s"'`:])underline(?![-\w])/.test(text.replace(/\bno-underline\b/g, ""))) continue;
79
+ const match = tag.replace(/\s+/g, " ");
80
+ findings.push({
81
+ line: source.slice(0, index).split("\n").length,
82
+ rule: "link-underline",
83
+ severity: RULE["link-underline"].severity,
84
+ match: match.length > 80 ? `${match.slice(0, 77)}...` : match,
85
+ guidance: RULE["link-underline"].guidance,
86
+ });
87
+ }
88
+ if (!/<Button\b/.test(source)) return findings;
89
+
62
90
  for (const { index, tag, label } of buttonTags(source)) {
63
91
  if (tag.endsWith("/>")) continue;
64
92
  if (!isExportLabel(label)) continue;
@@ -29,6 +29,17 @@ function lineOf(source, index) {
29
29
  return source.slice(0, index).split("\n").length;
30
30
  }
31
31
 
32
+ // True when `index` sits inside a code comment: a `//` line comment (not the
33
+ // `//` of a URL such as https://) or a `/* … */` block. Comments name issue and
34
+ // pull-request numbers ("backend #626"), which read as 3-digit hex colors.
35
+ function inComment(source, index) {
36
+ const lineStart = source.lastIndexOf("\n", index - 1) + 1;
37
+ const before = source.slice(lineStart, index);
38
+ if (/^\s*(?:\/\/|\/\*|\*)/.test(before)) return true;
39
+ if (/(?:^|[^:])\/\//.test(before)) return true;
40
+ return source.lastIndexOf("/*", index) > source.lastIndexOf("*/", index);
41
+ }
42
+
32
43
  export function lintLiterals(relPath, source, cfg) {
33
44
  const c = cfg.literals ?? {};
34
45
  if (matchesAny(relPath, c.allow ?? [])) return [];
@@ -44,6 +55,8 @@ export function lintLiterals(relPath, source, cfg) {
44
55
  if (prev === "[" || prev === "." || prev === "#") continue;
45
56
  // DOM selector / URL-fragment argument, not a color value.
46
57
  if (NON_COLOR_CTX.test(source.slice(Math.max(0, m.index - 48), m.index))) continue;
58
+ // Issue and pull-request numbers in comments, not colors.
59
+ if (inComment(source, m.index)) continue;
47
60
  findings.push({
48
61
  line: lineOf(source, m.index),
49
62
  rule: "hardcoded-hex",
@@ -0,0 +1,43 @@
1
+ // Reaching inside ADS components (user-reported 2026-12-01).
2
+ //
3
+ // A product that styles an ADS component's insides through its slots —
4
+ // `[&_[data-slot=stat-sparkline]]:w-16`, `[&>[data-slot=panel]]:rounded-none` —
5
+ // hides a gap in ADS instead of reporting it. Research Analyst squeezed the
6
+ // StatStrip sparklines and slimmed the Call funnel this way: the page looked
7
+ // fixed, ADS never learned it broke at 916px, and the next app hit it again.
8
+ // Fix the component (a prop, a container query) and use it as shipped.
9
+
10
+ import { matchesAny } from "../config.mjs";
11
+
12
+ export const OVERRIDE_RULES = [
13
+ {
14
+ name: "ads-internal-override",
15
+ severity: "error",
16
+ guidance:
17
+ "Don't restyle an ADS component from outside through its slots (`[&_[data-slot=…]]`, `[&>[data-slot=…]]`). If it looks wrong at your size, the fix belongs in ADS — a prop such as FunnelBarsHorizontal size=\"sm\", or a layout rule in the component — so every app gets it. Report it and use the component as shipped.",
18
+ },
19
+ ];
20
+
21
+ const RULE = Object.fromEntries(OVERRIDE_RULES.map((r) => [r.name, r]));
22
+
23
+ // An arbitrary variant that targets a data-slot inside the element:
24
+ // [&_[data-slot=x]]:…, [&>[data-slot=x]]:…, [&_[data-slot]]:…, [&_*[data-slot=x]]:…
25
+ const SLOT_VARIANT = /\[&(?:_|>|\s)[^\]\s"'`]*\[data-slot(?:[=~^$*|]?=[^\]]*)?\][^\s"'`]*\]:[^\s"'`]+/g;
26
+
27
+ export function lintOverrides(relPath, source, cfg) {
28
+ if (cfg.overrides?.enabled === false) return [];
29
+ if (matchesAny(relPath, cfg.overrides?.allow ?? [])) return [];
30
+ if (!/\.(tsx|jsx|ts|js)$/.test(relPath)) return [];
31
+ if (!source.includes("data-slot")) return [];
32
+ const findings = [];
33
+ for (const m of source.matchAll(SLOT_VARIANT)) {
34
+ findings.push({
35
+ line: source.slice(0, m.index).split("\n").length,
36
+ rule: "ads-internal-override",
37
+ severity: RULE["ads-internal-override"].severity,
38
+ match: m[0].length > 80 ? `${m[0].slice(0, 77)}...` : m[0],
39
+ guidance: RULE["ads-internal-override"].guidance,
40
+ });
41
+ }
42
+ return findings;
43
+ }
@@ -18,6 +18,10 @@
18
18
  // words at the foot ("526 characters"); ScriptStart and ScriptDocument do.
19
19
  // - script-opening-line-hand-rolled: an "Opening line" label drawn by hand.
20
20
  // Use ScriptOpeningLine (editable on a draft, read-only once running).
21
+ // - script-ai-review-hand-rolled: a script's AI changes drawn by hand with
22
+ // <del>/<ins>. Use ScriptEditor mode="review" with ScriptReviewBar.
23
+ // - script-ask-hand-rolled: an "Ask for a change" field drawn by hand. Use
24
+ // ScriptAskBar.
21
25
 
22
26
  import { matchesAny } from "../config.mjs";
23
27
  import { elementEnd } from "../jsx.mjs";
@@ -53,6 +57,18 @@ export const RECIPE_RULES = [
53
57
  guidance:
54
58
  "The opening line is the ADS ScriptOpeningLine — editable on a draft, read-only once the campaign runs, with its word count and info icon. Never draw the \"Opening line\" label and field by hand.",
55
59
  },
60
+ {
61
+ name: "script-ai-review-hand-rolled",
62
+ severity: "error",
63
+ guidance:
64
+ "Review the AI's changes to a script in the ADS ScriptEditor: mode=\"review\" with `changes` (ScriptChange[]), `undone` and onToggleChange shows removals struck through on red and additions on green with Undo on each, and ScriptReviewBar carries Discard and Update script (applyScriptChanges builds the result). Never draw the <del>/<ins> review by hand.",
65
+ },
66
+ {
67
+ name: "script-ask-hand-rolled",
68
+ severity: "error",
69
+ guidance:
70
+ "Asking the AI to change a script is the ADS ScriptAskBar (`value`, `onChange`, `onSubmit`, `busy`) under the script in edit mode and on the saved script; while the AI works, ScriptAIStatus takes its place. Never a hand-drawn input with a send button.",
71
+ },
56
72
  {
57
73
  name: "alert-hand-rolled",
58
74
  severity: "error",
@@ -141,6 +157,18 @@ export function lintRecipes(relPath, source, cfg) {
141
157
  if (m) push("script-opening-line-hand-rolled", m.index, m[0]);
142
158
  }
143
159
 
160
+ // script-ai-review-hand-rolled: <del> and <ins> in a script screen without ScriptEditor.
161
+ if (/<del\b/.test(source) && /<ins\b/.test(source) && /script/i.test(source) && !/<ScriptEditor(?![\w.])/.test(source)) {
162
+ const at = source.search(/<del\b/);
163
+ push("script-ai-review-hand-rolled", at, "<del> … <ins>");
164
+ }
165
+
166
+ // script-ask-hand-rolled: an "Ask for a change" placeholder without ScriptAskBar.
167
+ if (!/<ScriptAskBar(?![\w.])/.test(source)) {
168
+ const m = /placeholder=["'{`][^"'`]*Ask (?:for a change|the AI to (?:change|write))/.exec(source);
169
+ if (m) push("script-ask-hand-rolled", m.index, m[0]);
170
+ }
171
+
144
172
  // alert-hand-rolled: a status-tinted container holding a status glyph.
145
173
  for (const m of source.matchAll(/<div\b[^>]*className=(?:"[^"]*|\{`[^`]*|\{cn\([^)]*)\bbg-(?:warning|danger|info|success)(?:-50|-100|\/\d+)\b/g)) {
146
174
  // An icon disc (rounded-full) is an illustration, not a banner.
@@ -96,7 +96,7 @@ export const TABLE_RULES = [
96
96
  name: "table-record-name-missing",
97
97
  severity: "error",
98
98
  guidance:
99
- "A row that opens its record (a page or a detail panel) shows its name as <TableRecordName onOpen={…} opens=\"page\"|\"panel\"> — the name underlines on hover and the open button says where it goes. A bare text name with a row onClick gives no visible way in.",
99
+ "A row that opens its record (a page or a detail panel) shows its name as <TableRecordName onOpen={…} opens=\"page\"|\"panel\"> — the name turns teal on hover (never underlined) and the open button says where it goes. A bare text name with a row onClick gives no visible way in.",
100
100
  },
101
101
  {
102
102
  name: "table-cell-two-values",
package/src/runner.mjs CHANGED
@@ -18,8 +18,9 @@ import { lintElevation } from "./rules/elevation.mjs";
18
18
  import { lintControls } from "./rules/controls.mjs";
19
19
  import { lintRecipes } from "./rules/recipes.mjs";
20
20
  import { lintScreens } from "./rules/screens.mjs";
21
+ import { lintOverrides } from "./rules/overrides.mjs";
21
22
 
22
- const RULE_FNS = [lintImports, lintMotion, lintLiterals, lintModals, lintTables, lintEmptyStates, lintCharts, lintButtons, lintCollections, lintSelection, lintElevation, lintControls, lintRecipes, lintScreens];
23
+ export const RULE_FNS = [lintImports, lintMotion, lintLiterals, lintModals, lintTables, lintEmptyStates, lintCharts, lintButtons, lintCollections, lintSelection, lintElevation, lintControls, lintRecipes, lintScreens, lintOverrides];
23
24
 
24
25
  function toPosix(p) {
25
26
  return p.split(path.sep).join("/");
@@ -93,17 +94,26 @@ export function resolveFiles(opts, cfg, cwd) {
93
94
  });
94
95
  }
95
96
 
97
+ /**
98
+ * Run EVERY rule on one source string. The CLI and the MCP lint_snippet tool
99
+ * both go through here, so an agent's self-check sees the same rules CI does
100
+ * (ads-mcp once ran three of fifteen groups and passed screens CI rejected).
101
+ */
102
+ export function lintSource(relPath, source, cfg) {
103
+ const findings = [];
104
+ for (const fn of RULE_FNS) {
105
+ for (const f of fn(relPath, source, cfg)) findings.push({ file: relPath, ...f });
106
+ }
107
+ return findings;
108
+ }
109
+
96
110
  /** Lint one resolved file set. Returns { findings, fileCount }. */
97
111
  export function lintFiles(absFiles, cfg, cwd) {
98
112
  const findings = [];
99
113
  for (const abs of absFiles) {
100
114
  const rel = toPosix(path.relative(cwd, abs));
101
115
  const source = fs.readFileSync(abs, "utf8");
102
- for (const fn of RULE_FNS) {
103
- for (const f of fn(rel, source, cfg)) {
104
- findings.push({ file: rel, ...f });
105
- }
106
- }
116
+ findings.push(...lintSource(rel, source, cfg));
107
117
  }
108
118
  findings.sort(
109
119
  (a, b) => a.file.localeCompare(b.file) || a.line - b.line || a.rule.localeCompare(b.rule)