Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🎨 chore: Enforce Design-System Rules With @shadcn/lint (#15981)

Marco Beretta339a323ff14d
diff --git a/.github/workflows/static-checks.yml b/.github/workflows/static-checks.yml
index fe3c49e9ab..af88f1e2e1 100644
--- a/.github/workflows/static-checks.yml
+++ b/.github/workflows/static-checks.yml
@@ -11,6 +11,12 @@ on:
- 'package.json'
- 'package-lock.json'
- 'eslint.config.mjs'
+ # Both spellings: the trigger has to start the workflow for the root
+ # baseline and for a nested one outside the source trees above, which is
+ # exactly what the `suppressions` filter below and validateSuppressions()
+ # claim to cover.
+ - 'eslint-suppressions.json'
+ - '**/eslint-suppressions.json'
- '.github/workflows/static-checks.yml'
- '!**.md'
@@ -54,11 +60,40 @@ jobs:
- 'client/**'
- 'packages/**'
- 'eslint.config.mjs'
+ - 'eslint-suppressions.json'
- '.github/workflows/static-checks.yml'
- '!**.md'
eslint_config:
- 'eslint.config.mjs'
- '.github/workflows/static-checks.yml'
+ # The recorded design-rule backlog is data the lint reads, not code it
+ # lints, so a diff that only edits it matches no source file. Its own
+ # group runs the baseline validation below; it deliberately stays out
+ # of `eslint_config`, which gates the full-tree double sweep and could
+ # learn nothing from a count changing.
+ suppressions:
+ - 'eslint-suppressions.json'
+ - '**/eslint-suppressions.json'
+ - 'client/src/**'
+ - 'packages/client/src/**'
+ # The bundle the rules resolve primitives through is named by the
+ # library's manifest, produced by its build config and shaped by
+ # its compiler options.
+ - 'packages/client/package.json'
+ - 'packages/client/tsdown.config.mjs'
+ - 'packages/client/tsconfig.json'
+ - 'eslint.config.mjs'
+ # The plugin is a dependency: a bump changes what the rules
+ # classify and a removal takes them with it, and neither touches a
+ # source file.
+ - 'package.json'
+ - 'package-lock.json'
+ # The runner is the gate: `validateSuppressions` is what a recorded
+ # count is measured against, so a change to it has to run against
+ # the record — the ESLint step above only ever sees sources.
+ - 'scripts/static-checks.mts'
+ - '.github/workflows/static-checks.yml'
+ - '!**.md'
config:
- 'api/**'
- 'config/**'
@@ -102,6 +137,17 @@ jobs:
continue-on-error: true
run: npm ci
+ # The @shadcn/lint design rules read each primitive's `cva` variants through
+ # the @librechat/client entry point, which resolves to packages/client/dist.
+ # Without it they classify nothing and report strictly fewer violations than
+ # the same tree does on a machine that built the package — a lint that passes
+ # for the wrong reason, and a recorded baseline that cannot be trusted.
+ - name: Build client-package for the design rules
+ id: design_rules_build
+ if: always() && (steps.paths.outputs.eslint == 'true' || steps.paths.outputs.suppressions == 'true')
+ continue-on-error: true
+ run: npm run build:client-package
+
# Run ESLint on changed files within the api/, client/, and packages/ directories.
- name: Run ESLint on changed files
id: eslint
@@ -135,10 +181,15 @@ jobs:
# command into one shell string, and Linux rejects a single argv
# string over 128 KiB (MAX_ARG_STRLEN) — past ~2,200 changed files
# npx dies with exit 249 and no output.
+ # --pass-on-unpruned-suppressions: the @shadcn/lint design rules run at error
+ # against a recorded backlog in eslint-suppressions.json. Fixing one of those
+ # violations leaves its suppression unused, which otherwise fails the PR that
+ # fixed it; `npm run lint:design:prune` tightens the counts.
node_modules/.bin/eslint --no-error-on-unmatched-pattern \
--config eslint.config.mjs \
--no-warn-ignored \
--max-warnings=0 \
+ --pass-on-unpruned-suppressions \
-- "${CHANGED_FILES[@]}"
# Run Prettier --check on the same set of changed files to catch
@@ -242,6 +293,20 @@ jobs:
node_modules/.bin/eslint --config eslint.config.mjs \
api/server/index.js client/src/main.jsx packages/api/src/index.ts
+ - name: Validate the design-rule suppressions baseline
+ id: suppressions
+ if: always() && steps.paths.outputs.suppressions == 'true'
+ continue-on-error: true
+ run: |
+ # The changed-file ESLint step above selects JS/TS sources, so a diff that
+ # only edits eslint-suppressions.json lints nothing and would otherwise
+ # merge unread. The runner owns the rules for what the baseline may say.
+ # --against the PR base, not just the baseline path: the check also asks
+ # whether the changed files still owe what they record, and that needs
+ # the diff rather than one file name.
+ BASE_SHA=$(jq --raw-output .pull_request.base.sha "$GITHUB_EVENT_PATH")
+ node scripts/static-checks.mts --against "$BASE_SHA" --only suppressions
+
- name: Restore data-provider build cache
if: always() && steps.paths.outputs.config == 'true'
id: cache-data-provider
@@ -672,6 +737,8 @@ jobs:
INSTALL_DEPENDENCIES_OUTCOME: ${{ steps.install_dependencies.outcome }}
ESLINT_OUTCOME: ${{ steps.eslint.outcome }}
ESLINT_CONFIG_OUTCOME: ${{ steps.eslint_config.outcome }}
+ DESIGN_RULES_BUILD_OUTCOME: ${{ steps.design_rules_build.outcome }}
+ SUPPRESSIONS_OUTCOME: ${{ steps.suppressions.outcome }}
PRETTIER_OUTCOME: ${{ steps.prettier.outcome }}
IMPORT_SORT_OUTCOME: ${{ steps.import_sort.outcome }}
RUNNER_OUTCOME: ${{ steps.runner.outcome }}
@@ -709,6 +776,8 @@ jobs:
record_failure "Dependency installation" "$INSTALL_DEPENDENCIES_OUTCOME"
record_failure "ESLint" "$ESLINT_OUTCOME"
record_failure "ESLint config validation" "$ESLINT_CONFIG_OUTCOME"
+ record_failure "Client-package build for the design rules" "$DESIGN_RULES_BUILD_OUTCOME"
+ record_failure "Design-rule suppressions" "$SUPPRESSIONS_OUTCOME"
record_failure "Prettier" "$PRETTIER_OUTCOME"
record_failure "Import sorting" "$IMPORT_SORT_OUTCOME"
record_failure "Local static-checks runner" "$RUNNER_OUTCOME"
@@ -789,6 +858,15 @@ jobs:
if: steps.paths.outputs.eslint_config == 'true'
run: npm ci
+ # This job has its own clean checkout, so it needs the primitive metadata
+ # the design rules read out of packages/client/dist as much as the Static
+ # checks job does: without it `shadcn/no-restyle` sees no `cva` variants
+ # and classifies fewer overrides, which would let the full-tree gate pass
+ # a component-ownership regression.
+ - name: Build client-package for the design rules
+ if: steps.paths.outputs.eslint_config == 'true'
+ run: npm run build:client-package
+
# Full-tree sweep that gates on regression, not cleanliness: the tree
# carries a pre-existing lint backlog (70 errors at time of wiring), so
# requiring a clean sweep would fail config PRs on unrelated debt.
diff --git a/.husky/lint-staged.config.js b/.husky/lint-staged.config.js
index 910f484837..6f2f0ab25b 100644
--- a/.husky/lint-staged.config.js
+++ b/.husky/lint-staged.config.js
@@ -2,10 +2,33 @@ module.exports = {
'*.{js,jsx,ts,tsx}': [
'node scripts/sort-imports.mts',
'prettier --write',
- 'eslint --fix',
+ // The design rules read each primitive's `cva` variants through
+ // @librechat/client, which resolves to packages/client/dist, so the metadata
+ // has to exist before the fixing pass below reads it: run first, that pass
+ // would classify against a stale build and report counts neither the runner
+ // nor CI agrees with — and its failure aborts lint-staged before the runner
+ // gets to rebuild. tsdown is ~1s when nothing changed.
+ () => 'npm run --silent build:client-package',
// Same invocation as the Static Checks CI job: warnings are failures there,
// and changed files under config-ignored paths must not trip it.
- 'eslint --config eslint.config.mjs --no-warn-ignored --max-warnings=0',
+ // --pass-on-unpruned-suppressions: fixing a design-rule violation recorded in
+ // eslint-suppressions.json otherwise fails the commit that fixed it. Tighten the
+ // recorded counts with `npm run lint:design:prune`.
+ // One invocation, not a bare `eslint --fix` followed by this one: ESLint applies
+ // suppressions after fixes, so a single run reports the post-fix state, while a
+ // first run without the flag exits 2 on the suppression the fix just made unused
+ // and lint-staged never reaches the command that tolerates it.
+ 'eslint --fix --config eslint.config.mjs --no-warn-ignored --max-warnings=0 --pass-on-unpruned-suppressions',
+ // The runner is the CI mirror — same arguments — and rebuilds the metadata
+ // itself when a staged change made it stale, so the commit and the lane
+ // agree on what the rules classify.
+ 'node scripts/static-checks.mts --only eslint',
],
'*.json': ['prettier --write'],
+ // No group here for the recorded backlog, the design metadata or this gate's
+ // own source: `.husky/pre-commit` ends by running the runner over the staged
+ // diff with `--skip eslint,prettier,imports`, and that run selects its groups
+ // from the same filters the Static Checks lane's paths-filter mirrors. It also
+ // sees a deletion, which lint-staged does not hand to a task at all. A group
+ // here would run the whole-record sweep a second time for the same commit.
};
diff --git a/.husky/pre-commit b/.husky/pre-commit
index 67de2b6c1f..0ae0f1f2c2 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -2,7 +2,10 @@
[ -n "$CI" ] && exit 0
# Formats, sorts and lints the exact staged content of each changed file.
-npx lint-staged --config ./.husky/lint-staged.config.js || exit 1
+# Serially: two of the groups build packages/client for the design rules, and
+# lint-staged runs groups in parallel by default — two tsdown writes into the
+# same dist leave the metadata the rules read half-written.
+npx lint-staged --concurrent false --config ./.husky/lint-staged.config.js || exit 1
# The rest of the Static Checks CI job, gated on the paths this commit touches.
# Add STATIC_CHECKS_FULL=1 for the slow gates (TypeScript, config migration
diff --git a/AGENTS.md b/AGENTS.md
index 594e547840..6a4e2cea8b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -145,10 +145,16 @@ For frontend work, compose existing `@librechat/client` primitives and variants
feature-local styles. Use semantic theme/Tailwind roles for color and shared appearance; do not
introduce raw palette utilities, hard-coded colors, or arbitrary theme CSS. If the system cannot
express a reusable design need, deepen the shared primitive or versioned theme-token registry
-instead of copying classes into a feature. Theme definitions select semantic colors and appearance,
-not selectors, app behavior, or alternate layouts. Keep genuine layout and behavior local, and
-explain why any new custom CSS cannot use shared primitives. Support light/dark and reduced motion;
-preserve defaults and test a deliberately different reference theme for reusable new variants.
+instead of copying classes into a feature. Keep genuine layout and behavior local, and document
+why any new custom CSS cannot be expressed by the shared system.
+
+`npm run lint` enforces this: `@shadcn/lint` reads each primitive's `cva` variants and reports a
+`className` that overrides what the primitive owns, naming the variant, size or file to use
+instead. Do not reach for `eslint-disable`, and do not widen a file's recorded count in
+`eslint-suppressions.json` to land a restyle — that file holds the backlog the rules inherited, so
+raising an entry is a reviewable claim that the override is right. After fixing violations, run
+`npm run lint:design:prune`; after moving a file that carries suppressions, run
+`npm run lint:design:suppress`. See the detailed policy in `CLAUDE.md` under “Theming and styling.”
## Backend auth cache
diff --git a/client/src/App.jsx b/client/src/App.jsx
index c210b477e7..24bf66f8ea 100644
--- a/client/src/App.jsx
+++ b/client/src/App.jsx
@@ -106,9 +106,7 @@ export default () => (
allow="autoplay"
id="audio"
title="audio-silence"
- style={{
- display: 'none',
- }}
+ className="hidden"
/>
</ScreenshotProvider>
);
diff --git a/e2e/specs/mock/scenarios/design-rule-enforcement.spec.ts b/e2e/specs/mock/scenarios/design-rule-enforcement.spec.ts
new file mode 100644
index 0000000000..6f99ee6129
--- /dev/null
+++ b/e2e/specs/mock/scenarios/design-rule-enforcement.spec.ts
@@ -0,0 +1,164 @@
+import { expect, test } from '@playwright/test';
+import {
+ designMessages,
+ designRuleSeverities,
+ inOneProject,
+ lintFile,
+ lintStdin,
+ messagesFor,
+ sourceDirectories,
+} from './lint.helpers';
+
+/**
+ * `CLAUDE.md` asks callers to compose the library's primitives and keep colour on
+ * semantic roles, and nothing checked any of it: a caller could write
+ * `<Button className="bg-pink-500 p-4">` and hear nothing back. What the caller
+ * actually sees now is the point of these two scenarios — a report that names the
+ * variant to reach for instead — so both ask the configured flat config, through
+ * `--stdin-filename`, which rules reach a path. No file is written into the tree.
+ */
+
+const BUTTON_OVERRIDE = [
+ "import { Button } from '@librechat/client';",
+ '',
+ 'export default () => <Button className="bg-pink-500 p-1">Go</Button>;',
+ '',
+].join('\n');
+
+const INLINE_DISPLAY = ["export default () => <i style={{ display: 'none' }} />;", ''].join('\n');
+
+/** The same markup with two spaces before the tag closes: `prettier/prettier`
+ * reports it wherever the config lints at all, which is how a silent design
+ * report is told apart from a path nothing lints. */
+const UNFORMATTED_INLINE_DISPLAY = [
+ "export default () => <i style={{ display: 'none' }} />;",
+ '',
+].join('\n');
+
+test.describe('design-system rules', () => {
+ test('a colour override on a primitive names the variant to use instead @scenario:a-color-override-on-button-names-the-variant-to-use', () => {
+ inOneProject();
+ test.setTimeout(60_000);
+
+ const messages = designMessages(lintStdin('client/src/__probe__.tsx', BUTTON_OVERRIDE));
+ const restyle = messagesFor(messages, 'shadcn/no-restyle');
+
+ /** The report has to say what the primitive owns and what to use instead;
+ * a bare "not allowed" would send the caller back to the source. */
+ expect(restyle).toEqual(
+ expect.arrayContaining([
+ expect.stringContaining(
+ '"bg-pink-500" is not allowed on <Button>: <Button> owns its color',
+ ),
+ ]),
+ );
+ expect(restyle.join('\n')).toContain('Use a variant: info, success, warning, error, neutral');
+ expect(restyle).toEqual(
+ expect.arrayContaining([
+ expect.stringContaining('"p-1" is not allowed on <Button>: <Button> owns its spacing'),
+ ]),
+ );
+
+ /** The raw palette is reported on its own account, with the nearest token. */
+ expect(messagesFor(messages, 'shadcn/no-raw-colors').join('\n')).toContain(
+ '"bg-pink-500" uses the raw Tailwind palette',
+ );
+ });
+
+ test('a jsx client file is checked by the design rules @scenario:a-jsx-client-file-is-checked-by-the-design-rules', () => {
+ inOneProject();
+ test.setTimeout(60_000);
+
+ /** The rules reached only `.ts`/`.tsx`, so the client's `.jsx` entry points —
+ * `App.jsx` among them — bypassed every one of them. */
+ const jsx = designMessages(lintStdin('client/src/__probe__.jsx', INLINE_DISPLAY));
+ expect(messagesFor(jsx, 'shadcn/no-inline-styles').join('\n')).toContain(
+ 'Inline style sets display',
+ );
+
+ /** A spec's fixture markup is an assertion, not a design surface: the
+ * exemption has to win for the same source under every pattern the
+ * repository's tests really use. Each path is also asserted to be linted
+ * at all — `prettier/prettier` still reports on it — so silence here means
+ * the design rules are off rather than the file being ignored. */
+ for (const path of [
+ 'client/src/__probe__.spec.tsx',
+ 'client/src/__probe__.test.tsx',
+ 'packages/client/src/__probe__.spec.tsx',
+ ]) {
+ const report = lintStdin(path, UNFORMATTED_INLINE_DISPLAY);
+ expect(designMessages(report), path).toEqual([]);
+ expect(messagesFor(report, 'prettier/prettier'), `${path} is not linted at all`).not.toEqual(
+ [],
+ );
+ }
+
+ /** And the app-local `components/ui` path is a caller, not a library: it
+ * holds composites, so an override of a shared primitive there is reported
+ * like any other caller's. */
+ const composite = designMessages(
+ lintStdin('client/src/components/ui/__probe__.tsx', BUTTON_OVERRIDE),
+ );
+ expect(messagesFor(composite, 'shadcn/no-restyle').join('\n')).toContain(
+ '"bg-pink-500" is not allowed on <Button>',
+ );
+
+ /** The one real violation the widened glob exposed, now fixed at the source
+ * rather than recorded in the backlog. */
+ expect(designMessages(lintFile('client/src/App.jsx'))).toEqual([]);
+ });
+
+ test('every client source directory is policed by the design rules @scenario:every-client-source-directory-is-policed-by-the-design-rules', () => {
+ inOneProject();
+ test.setTimeout(120_000);
+
+ /**
+ * A report says what the rules found; it cannot say where they were asked.
+ * A config that narrowed the design block over a subtree with nothing to
+ * report — `client/src/routes/**` today — would produce no new diagnostic
+ * for any gate to notice, and the styling written there next would never be
+ * read. So the question is put to the resolved configuration itself, for
+ * one representative path in every directory under the roots.
+ *
+ * The library is a different profile on purpose: `packages/client/src` owns
+ * the primitives, so the rules about overriding one are off there while the
+ * rules about colour and inline geometry still hold.
+ */
+ const caller: Record<string, number> = {
+ 'shadcn/no-restyle': 2,
+ 'shadcn/no-raw-colors': 2,
+ 'shadcn/no-arbitrary-values': 2,
+ 'shadcn/no-inline-styles': 2,
+ 'shadcn/require-static-classes': 2,
+ };
+ const library: Record<string, number> = {
+ ...caller,
+ 'shadcn/no-restyle': 0,
+ 'shadcn/no-arbitrary-values': 0,
+ 'shadcn/require-static-classes': 0,
+ };
+
+ const server = 'api/server/index.js';
+ const probes: Record<string, Record<string, number>> = {};
+ for (const [root, expected] of [
+ ['client/src', caller],
+ ['packages/client/src', library],
+ ] as const) {
+ for (const directory of sourceDirectories(root)) {
+ for (const extension of ['ts', 'tsx', 'js', 'jsx']) {
+ probes[`${directory}/__coverage_probe__.${extension}`] = expected;
+ }
+ }
+ }
+ /** And the profile is a choice, not the default everywhere: server code is
+ * not a caller of the design system and is not policed by these rules. */
+ probes[server] = {};
+ expect(Object.keys(probes).length, 'the roots hold no source directories').toBeGreaterThan(50);
+
+ const resolved = designRuleSeverities(Object.keys(probes));
+ const outside = Object.entries(probes)
+ .filter(([path, expected]) => JSON.stringify(resolved[path]) !== JSON.stringify(expected))
+ .map(([path]) => `${path}: ${JSON.stringify(resolved[path])}`);
+ expect(outside, 'a path the design rules no longer police as expected').toEqual([]);
+ });
+});
diff --git a/e2e/specs/mock/scenarios/lint.helpers.ts b/e2e/specs/mock/scenarios/lint.helpers.ts
new file mode 100644
index 0000000000..5115b17ec2
--- /dev/null
+++ b/e2e/specs/mock/scenarios/lint.helpers.ts
@@ -0,0 +1,189 @@
+import { spawnSync } from 'node:child_process';
+import { readdirSync } from 'node:fs';
+import { resolve } from 'node:path';
+import { test } from '@playwright/test';
+
+/**
+ * Shared plumbing for the scenarios whose observable behaviour is what the
+ * configured tooling does rather than what the app paints. They run the real
+ * binaries from the repository root, the way a contributor and the Static
+ * Checks lane do, and they never write into the tree.
+ */
+
+/** The repository root: this file sits in e2e/specs/mock/scenarios. */
+export const repoRoot = resolve(__dirname, '../../../..');
+
+/**
+ * A lint gate has no viewport. These scenarios spawn ESLint and the static-checks
+ * runner over the checkout itself, so a second project would repeat minutes of
+ * subprocess work for the same verdict and two of them would share one
+ * `packages/client/dist` and one scratch tree. The repository's mock lane defines
+ * a single project; a harness that adds colour-scheme or device projects runs
+ * these in the first one.
+ */
+export function inOneProject(): void {
+ const info = test.info();
+ const primary = info.config.projects[0]?.name;
+ test.skip(
+ primary !== undefined && info.project.name !== primary,
+ `the lint gate has no viewport; it runs in ${primary ?? 'the first project'}`,
+ );
+}
+
+export type LintMessage = {
+ ruleId: string | null;
+ message: string;
+ line: number;
+};
+
+export type CommandResult = {
+ status: number;
+ stdout: string;
+ /** Both streams, for assertion messages: a failure is rarely on one of them. */
+ output: string;
+};
+
+/**
+ * Run a command from the repository root and collect both streams. `cwd` names
+ * another root when the command under test derives the repository from where it
+ * is invoked: the static-checks runner relativizes its file arguments against
+ * the working directory, so a copy of it asked about `eslint.config.mjs` from
+ * elsewhere sees a path outside its own tree and selects nothing.
+ */
+export function run(
+ command: string,
+ args: string[],
+ options: { input?: string; cwd?: string } = {},
+): CommandResult {
+ const result = spawnSync(command, args, {
+ cwd: options.cwd ?? repoRoot,
+ encoding: 'utf8',
+ input: options.input,
+ maxBuffer: 64 * 1024 * 1024,
+ });
+ const stdout = result.stdout ?? '';
+ return {
+ status: result.status ?? 1,
+ stdout,
+ output: `${stdout}${result.stderr ?? ''}`,
+ };
+}
+
+const ESLINT = resolve(repoRoot, 'node_modules/.bin/eslint');
+
+function parseMessages(result: CommandResult): LintMessage[] {
+ /** `--format json` writes the report to stdout; ESLint's own notices go to
+ * stderr, so the report is sliced out of stdout alone. */
+ const start = result.stdout.indexOf('[');
+ if (start === -1) {
+ throw new Error(`ESLint printed no JSON report:\n${result.output}`);
+ }
+ const report = JSON.parse(result.stdout.slice(start)) as { messages: LintMessage[] }[];
+ return report.flatMap((file) => file.messages);
+}
+
+/**
+ * Lint `source` as though it were `relativePath`, without creating the file.
+ * `--stdin-filename` is what decides which config block applies, so this asks
+ * the real flat config which rules reach that path.
+ */
+export function lintStdin(relativePath: string, source: string): LintMessage[] {
+ return parseMessages(
+ run(
+ ESLINT,
+ [
+ '--stdin',
+ '--stdin-filename',
+ relativePath,
+ '--format',
+ 'json',
+ '--config',
+ 'eslint.config.mjs',
+ '--no-warn-ignored',
+ ],
+ { input: source },
+ ),
+ );
+}
+
+/** Lint a file that exists, the way the changed-file lint does. */
+export function lintFile(relativePath: string): LintMessage[] {
+ return parseMessages(
+ run(ESLINT, [
+ '--config',
+ 'eslint.config.mjs',
+ '--no-warn-ignored',
+ '--format',
+ 'json',
+ relativePath,
+ ]),
+ );
+}
+
+/** Only the design-system rules; the probes carry no other interesting output. */
+export function designMessages(messages: LintMessage[]): LintMessage[] {
+ return messages.filter((message) => message.ruleId?.startsWith('shadcn/'));
+}
+
+export const messagesFor = (messages: LintMessage[], ruleId: string): string[] =>
+ messages.filter((message) => message.ruleId === ruleId).map((message) => message.message);
+
+/**
+ * The severity the resolved flat config gives each design rule at every path,
+ * which is what says whether the rules are asked about a path at all — a report
+ * cannot, since a file with nothing to report looks the same either way. The
+ * paths need not exist; ESLint resolves a configuration for a name.
+ *
+ * Asked through ESLint's own API in one process: `--print-config` answers for
+ * one path per run, and a directory-by-directory sweep of both roots is more
+ * than a thousand of them — eleven minutes of subprocesses against under a
+ * second in here.
+ */
+export function designRuleSeverities(paths: string[]): Record<string, Record<string, number>> {
+ const query = `
+ const { ESLint } = require('eslint');
+ (async () => {
+ const eslint = new ESLint({ overrideConfigFile: 'eslint.config.mjs' });
+ const answer = {};
+ for (const path of process.argv.slice(1)) {
+ const config = await eslint.calculateConfigForFile(path);
+ const severities = {};
+ for (const [rule, setting] of Object.entries(config.rules ?? {})) {
+ if (rule.startsWith('shadcn/')) {
+ severities[rule] = Array.isArray(setting) ? setting[0] : setting;
+ }
+ }
+ answer[path] = severities;
+ }
+ process.stdout.write(JSON.stringify(answer));
+ })();
+ `;
+ const answered = run(process.execPath, ['-e', query, '--', ...paths]);
+ if (answered.status !== 0) throw new Error(`no resolved config: ${answered.output}`);
+ return JSON.parse(answered.stdout) as Record<string, Record<string, number>>;
+}
+
+/**
+ * `root` and every directory under it that holds a source file, so a coverage
+ * assertion reaches the subtree a narrowing config would drop rather than a
+ * list someone remembered to update.
+ */
+export function sourceDirectories(root: string): string[] {
+ const found: string[] = [];
+ const walk = (directory: string): void => {
+ const entries = readdirSync(resolve(repoRoot, directory), { withFileTypes: true });
+ if (entries.some((entry) => entry.isFile() && /\.(ts|tsx|js|jsx)$/.test(entry.name))) {
+ found.push(directory);
+ }
+ for (const entry of entries) {
+ if (entry.isDirectory() && !entry.name.startsWith('.')) walk(`${directory}/${entry.name}`);
+ }
+ };
+ walk(root);
+ return found;
+}
+
+/** The local mirror of the Static Checks lane, invoked as `package.json` does. */
+export function staticChecks(args: string[]): CommandResult {
+ return run(process.execPath, [resolve(repoRoot, 'scripts/static-checks.mts'), ...args]);
+}
diff --git a/e2e/specs/mock/scenarios/locked-registry.spec.ts b/e2e/specs/mock/scenarios/locked-registry.spec.ts
new file mode 100644
index 0000000000..a7306719a6
--- /dev/null
+++ b/e2e/specs/mock/scenarios/locked-registry.spec.ts
@@ -0,0 +1,136 @@
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
+import { expect, test } from '@playwright/test';
+import { inOneProject, repoRoot } from './lint.helpers';
+
+/**
+ * Every job on this pull request died in `npm ci`: the lockfile entries the stack
+ * added resolved to a private mirror that no GitHub runner and no contributor can
+ * reach. What a clean install needs is that each locked tarball comes from a host
+ * this repository already installs from, and that the registry actually serves
+ * it — so the hosts are checked for the whole lockfile and the tarballs are then
+ * asked for. Neither half depends on this being a branch: the same assertions
+ * hold on `dev` and after this change merges.
+ */
+
+type LockEntry = { resolved?: string; integrity?: string; version?: string; link?: boolean };
+type Lockfile = { packages: Record<string, LockEntry> };
+
+const PUBLIC_REGISTRY = 'registry.npmjs.org';
+
+/**
+ * The one non-registry host this repository installs from, and the one package
+ * it serves: `xlsx` is published on SheetJS's own CDN. Keyed by package rather
+ * than listed as a host, so regenerating the lockfile against that CDN cannot
+ * quietly move anything else onto it.
+ */
+const INHERITED_HOST_OF: Record<string, string> = { xlsx: 'cdn.sheetjs.com' };
+
+/** Lock keys nest: `node_modules/a/node_modules/xlsx` is still `xlsx`. */
+const packageOf = (key: string): string => key.split('node_modules/').pop() ?? key;
+
+/** Workspace links resolve to a directory in this repo, not to a tarball; every
+ * other `resolved` is a URL, and one that is not `https` is itself the
+ * failure, so it is reported as an unusable host rather than skipped. */
+const tarballHost = (entry: LockEntry): string | undefined => {
+ if (entry.link || !entry.resolved) return undefined;
+ if (!entry.resolved.startsWith('https://')) return `insecure:${entry.resolved}`;
+ return new URL(entry.resolved).host;
+};
+
+/**
+ * Every locked entry a clean install could not fetch from a host this
+ * repository already installs from, named rather than counted so a lockfile
+ * written against a private mirror says which package brought it. The exception
+ * belongs to a package, not to a host: `xlsx` may come from SheetJS's CDN at
+ * any version, and nothing else may come from anywhere but the registry — which
+ * is the case a version comparison against the base branch would miss, since
+ * regenerating a lockfile can rewrite `resolved` without touching `version`.
+ */
+export function offRegistry(head: Lockfile): string[] {
+ const problems: string[] = [];
+ for (const [key, entry] of Object.entries(head.packages)) {
+ const host = tarballHost(entry);
+ if (host === undefined || host === PUBLIC_REGISTRY) continue;
+ if (INHERITED_HOST_OF[packageOf(key)] === host) continue;
+ problems.push(`${key} -> ${entry.resolved}`);
+ }
+ return problems;
+}
+
+test.describe('the locked dependency set', () => {
+ test('every locked package resolves from the public registry @scenario:every-locked-package-resolves-from-the-public-registry', () => {
+ inOneProject();
+ test.setTimeout(180_000);
+
+ const head = JSON.parse(
+ readFileSync(resolve(repoRoot, 'package-lock.json'), 'utf8'),
+ ) as Lockfile;
+ const entries = Object.entries(head.packages);
+ expect(entries.length).toBeGreaterThan(0);
+ expect(
+ offRegistry(head),
+ 'a locked tarball outside the public registry cannot be installed in CI',
+ ).toEqual([]);
+
+ /** And what that rule actually says, on lockfiles written for the purpose:
+ * the CDN belongs to `xlsx` and to no one else, at any version. */
+ const at = (host: string, version: string): LockEntry => ({
+ resolved: `https://${host}/package.tgz`,
+ version,
+ });
+ const locked: Lockfile = {
+ packages: {
+ 'node_modules/xlsx': at('cdn.sheetjs.com', '0.20.0'),
+ 'node_modules/lodash': at(PUBLIC_REGISTRY, '4.17.21'),
+ },
+ };
+ expect(
+ offRegistry({
+ packages: { ...locked.packages, 'node_modules/xlsx': at('cdn.sheetjs.com', '0.20.3') },
+ }),
+ 'upgrading xlsx on its own CDN is not a new vendor host',
+ ).toEqual([]);
+ expect(
+ offRegistry({
+ packages: { ...locked.packages, 'node_modules/lodash': at('cdn.sheetjs.com', '4.17.21') },
+ }),
+ 'a package rewritten onto the CDN at the same version passed',
+ ).toEqual(['node_modules/lodash -> https://cdn.sheetjs.com/package.tgz']);
+ expect(
+ offRegistry({
+ packages: { ...locked.packages, 'node_modules/new': at('mirror.internal', '1.0.0') },
+ }),
+ 'a package added from a private mirror passed',
+ ).toEqual(['node_modules/new -> https://mirror.internal/package.tgz']);
+ expect(
+ offRegistry({
+ packages: {
+ ...locked.packages,
+ 'node_modules/a/node_modules/xlsx': at('cdn.sheetjs.com', '0.20.3'),
+ },
+ }),
+ 'a nested xlsx on its own CDN is the same package',
+ ).toEqual([]);
+
+ /** A declared dependency with no entry of its own is the other way a clean
+ * install reaches the network: `npm ci` would resolve it live. */
+ const manifest = JSON.parse(readFileSync(resolve(repoRoot, 'package.json'), 'utf8')) as {
+ dependencies?: Record<string, string>;
+ devDependencies?: Record<string, string>;
+ };
+ const declared = Object.keys({ ...manifest.dependencies, ...manifest.devDependencies });
+ const unlocked = declared.filter(
+ (name) => !head.packages[`node_modules/${name}`] && !head.packages[name],
+ );
+ expect(
+ unlocked,
+ 'a declared dependency has no lockfile entry; npm ci would resolve it live',
+ ).toEqual([]);
+
+ /** Deliberately no request to the registry: whether it serves these tarballs
+ * today is what `npm ci` in this very job already proved, and a 429 from a
+ * rate limit would otherwise fail a pull request that changed none of this.
+ * What the lockfile says is what this scenario owns. */
+ });
+});
diff --git a/e2e/specs/mock/scenarios/suppression-baseline.spec.ts b/e2e/specs/mock/scenarios/suppression-baseline.spec.ts
new file mode 100644
index 0000000000..a42ac16707
--- /dev/null
+++ b/e2e/specs/mock/scenarios/suppression-baseline.spec.ts
@@ -0,0 +1,1148 @@
+import { createRequire } from 'node:module';
+import {
+ copyFileSync,
+ existsSync,
+ mkdirSync,
+ mkdtempSync,
+ readFileSync,
+ rmSync,
+ symlinkSync,
+ utimesSync,
+ writeFileSync,
+} from 'node:fs';
+import { tmpdir } from 'node:os';
+import { dirname, join, resolve } from 'node:path';
+import { expect, test } from '@playwright/test';
+import { inOneProject, repoRoot, run, staticChecks } from './lint.helpers';
+
+/**
+ * `eslint-suppressions.json` records what the tree already owed when the design
+ * rules landed, as a count per file and rule. What a contributor meets is one
+ * scenario each: the commit that FIXES one of those violations must not be
+ * rejected for leaving the count too high; a file move must not leave the old
+ * path silencing a future file that reuses it; a count edit must be read even
+ * when it rides along with a source change; a change to what the rules read must
+ * revalidate counts in files it never touches; an inline comment must not be a
+ * way to silence a design rule; a record that no longer says what it claims must
+ * be rejected; and the command that writes the record must build the primitives
+ * it records against. None of them needs the browser: each runs the configured
+ * command and reads what it does.
+ */
+
+type Suppressions = Record<string, Record<string, { count: number }>>;
+const SUPPRESSIONS_FILE = 'eslint-suppressions.json';
+const suppressionsPath = resolve(repoRoot, SUPPRESSIONS_FILE);
+const ESLINT = resolve(repoRoot, 'node_modules/.bin/eslint');
+
+const readBaseline = (): Suppressions =>
+ JSON.parse(readFileSync(suppressionsPath, 'utf8')) as Suppressions;
+
+/** A scratch baseline in its own directory; ESLint and the runner both take a
+ * baseline's location as an argument, so nothing here writes into the tree. */
+function writeBaseline(content: unknown): string {
+ const path = join(mkdtempSync(join(tmpdir(), 'lc-suppressions-')), SUPPRESSIONS_FILE);
+ writeFileSync(path, `${JSON.stringify(content, null, 2)}\n`);
+ return path;
+}
+
+/** lint-staged's config is CommonJS, so it is loaded the way lint-staged loads
+ * it. Executing it is the point: the assertion is about the real commands. A
+ * task may be a function — that is how a command opts out of having the staged
+ * filenames appended — so each one is resolved the way lint-staged resolves
+ * it, with the staged list. */
+type HookTask = string | ((files: string[]) => string | string[]);
+
+const loadHookConfig = (path: string, staged: string[]): Record<string, string[]> => {
+ const config = createRequire(__filename)(path) as Record<string, HookTask[]>;
+ return Object.fromEntries(
+ Object.entries(config).map(([pattern, tasks]) => [
+ pattern,
+ tasks.flatMap((task) => (typeof task === 'function' ? task(staged) : task)),
+ ]),
+ );
+};
+
+test.describe('the recorded design-rule backlog', () => {
+ test('fixing a recorded violation keeps the configured lint runs green @scenario:fixing-a-recorded-violation-keeps-the-configured-lint-runs-green', () => {
+ inOneProject();
+ test.setTimeout(180_000);
+
+ /** Pick a real recorded file and claim one more violation than it has, which
+ * is the state a fix leaves behind until the counts are pruned. */
+ const baseline = readBaseline();
+ const [file, rules] = Object.entries(baseline)[0];
+ const [rule, { count }] = Object.entries(rules)[0];
+ const overCounted = writeBaseline({ [file]: { [rule]: { count: count + 1 } } });
+ const baselineText = readFileSync(suppressionsPath, 'utf8');
+
+ /** The real pre-commit commands, read by executing the hook's own config:
+ * a copy of the command list here would pass while the hook was broken.
+ * Only the direct ESLint invocations take a suppressions location; the
+ * hook's last task is the runner, asserted below. */
+ const hook = loadHookConfig(resolve(repoRoot, '.husky/lint-staged.config.js'), [file]);
+ const tasks = hook['*.{js,jsx,ts,tsx}'];
+
+ /** The metadata build has to come before the fixing pass: run after it, a
+ * stale `packages/client/dist` is what the design rules classify against,
+ * and lint-staged stops at the first failure. */
+ const buildAt = tasks.findIndex((command) => command.includes('build:client-package'));
+ const fixAt = tasks.findIndex((command) => command.startsWith('eslint'));
+ expect(buildAt, 'the hook no longer builds the design metadata').toBeGreaterThanOrEqual(0);
+ expect(buildAt).toBeLessThan(fixAt);
+ const commands = tasks.filter((command) => command.startsWith('eslint'));
+ expect(commands.length).toBeGreaterThan(0);
+
+ for (const command of commands) {
+ const [, ...args] = command.split(' ');
+ const green = run(ESLINT, [...args, '--suppressions-location', overCounted, '--', file]);
+ expect(green.status, `${command} rejected the diff that fixed a recorded violation`).toBe(0);
+
+ /** The counter-proof: the same command without the flag exits 2, so the
+ * flag is what keeps the fixing commit committable. */
+ const withoutFlag = args.filter((arg) => arg !== '--pass-on-unpruned-suppressions');
+ const red = run(ESLINT, [...withoutFlag, '--suppressions-location', overCounted, '--', file]);
+ expect(red.status).toBe(2);
+ expect(red.output).toContain('suppressions left that do not occur anymore');
+ }
+
+ /** And the hook's authoritative pass is the runner itself, so the commit and
+ * the lane read the same rules from the same metadata. */
+ expect(
+ tasks.some((command) => command.includes('static-checks.mts') && command.includes('--only')),
+ 'the hook no longer runs the CI mirror',
+ ).toBe(true);
+
+ /** The other half of the policy: the commit stays possible, and the lane
+ * then asks for the prune. Capacity a fix freed is capacity the next change
+ * could spend, so the suppressions check rejects a count higher than the
+ * file's violations and names the command that tightens it. */
+ const slack = writeBaseline({ [file]: { [rule]: { count: count + 3 } } });
+ const capacity = staticChecks([slack, '--only', 'suppressions']);
+ expect(capacity.status, 'unused suppression capacity passed the lane').not.toBe(0);
+ expect(capacity.output).toContain('would silence a later violation');
+ expect(capacity.output).toContain('npm run lint:design:prune');
+
+ /** The re-record has to survive the backlog it is recording. `--suppress-rule`
+ * names the design rules, but the run still reports every other rule in the
+ * roots, and those roots carry a pre-existing error backlog, so the
+ * re-record exits non-zero on a perfectly good write. What matters is that
+ * the write happened, which is why the documented chain does not gate the
+ * prune on that status. */
+ const recorded = writeBaseline({});
+ const debt = Object.keys(baseline).find((path) => path.endsWith('.tsx')) ?? file;
+ const write = run(ESLINT, [
+ '--no-warn-ignored',
+ '--suppress-rule',
+ rule,
+ '--suppressions-location',
+ recorded,
+ '--',
+ debt,
+ ]);
+ expect(existsSync(recorded), 'the re-record wrote no baseline').toBe(true);
+ const written = JSON.parse(readFileSync(recorded, 'utf8')) as Suppressions;
+ expect(Object.keys(written)).toContain(debt);
+ /** Not asserted as an expected failure — a clean root would exit 0 — but the
+ * baseline above is written either way, and that is what the prune needs. */
+ expect([0, 1]).toContain(write.status);
+
+ /** And the repository's own baseline is exactly as it was: this scenario
+ * writes only into `os.tmpdir()`. */
+ expect(readFileSync(suppressionsPath, 'utf8')).toBe(baselineText);
+ });
+
+ test('re-recording a moved file drops its old path @scenario:re-recording-a-moved-file-drops-its-old-path', () => {
+ inOneProject();
+ test.setTimeout(180_000);
+
+ /** Suppressions are keyed by path, so a move records the new path and leaves
+ * the old one behind; only the prune removes it. Chaining the two is what
+ * makes the documented move recipe complete, and the two halves are run
+ * below rather than read out of `package.json`: the re-record's write is
+ * asserted in the scenario above, and the prune's removal here. */
+
+ const baseline = readBaseline();
+ const recorded = Object.keys(baseline);
+ const linted = recorded.find((path) => path.startsWith('client/src/a11y/')) ?? recorded[0];
+ const directory = linted.slice(0, linted.lastIndexOf('/'));
+ const outside = recorded.find((path) => !path.startsWith(`${directory}/`));
+ if (!outside) {
+ throw new Error('the baseline records only one directory; pick another fixture');
+ }
+ const phantom = `${directory}/ThisFileMovedAway.tsx`;
+ expect(existsSync(resolve(repoRoot, phantom))).toBe(false);
+
+ const scratch = writeBaseline({
+ [linted]: baseline[linted],
+ [phantom]: { 'shadcn/no-restyle': { count: 4 } },
+ [outside]: baseline[outside],
+ });
+
+ const pruned = run(ESLINT, [
+ '--no-warn-ignored',
+ '--prune-suppressions',
+ '--suppressions-location',
+ scratch,
+ directory,
+ ]);
+ expect(pruned.status, pruned.output).toBe(0);
+
+ const after = JSON.parse(readFileSync(scratch, 'utf8')) as Suppressions;
+ expect(after[phantom]).toBeUndefined();
+ /** A file the prune never linted keeps its entry: the sweep removes paths,
+ * it does not silently rewrite counts for the rest of the tree. */
+ expect(after[outside]).toEqual(baseline[outside]);
+ expect(after[linted]).toEqual(baseline[linted]);
+ });
+
+ test('a count edit riding along with a recorded source is still read @scenario:a-count-edit-riding-along-with-a-recorded-source-is-rejected', () => {
+ inOneProject();
+ test.setTimeout(180_000);
+
+ /** A count edit is measured against `HEAD` when no range is given, which is
+ * the pre-commit case. Without that fallback a diff that also touches one
+ * recorded source would narrow the check to that source and let every other
+ * count edit through to CI, so the shape under test is the baseline passed
+ * alongside a recorded source. */
+ const baseline = readBaseline();
+ const caller = Object.keys(baseline).find((path) => path.startsWith('client/src/'));
+ if (!caller) {
+ throw new Error('the baseline records no client/src caller; pick another fixture');
+ }
+ const callerRule = Object.keys(baseline[caller])[0];
+ const slack = writeBaseline({
+ [caller]: { [callerRule]: { count: baseline[caller][callerRule].count + 4 } },
+ });
+ const recordedSource = Object.keys(baseline).find(
+ (path) => path !== caller && path.startsWith('client/src/'),
+ );
+ if (!recordedSource) {
+ throw new Error('the baseline records only one client/src file; pick another fixture');
+ }
+
+ const alongside = staticChecks([slack, recordedSource, '--only', 'suppressions']);
+ expect(alongside.status, 'a count edit rode along with a recorded source').not.toBe(0);
+ expect(alongside.output).toContain(caller);
+ expect(alongside.output).toContain('would silence a later violation');
+
+ /** And the commit reaches it on every path the lane does. A count edit
+ * touches no source file, so the hook's `*.{js,jsx,ts,tsx}` group never
+ * runs; a primitive decides what the rules report in callers nobody
+ * staged. Both arrive through the runner, which `.husky/pre-commit` runs
+ * over the staged diff after lint-staged, so what has to hold is that the
+ * runner selects this check on every path the lane's `suppressions`
+ * paths-filter names — asked of the runner, and read from the workflow
+ * rather than from a copy of it, so the two cannot drift apart silently. */
+ const hookScript = readFileSync(resolve(repoRoot, '.husky/pre-commit'), 'utf8');
+ expect(hookScript, 'the hook no longer runs the CI mirror over the staged diff').toContain(
+ 'scripts/static-checks.mts --skip eslint,prettier,imports',
+ );
+
+ const workflow = readFileSync(resolve(repoRoot, '.github/workflows/static-checks.yml'), 'utf8');
+ const lane = (workflow.split(/^ {12}suppressions:$/m)[1] ?? '')
+ .split(/^ {12}\S/m)[0]
+ .split('\n')
+ .map((line) => /^ {14}- '([^']+)'$/.exec(line)?.[1])
+ .filter((pattern): pattern is string => Boolean(pattern) && !pattern.startsWith('!'));
+ expect(lane.length, 'the lane declares no suppressions filter').toBeGreaterThan(5);
+
+ const unselected = lane.filter((pattern) => {
+ const probe = pattern.replace('**/', 'packages/client/').replace('/**', '/Probe.tsx');
+ const listed = staticChecks([probe, '--list', '--skip', 'eslint,prettier,imports']);
+ return !/Design-rule suppressions.*would run/.test(listed.output);
+ });
+ expect(unselected, 'the runner does not select what the lane selects').toEqual([]);
+
+ /** And the lane cannot select what the workflow never starts for: the
+ * trigger is a second path list, so a baseline the `suppressions` filter
+ * names — a nested one outside the source trees the trigger enumerates —
+ * can sit in a diff that runs no workflow at all, which is this gate
+ * advertising coverage CI never reaches. The runner owns that claim,
+ * because the file that breaks it is the workflow and this group is what a
+ * change to it runs; the mock lane's own trigger excludes
+ * `.github/workflows` apart from its own file, so an assertion living here
+ * would be absent from exactly the diff it guards.
+ *
+ * Asked of the runner both ways, over a copy of the real workflow: as it
+ * stands, and with the nested-baseline pattern taken out of the trigger. */
+ const parityRoot = syntheticRoot();
+ const parityWorkflow = join(parityRoot, '.github/workflows/static-checks.yml');
+ const parity = () =>
+ run(
+ process.execPath,
+ [
+ join(parityRoot, 'scripts/static-checks.mts'),
+ 'eslint.config.mjs',
+ '--only',
+ 'suppressions',
+ ],
+ { cwd: parityRoot },
+ ).output;
+ const complaint = 'starts the workflow for';
+ try {
+ expect(
+ parity(),
+ 'the committed workflow already disagrees with its own filter',
+ ).not.toContain(complaint);
+
+ /** A filter block ends at its first sibling. A neighbouring lane may
+ * name paths this workflow deliberately never starts for, and reading
+ * past the block's end would charge them to `suppressions` and fail a
+ * workflow that is correct. */
+ const committed = readFileSync(parityWorkflow, 'utf8');
+ const marker = /^ {12}suppressions:$/m.exec(committed);
+ const after = committed.slice((marker?.index ?? 0) + (marker?.[0].length ?? 0));
+ const sibling = /^ {12}\S/m.exec(after);
+ expect(marker && sibling, 'the suppressions filter has no sibling to read past').toBeTruthy();
+ const end = (marker?.index ?? 0) + (marker?.[0].length ?? 0) + (sibling?.index ?? 0);
+ writeFileSync(
+ parityWorkflow,
+ `${committed.slice(0, end)} neighbour:\n - 'e2e/**'\n${committed.slice(end)}`,
+ );
+ expect(parity(), "a neighbouring lane's paths were charged to this one").not.toContain(
+ complaint,
+ );
+ copyFileSync(resolve(repoRoot, '.github/workflows/static-checks.yml'), parityWorkflow);
+ writeFileSync(
+ parityWorkflow,
+ readFileSync(parityWorkflow, 'utf8').replace(
+ /^ {6}- '\*\*\/eslint-suppressions\.json'\n/m,
+ '',
+ ),
+ );
+ const drifted = parity();
+ expect(drifted, 'a lane path the trigger never starts went unreported').toContain(complaint);
+ expect(drifted).toContain('eslint-suppressions.json');
+ } finally {
+ rmSync(parityRoot, { force: true, recursive: true });
+ }
+
+ /** A rename is two paths, and selection is about both. Git's rename
+ * detection reports `git mv eslint-suppressions.json backlog.json` as the
+ * destination alone — a name no filter matches — so the group that owns
+ * the source never activates and the baseline's disappearance is reported
+ * by nothing until CI. Asked of the staged diff, which is the path the
+ * pre-commit hook takes. */
+ const renameRoot = syntheticRoot();
+ try {
+ for (const args of [
+ ['init', '-q'],
+ ['add', '-A'],
+ [
+ '-c',
+ 'user.email=scenario@librechat',
+ '-c',
+ 'user.name=scenario',
+ 'commit',
+ '-qm',
+ 'base',
+ ],
+ ['mv', SUPPRESSIONS_FILE, 'backlog.json'],
+ ]) {
+ const step = run('git', args, { cwd: renameRoot });
+ expect(step.status, `git ${args[0]}: ${step.output}`).toBe(0);
+ }
+ const renamed = run(
+ process.execPath,
+ [join(renameRoot, 'scripts/static-checks.mts'), '--staged', '--only', 'suppressions'],
+ { cwd: renameRoot },
+ );
+ expect(renamed.status, 'a renamed-away baseline was selected by nothing').not.toBe(0);
+ expect(renamed.output).toContain(SUPPRESSIONS_FILE);
+ expect(renamed.output).toContain('is missing');
+ } finally {
+ rmSync(renameRoot, { force: true, recursive: true });
+ }
+
+ /** And it is a selection, not a default: a path outside both roots is not. */
+ const outside = staticChecks([
+ 'api/server/index.js',
+ '--list',
+ '--skip',
+ 'eslint,prettier,imports',
+ ]);
+ expect(outside.output).toMatch(/Design-rule suppressions.*not affected/);
+ });
+
+ test('changing what the design rules read revalidates every recorded count @scenario:changing-what-the-design-rules-read-revalidates-every-recorded-count', () => {
+ inOneProject();
+ test.setTimeout(240_000);
+
+ /**
+ * A count stands for what the rules report, and several things move that
+ * without touching the file the count belongs to: the flat config, the
+ * manifests the plugin is installed from, the library's own manifest and
+ * build config, a primitive's `cva` variants, an app-local component source,
+ * and this runner, which decides what a count has to match. Each has to
+ * revalidate the record for files the diff never names.
+ *
+ * Run against a miniature tree rather than the checkout: the real roots are
+ * ~2,500 files and each sweep costs minutes, while what is under test is
+ * which files the gate asks about — the real runner, the real flat config and
+ * the real plugin, over two sources. The checkout's own 437 recorded paths
+ * are swept at full scale by the committed-baseline scenario below.
+ */
+ const root = syntheticRoot();
+ /** The copied runner, invoked from the miniature tree: it derives the
+ * repository from its own location and relativizes its file arguments
+ * against the working directory, so asking it about `eslint.config.mjs`
+ * from anywhere else names a path outside its tree and selects nothing. */
+ const checks = (files: string[]) =>
+ run(
+ process.execPath,
+ [join(root, 'scripts/static-checks.mts'), ...files, '--only', 'suppressions'],
+ { cwd: root },
+ );
+ try {
+ const triggers = [
+ 'eslint.config.mjs',
+ 'package.json',
+ 'package-lock.json',
+ 'packages/client/package.json',
+ 'packages/client/tsdown.config.mjs',
+ 'packages/client/tsconfig.json',
+ 'scripts/static-checks.mts',
+ 'packages/client/src/Primitive.tsx',
+ 'client/src/components/ui/Thing.tsx',
+ ];
+ for (const trigger of triggers) {
+ const report = checks([trigger]);
+ expect(report.status, `${trigger} revalidated nothing`).not.toBe(0);
+ /** A violation in a file the diff never named and the record never
+ * mentioned: only a sweep of the roots can see it. */
+ expect(report.output, `${trigger} missed an unrecorded caller`).toContain(
+ 'client/src/Caller.tsx',
+ );
+ /** And slack recorded against a file the diff never touched. */
+ expect(report.output, `${trigger} missed an untouched over-count`).toContain(
+ 'client/src/Clean.tsx',
+ );
+ }
+
+ /** The reach is conditional, which is what makes the runs above evidence:
+ * an ordinary source change checks that file and stops there. */
+ const unrecorded = checks(['client/src/Other.tsx']);
+ expect(unrecorded.status, unrecorded.output).toBe(0);
+ const ordinary = checks(['client/src/Clean.tsx']);
+ expect(ordinary.status, 'a recorded source with slack passed').not.toBe(0);
+ expect(ordinary.output).toContain('client/src/Clean.tsx');
+ expect(ordinary.output, 'an ordinary source change swept the roots').not.toContain(
+ 'client/src/Caller.tsx',
+ );
+
+ /** And a spec under either metadata root is not metadata, however much it
+ * looks like a component source: the flat config turns every design rule
+ * off inside it and the library's tsconfig keeps it out of the bundle the
+ * caller rules resolve primitives through, so it carries no `cva` variant
+ * and can move no caller's diagnostic. Sweeping both roots for one is
+ * minutes spent on a question with no answer in it. */
+ for (const spec of [
+ 'packages/client/src/Primitive.spec.tsx',
+ 'client/src/components/ui/Thing.spec.tsx',
+ ]) {
+ const report = checks([spec]);
+ expect(report.status, `${spec}: ${report.output}`).toBe(0);
+ expect(report.output, `${spec} swept the roots`).not.toContain('client/src/Caller.tsx');
+ }
+ } finally {
+ rmSync(root, { force: true, recursive: true });
+ }
+ });
+
+ test('silencing a design rule with an inline comment is rejected @scenario:silencing-a-design-rule-with-an-inline-comment-is-rejected', () => {
+ inOneProject();
+ test.setTimeout(180_000);
+
+ /** An inline comment is the one way to silence a design rule that leaves
+ * nothing behind to review, and a file with no entry could otherwise carry
+ * one past every other check. Two halves answer for it: the diff's design
+ * sources are linted twice — with and without `--no-inline-config` — so
+ * anything a comment is silencing today shows up whatever its spelling, and
+ * the comments themselves are read out of the parser, so a directive that
+ * silences nothing yet is caught as well and a string that reads like one
+ * is not. */
+ const probe = 'client/src/__directive_probe__.tsx';
+ const probePath = join(repoRoot, probe);
+ const violating = 'export default () => <div className="bg-pink-500" />;\n';
+ const clean = 'export default () => <div className="bg-surface-primary" />;\n';
+ /** Each directive is rejected over a file that violates the rule and over
+ * one that does not: a comment waiting for its first violation is the same
+ * hole a day later. */
+ const directives: [string, string, string][] = [
+ ['a named disable', '/* eslint-disable shadcn/no-raw-colors */', 'shadcn/no-raw-colors'],
+ [
+ 'a justified disable',
+ '/* eslint-disable shadcn/no-raw-colors -- because */',
+ 'shadcn/no-raw-colors',
+ ],
+ [
+ 'a next-line disable',
+ '// eslint-disable-next-line shadcn/no-raw-colors',
+ 'shadcn/no-raw-colors',
+ ],
+ ['a blanket disable', '/* eslint-disable */', 'a blanket'],
+ ['a described blanket disable', '/* eslint-disable -- temporary */', 'a blanket'],
+ ['a described next-line disable', '// eslint-disable-next-line -- temporary', 'a blanket'],
+ ['rule configuration', '/* eslint shadcn/no-raw-colors: off */', 'shadcn/no-raw-colors'],
+ [
+ 'rule configuration to warn',
+ '/* eslint shadcn/no-raw-colors: "warn" */',
+ 'shadcn/no-raw-colors',
+ ],
+ [
+ 'a quoted rule configuration',
+ '/* eslint "shadcn/no-raw-colors": off */',
+ 'shadcn/no-raw-colors',
+ ],
+ /** A quoted key is a JSON string, so its escapes belong to the encoding
+ * and not to the rule name. ESLint decodes both of these to the same
+ * rule it disables for the file; a gate that compares the spelling sees
+ * neither. */
+ [
+ 'an escaped rule configuration',
+ '/* eslint "shadcn\\/no-raw-colors": off */',
+ 'shadcn/no-raw-colors',
+ ],
+ [
+ 'a unicode-escaped rule configuration',
+ '/* eslint "shadcn\\u002fno-raw-colors": off */',
+ 'shadcn/no-raw-colors',
+ ],
+ [
+ 'a single-quoted rule configuration',
+ "/* eslint 'shadcn/no-raw-colors': off */",
+ 'shadcn/no-raw-colors',
+ ],
+ ];
+ try {
+ for (const [label, comment, named] of directives) {
+ for (const [state, body] of [
+ ['over a violation', violating],
+ ['over a clean file', clean],
+ ]) {
+ writeFileSync(probePath, `${comment}\n${body}`);
+ const report = staticChecks([probe, '--only', 'suppressions']);
+ expect(report.status, `${label} ${state} passed`).not.toBe(0);
+ expect(report.output, `${label} ${state}`).toContain(named);
+ }
+ }
+
+ /** A blanket disable busy silencing some other rule is the case ESLint's
+ * own unused-directive report cannot see: it is used, so it is not
+ * unused, and it still covers every design rule. */
+ writeFileSync(
+ probePath,
+ '/* eslint-disable */\nconst unused = 1;\nexport default () => <div className="bg-surface-primary" />;\n',
+ );
+ const used = staticChecks([probe, '--only', 'suppressions']);
+ expect(used.status, 'a blanket disable silencing another rule passed').not.toBe(0);
+ expect(used.output).toContain('a blanket');
+
+ /** And two things that are not a silenced rule: a directive naming another
+ * rule — the tree carries forty of them — and a string that reads like
+ * one. */
+ for (const [label, source] of [
+ [
+ 'a directive for another rule',
+ '// eslint-disable-next-line react-hooks/exhaustive-deps\nexport default () => <div className="bg-surface-primary" />;\n',
+ ],
+ [
+ 'comment-like text in a string',
+ 'export default () => <div className="bg-surface-primary" title="/* eslint-disable shadcn/no-raw-colors */" />;\n',
+ ],
+ ]) {
+ writeFileSync(probePath, source);
+ const report = staticChecks([probe, '--only', 'suppressions']);
+ expect(report.status, `${label}: ${report.output}`).toBe(0);
+ }
+ } finally {
+ rmSync(probePath, { force: true });
+ }
+ });
+
+ test('a backlog that no longer says what it claims is rejected @scenario:a-backlog-that-no-longer-says-what-it-claims-is-rejected', () => {
+ inOneProject();
+ test.setTimeout(240_000);
+
+ /** The record is data the lint reads, so a diff that edits it alone reaches
+ * no lintable file and nothing else would read it. Start from the positive
+ * control: the committed backlog passes its own gate — every recorded path
+ * exists, is reported on by a design-rule lint, and records the count that
+ * file actually has. */
+ const baselineText = readFileSync(suppressionsPath, 'utf8');
+ const passing = staticChecks([SUPPRESSIONS_FILE, '--only', 'suppressions']);
+ expect(passing.status, passing.output).toBe(0);
+
+ /** And each way it can stop saying what it claims fails, naming the key. The
+ * check validates every suppressions file the target names, so the invalid
+ * ones live in their own scratch directories and the repository's baseline
+ * is never written to. A count against a path no design-rule lint reports on
+ * is the quiet one: `client/src/style.css` is committed, inside a design
+ * root, and outside every AST rule, so the entry silences nothing and waits
+ * for whatever is linted at that path later. */
+ const invalid: [string, unknown, string][] = [
+ ['a shape ESLint cannot load', [], 'expected an object keyed by file path'],
+ [
+ 'a count no run can reach',
+ { 'client/src/App.jsx': { 'shadcn/no-restyle': { count: 0 } } },
+ 'positive integer count',
+ ],
+ [
+ 'a rule the plugin does not define',
+ { 'client/src/App.jsx': { 'shadcn/no-shadows': { count: 1 } } },
+ 'is not a rule @shadcn/lint defines',
+ ],
+ [
+ 'a path that no longer exists',
+ { 'client/src/Gone.tsx': { 'shadcn/no-restyle': { count: 1 } } },
+ 'recorded path no longer exists',
+ ],
+ [
+ 'a path no design-rule lint reports on',
+ { 'client/src/style.css': { 'shadcn/no-restyle': { count: 1 } } },
+ 'recorded but no design-rule lint reports on it',
+ ],
+ ];
+ for (const [label, content, expected] of invalid) {
+ const probe = writeBaseline(content);
+ const rejected = staticChecks([probe, '--only', 'suppressions']);
+ expect(rejected.status, `${label} was accepted`).toBe(1);
+ expect(rejected.output, label).toContain(expected);
+ }
+
+ /** And a diff that deletes the baseline outright is the same kind of
+ * failure: the group still activates, the changed-file lint has no source
+ * to report through, so the check has to say so rather than skip. The
+ * deletion is exercised in a synthetic root, not in the checkout. */
+ const emptyRoot = mkdtempSync(join(tmpdir(), 'lc-no-baseline-'));
+ mkdirSync(join(emptyRoot, 'scripts'), { recursive: true });
+ copyFileSync(
+ resolve(repoRoot, 'scripts/static-checks.mts'),
+ join(emptyRoot, 'scripts/static-checks.mts'),
+ );
+ copyFileSync(resolve(repoRoot, 'package.json'), join(emptyRoot, 'package.json'));
+ symlinkSync(resolve(repoRoot, 'node_modules'), join(emptyRoot, 'node_modules'), 'dir');
+ const deleted = run(
+ process.execPath,
+ [join(emptyRoot, 'scripts/static-checks.mts'), SUPPRESSIONS_FILE, '--only', 'suppressions'],
+ { cwd: emptyRoot },
+ );
+ expect(deleted.status, 'a deleted baseline passed validation').not.toBe(0);
+ expect(deleted.output).toContain('is missing');
+ rmSync(emptyRoot, { force: true, recursive: true });
+
+ /** A diff may carry a baseline that is not the repository's, and dropping an
+ * entry from one is the same hole as raising a count: the source it spoke
+ * for still violates the rule, and the changed-file lint never sees it
+ * because the source did not change. Exercised in a miniature repository
+ * with a history of its own, since what the entry used to say is read from
+ * the diff. */
+ const nestedRoot = syntheticRoot();
+ const nested = 'packages/client/eslint-suppressions.json';
+ try {
+ writeFileSync(
+ join(nestedRoot, nested),
+ `${JSON.stringify({ 'client/src/Caller.tsx': { 'shadcn/no-raw-colors': { count: 1 } } }, null, 2)}\n`,
+ );
+ for (const args of [
+ ['init', '-q'],
+ ['add', '-A'],
+ [
+ '-c',
+ 'user.email=scenario@librechat',
+ '-c',
+ 'user.name=scenario',
+ 'commit',
+ '-qm',
+ 'base',
+ ],
+ ]) {
+ const step = run('git', args, { cwd: nestedRoot });
+ expect(step.status, `git ${args[0]}: ${step.output}`).toBe(0);
+ }
+ writeFileSync(join(nestedRoot, nested), `${JSON.stringify({}, null, 2)}\n`);
+ const removed = run(
+ process.execPath,
+ [join(nestedRoot, 'scripts/static-checks.mts'), nested, '--only', 'suppressions'],
+ { cwd: nestedRoot },
+ );
+ expect(removed.status, 'a nested baseline dropped an entry its file still needs').not.toBe(0);
+ expect(removed.output).toContain('client/src/Caller.tsx');
+ expect(removed.output).toContain('records nothing but the file has');
+ } finally {
+ rmSync(nestedRoot, { force: true, recursive: true });
+ }
+
+ /** Nothing in the checkout moved while that ran. */
+ expect(readFileSync(suppressionsPath, 'utf8')).toBe(baselineText);
+ });
+
+ test('a violation swapped inside the recorded allowance is rejected @scenario:a-swap-inside-the-recorded-allowance-is-rejected', () => {
+ inOneProject();
+ test.setTimeout(180_000);
+
+ /**
+ * The record is a budget per file and rule, so a change that removes one
+ * raw colour and adds a different one keeps the count equal: the
+ * changed-file lint silences the new violation inside the old allowance and
+ * the count checks see nothing moved. What the totals cannot tell apart the
+ * diagnostics can, so each changed file's version at the base is linted as
+ * itself and a message the head reports that the base did not is new debt.
+ *
+ * A miniature repository with a history of its own, because the question is
+ * what this file used to say.
+ */
+ const root = syntheticRoot();
+ const caller = 'client/src/Caller.tsx';
+ const checks = () =>
+ run(
+ process.execPath,
+ [join(root, 'scripts/static-checks.mts'), caller, '--only', 'suppressions'],
+ { cwd: root },
+ );
+ try {
+ writeFileSync(join(root, caller), 'export default () => <div className="bg-pink-500" />;\n');
+ writeFileSync(
+ join(root, SUPPRESSIONS_FILE),
+ `${JSON.stringify(
+ {
+ 'client/src/Clean.tsx': { 'shadcn/no-restyle': { count: 2 } },
+ [caller]: { 'shadcn/no-raw-colors': { count: 1 } },
+ },
+ null,
+ 2,
+ )}\n`,
+ );
+ for (const args of [
+ ['init', '-q'],
+ ['add', '-A'],
+ [
+ '-c',
+ 'user.email=scenario@librechat',
+ '-c',
+ 'user.name=scenario',
+ 'commit',
+ '-qm',
+ 'base',
+ ],
+ ]) {
+ const step = run('git', args, { cwd: root });
+ expect(step.status, `git ${args[0]}: ${step.output}`).toBe(0);
+ }
+
+ /** The recorded state passes: one violation, one recorded. */
+ const recorded = checks();
+ expect(recorded.status, recorded.output).toBe(0);
+
+ /** The same violation somewhere else in the file is a move, not new debt:
+ * the message is the message, so the count and the diagnostics agree. */
+ writeFileSync(
+ join(root, caller),
+ 'const spacer = null;\nexport default () => <div className="bg-pink-500" />;\n',
+ );
+ const moved = checks();
+ expect(moved.status, `a move was reported as new debt: ${moved.output}`).toBe(0);
+
+ /** A different raw colour at the same count is the swap. */
+ writeFileSync(join(root, caller), 'export default () => <div className="bg-lime-400" />;\n');
+ const swapped = checks();
+ expect(swapped.status, 'a swap inside the allowance passed').not.toBe(0);
+ expect(swapped.output).toContain('bg-lime-400');
+ expect(swapped.output).toContain('is new here');
+
+ /** And the sanctioned way to add one: the violation stays and the record
+ * grows to say so, which is a line in the diff a reviewer can see. The
+ * gate reports what the growth does not cover, not the act of adding. */
+ writeFileSync(
+ join(root, caller),
+ 'export default () => <div className="bg-pink-500 text-lime-400" />;\n',
+ );
+ writeFileSync(
+ join(root, SUPPRESSIONS_FILE),
+ `${JSON.stringify(
+ {
+ 'client/src/Clean.tsx': { 'shadcn/no-restyle': { count: 2 } },
+ [caller]: { 'shadcn/no-raw-colors': { count: 2 } },
+ },
+ null,
+ 2,
+ )}\n`,
+ );
+ const recordedGrowth = checks();
+ expect(
+ recordedGrowth.status,
+ `recording what the change owes was rejected: ${recordedGrowth.output}`,
+ ).toBe(0);
+
+ /** The same violation without the growth is the debt arriving unsaid. */
+ writeFileSync(
+ join(root, SUPPRESSIONS_FILE),
+ `${JSON.stringify(
+ {
+ 'client/src/Clean.tsx': { 'shadcn/no-restyle': { count: 2 } },
+ [caller]: { 'shadcn/no-raw-colors': { count: 1 } },
+ },
+ null,
+ 2,
+ )}\n`,
+ );
+ const unsaid = checks();
+ expect(unsaid.status, 'a new violation passed without the record growing').not.toBe(0);
+ expect(unsaid.output).toContain('text-lime-400');
+
+ /** A file the change adds has no allowance to inherit, whatever the
+ * record says about it: recording a new violation at the same time as
+ * writing it is the same debt by another route. */
+ writeFileSync(join(root, caller), 'export default () => <div className="bg-pink-500" />;\n');
+ const added = 'client/src/Added.tsx';
+ writeFileSync(join(root, added), 'export default () => <div className="bg-lime-400" />;\n');
+ writeFileSync(
+ join(root, SUPPRESSIONS_FILE),
+ `${JSON.stringify(
+ {
+ 'client/src/Clean.tsx': { 'shadcn/no-restyle': { count: 2 } },
+ [caller]: { 'shadcn/no-raw-colors': { count: 1 } },
+ [added]: { 'shadcn/no-raw-colors': { count: 1 } },
+ },
+ null,
+ 2,
+ )}\n`,
+ );
+ const recordedAtOnce = run(
+ process.execPath,
+ [join(root, 'scripts/static-checks.mts'), added, '--only', 'suppressions'],
+ { cwd: root },
+ );
+ expect(recordedAtOnce.status, 'a new file arrived with its own allowance').not.toBe(0);
+ expect(recordedAtOnce.output).toContain('is in a file this change adds');
+
+ /** A move is not an addition: the violations came with the file, so the
+ * documented re-record of a moved path stays a green commit. */
+ rmSync(join(root, added), { force: true });
+ const moved2 = 'client/src/Renamed.tsx';
+ writeFileSync(join(root, moved2), readFileSync(join(root, caller), 'utf8'));
+ rmSync(join(root, caller), { force: true });
+ writeFileSync(
+ join(root, SUPPRESSIONS_FILE),
+ `${JSON.stringify(
+ {
+ 'client/src/Clean.tsx': { 'shadcn/no-restyle': { count: 2 } },
+ [moved2]: { 'shadcn/no-raw-colors': { count: 1 } },
+ },
+ null,
+ 2,
+ )}\n`,
+ );
+ expect(run('git', ['add', '-A'], { cwd: root }).status).toBe(0);
+ const renamed = run(
+ process.execPath,
+ [join(root, 'scripts/static-checks.mts'), moved2, '--only', 'suppressions'],
+ { cwd: root },
+ );
+ expect(renamed.status, `a rename was read as new debt: ${renamed.output}`).toBe(0);
+ } finally {
+ rmSync(root, { force: true, recursive: true });
+ }
+ });
+
+ test('a change to how the primitives are built rebuilds them before the backlog is read @scenario:a-build-config-change-rebuilds-the-primitives-before-validation', () => {
+ inOneProject();
+ test.setTimeout(180_000);
+
+ /** The design rules classify against `packages/client/dist`, which is build
+ * output and not in the tree. The runner rebuilds it when it is older than
+ * the library's sources — and the library's manifest and build config are
+ * sources in that sense too: they decide what is emitted and which entry
+ * point the rules resolve primitives through, while every file under `src`
+ * stays older than the last build. CI always builds, so a local run that
+ * trusted the old output would be the only one disagreeing.
+ *
+ * The build is made observable rather than real: the miniature
+ * repository's `build:client-package` writes a marker and refreshes the
+ * bundle the manifest promises, dated ahead of every source so the result
+ * is what a finished build looks like. The assertion is whether the runner
+ * asked for a build at all — and, in the last case, what it does when the
+ * build reports success without producing one. */
+ const root = syntheticRoot();
+ const marker = join(root, 'built.marker');
+ const manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) as {
+ scripts: Record<string, string>;
+ };
+ const buildScript = 'scripts/fake-build.cjs';
+ writeFileSync(
+ join(root, buildScript),
+ `const fs = require('fs');
+const path = require('path');
+fs.writeFileSync('built.marker', '1');
+const when = new Date(Date.now() + 86400000);
+for (const entry of ${JSON.stringify(bundleEntries())}) {
+ const file = path.join('packages/client', entry);
+ fs.mkdirSync(path.dirname(file), { recursive: true });
+ fs.writeFileSync(file, 'export {};\\n');
+ fs.utimesSync(file, when, when);
+}
+fs.utimesSync('packages/client/dist', when, when);
+`,
+ );
+ const setBuild = (command: string): void => {
+ manifest.scripts['build:client-package'] = command;
+ writeFileSync(join(root, 'package.json'), `${JSON.stringify(manifest, null, 2)}\n`);
+ };
+ setBuild(`node ${buildScript}`);
+ const checks = (files: string[]) =>
+ run(
+ process.execPath,
+ [join(root, 'scripts/static-checks.mts'), ...files, '--only', 'suppressions'],
+ { cwd: root },
+ );
+
+ /** Freshness is an mtime comparison, and a file written in the same
+ * millisecond as the build reads as not newer than it. The times are set
+ * here rather than raced for, so what the scenario asserts is the rule and
+ * not the filesystem's clock. */
+ const at = (relative: string, secondsFromNow: number): void => {
+ const when = new Date(Date.now() + secondsFromNow * 1000);
+ utimesSync(join(root, relative), when, when);
+ };
+
+ try {
+ /** A build that holds everything the manifest promises and is newer than
+ * every source and build input: no rebuild. */
+ const entries = bundleEntries();
+ for (const entry of entries) at(join('packages/client', entry), 60);
+ at('packages/client/dist', 60);
+ rmSync(marker, { force: true });
+ const fresh = checks(['eslint.config.mjs']);
+ expect(fresh.status, fresh.output).not.toBe(0);
+ expect(existsSync(marker), 'a current build was rebuilt anyway').toBe(false);
+
+ /** The build empties `dist` before it writes, so a build that failed
+ * halfway leaves a recent directory over a bundle with no entry point.
+ * A timestamp cannot tell that apart from a finished build; what the
+ * manifest promises can. */
+ rmSync(join(root, 'packages/client', entries[0]), { force: true });
+ at('packages/client/dist', 90);
+ const partial = checks(['eslint.config.mjs']);
+ expect(existsSync(marker), 'a half-written bundle was trusted').toBe(true);
+ expect(partial.status, partial.output).not.toBe(0);
+ writeFileSync(join(root, 'packages/client', entries[0]), 'export {};\n');
+ for (const entry of entries) at(join('packages/client', entry), 100);
+ at('packages/client/dist', 100);
+ rmSync(marker, { force: true });
+
+ /** The build config moves, the sources do not: the build has to be asked
+ * for, because what `dist` holds was emitted under the old one. */
+ at('packages/client/tsdown.config.mjs', 120);
+ const afterConfig = checks(['packages/client/tsdown.config.mjs']);
+ expect(existsSync(marker), 'a build-config change kept the old metadata').toBe(true);
+ expect(afterConfig.status, afterConfig.output).not.toBe(0);
+
+ /** And the library's manifest, which names the entry point the rules
+ * resolve `@librechat/client` through. */
+ for (const entry of entries) at(join('packages/client', entry), 180);
+ at('packages/client/dist', 180);
+ rmSync(marker, { force: true });
+ at('packages/client/package.json', 240);
+ const afterManifest = checks(['packages/client/package.json']);
+ expect(existsSync(marker), 'a manifest change kept the old metadata').toBe(true);
+ expect(afterManifest.status, afterManifest.output).not.toBe(0);
+
+ /** And the root manifests, which say what `build:client-package` runs and
+ * which toolchain runs it: they already select this check, and a build
+ * made under the previous definition is not the current one. */
+ for (const entry of entries) at(join('packages/client', entry), 300);
+ at('packages/client/dist', 300);
+ rmSync(marker, { force: true });
+ at('package-lock.json', 360);
+ const afterToolchain = checks(['package-lock.json']);
+ expect(existsSync(marker), 'a toolchain change kept the old metadata').toBe(true);
+ expect(afterToolchain.status, afterToolchain.output).not.toBe(0);
+
+ /** A spec under the library's sources is not one of the things the bundle
+ * is built from — `packages/client/tsconfig.json` excludes it — so a
+ * build older than it is not stale, and editing one buys no rebuild. */
+ for (const entry of entries) at(join('packages/client', entry), 420);
+ at('packages/client/dist', 420);
+ rmSync(marker, { force: true });
+ at('packages/client/src/Primitive.spec.tsx', 480);
+ const afterSpec = checks(['eslint.config.mjs']);
+ expect(existsSync(marker), 'a spec edit rebuilt the primitives').toBe(false);
+ expect(afterSpec.status, afterSpec.output).not.toBe(0);
+
+ /** Freshness is a property of every declared output, not of the newest
+ * file in the directory. A resolver loads one entry: a build that
+ * rewrote the ESM bundle and left the CJS one or the type declarations
+ * behind still satisfies a `max` comparison while `@shadcn/lint` reads
+ * the stale one. Only asserted when the manifest promises more than one
+ * output, which is what makes the distinction observable. */
+ if (entries.length > 1) {
+ for (const entry of entries) at(join('packages/client', entry), 600);
+ at('packages/client/dist', 600);
+ rmSync(marker, { force: true });
+ /** Newer than one declared output and older than the rest, so the
+ * newest-file comparison reads the bundle as current and the
+ * per-output one does not. */
+ at('packages/client/tsconfig.json', 520);
+ at(join('packages/client', entries[0]), 300);
+ const partialRefresh = checks(['eslint.config.mjs']);
+ expect(existsSync(marker), 'one stale declared output read as a current build').toBe(true);
+ expect(partialRefresh.status, partialRefresh.output).not.toBe(0);
+ }
+
+ /** And a build that reports success without producing one is not a
+ * build. Its exit code says the metadata is current; `dist` says it is
+ * not, and the lint that would follow classifies against a bundle that
+ * describes something else — reporting fewer violations than CI, which
+ * is the failure the rebuild exists to prevent. */
+ setBuild('node -e "process.exit(0)"');
+ for (const entry of entries) at(join('packages/client', entry), 700);
+ at('packages/client/dist', 700);
+ rmSync(marker, { force: true });
+ at('packages/client/tsdown.config.mjs', 760);
+ const lying = checks(['packages/client/tsdown.config.mjs']);
+ expect(lying.status, 'a build that produced nothing was trusted').not.toBe(0);
+ expect(lying.output).toContain('reported success');
+ expect(lying.output).toContain('packages/client/dist');
+ } finally {
+ rmSync(root, { force: true, recursive: true });
+ }
+ });
+
+ test('recording the backlog builds the primitives first @scenario:recording-the-backlog-builds-the-primitives-first', () => {
+ inOneProject();
+ test.setTimeout(180_000);
+
+ /** The runner rebuilds before it validates, but the record is also written
+ * by hand, through `npm run lint:design:record`. That script reads the same
+ * `cva` variants out of `packages/client/dist`, so in a fresh checkout, or
+ * after a primitive changed, it recorded counts for a library nobody is
+ * compiling against: lower than the ones CI reports, and committed as the
+ * budget every later change is measured against.
+ *
+ * The build is made observable rather than real, as above. The questions
+ * are whether the record asks for one before it writes, and whether a build
+ * that fails is still loud now that the wrapper no longer carries its own.
+ */
+ const root = syntheticRoot();
+ const log = join(root, 'built.log');
+ const baseline = join(root, SUPPRESSIONS_FILE);
+ const manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) as {
+ scripts: Record<string, string>;
+ };
+ const setBuild = (command: string): void => {
+ manifest.scripts['build:client-package'] = command;
+ writeFileSync(join(root, 'package.json'), `${JSON.stringify(manifest, null, 2)}\n`);
+ };
+ const npmRun = (script: string) => run('npm', ['run', '--silent', script], { cwd: root });
+
+ try {
+ setBuild(`node -e "require('fs').appendFileSync('built.log','built\\n')"`);
+ writeFileSync(baseline, '{}\n');
+ const recorded = npmRun('lint:design:record');
+ expect(existsSync(log), 'the backlog was recorded without building the primitives').toBe(
+ true,
+ );
+ expect(readFileSync(baseline, 'utf8'), recorded.output).toContain('client/src/Caller.tsx');
+
+ /** The wrapper dropped its own build, because both steps it chains now
+ * carry one. A build that fails still has to be loud: the record cannot
+ * write a baseline it never linted for, and the prune that follows does
+ * not swallow its exit the way the record's is swallowed. */
+ setBuild('node -e "process.exit(1)"');
+ writeFileSync(baseline, '{}\n');
+ rmSync(log, { force: true });
+ const suppressed = npmRun('lint:design:suppress');
+ expect(suppressed.status, 'a failed build passed as a re-record').not.toBe(0);
+ expect(readFileSync(baseline, 'utf8').trim(), suppressed.output).toBe('{}');
+ } finally {
+ rmSync(root, { force: true, recursive: true });
+ }
+ });
+});
+
+/**
+ * A miniature repository the runner can be pointed at: its own copy of this
+ * script, the real flat config, the real manifests and a symlinked
+ * `node_modules`, over two client sources and one library source. `ROOT` is
+ * derived from the script's own location, so the copy treats this tree as the
+ * repository — which is what makes a roots sweep affordable to assert.
+ *
+ * The bundle is written last, holding exactly what the library's manifest
+ * promises, so the runner reads the design metadata as current and does not
+ * rebuild; the rules still resolve the real primitives through the symlinked
+ * `node_modules`.
+ */
+function syntheticRoot(): string {
+ const root = mkdtempSync(join(tmpdir(), 'lc-synthetic-root-'));
+ const write = (relative: string, content: string): void => {
+ const path = join(root, relative);
+ mkdirSync(dirname(path), { recursive: true });
+ writeFileSync(path, content);
+ };
+ const copy = (relative: string): void => {
+ const path = join(root, relative);
+ mkdirSync(dirname(path), { recursive: true });
+ copyFileSync(resolve(repoRoot, relative), path);
+ };
+
+ for (const file of [
+ 'scripts/static-checks.mts',
+ 'package.json',
+ 'package-lock.json',
+ 'eslint.config.mjs',
+ 'packages/client/package.json',
+ 'packages/client/tsdown.config.mjs',
+ 'packages/client/tsconfig.json',
+ /** The lane this runner mirrors: the filter-parity check reads it, and the
+ * copy is what a scenario can break without touching the checkout. */
+ '.github/workflows/static-checks.yml',
+ ]) {
+ copy(file);
+ }
+ symlinkSync(resolve(repoRoot, 'node_modules'), join(root, 'node_modules'), 'dir');
+
+ /** One caller that violates a design rule and is recorded nowhere, one that is
+ * clean and recorded with slack: between them, a sweep of the roots is the
+ * only run that can report both. */
+ write('client/src/Caller.tsx', 'export default () => <div className="bg-pink-500" />;\n');
+ write('client/src/Clean.tsx', 'export default () => <div className="bg-surface-primary" />;\n');
+ write('client/src/Other.tsx', 'export default () => <div className="bg-surface-primary" />;\n');
+ write('client/src/components/ui/Thing.tsx', 'export const Thing = () => null;\n');
+ write('packages/client/src/Primitive.tsx', 'export const Primitive = () => null;\n');
+ /** A spec beside each of them, under both metadata roots. The real roots are
+ * full of these — every primitive in `packages/client/src/components` has
+ * one — and the flat config turns every design rule off inside them, so what
+ * the gate does when one changes is a question the checkout asks constantly.
+ * Written before the bundle, so the miniature build still reads as current. */
+ write('packages/client/src/Primitive.spec.tsx', 'export const fixture = null;\n');
+ write('client/src/components/ui/Thing.spec.tsx', 'export const fixture = null;\n');
+ for (const entry of bundleEntries()) write(join('packages/client', entry), 'export {};\n');
+ write(
+ SUPPRESSIONS_FILE,
+ `${JSON.stringify({ 'client/src/Clean.tsx': { 'shadcn/no-restyle': { count: 2 } } }, null, 2)}\n`,
+ );
+ return root;
+}
+
+/**
+ * What `packages/client/package.json` promises inside `dist`: its entry fields
+ * and every string leaf of `exports`. A build is only finished when these are
+ * there, which is what the runner checks and what the miniature repository has
+ * to reproduce to stand in for one.
+ */
+function bundleEntries(): string[] {
+ const manifest = JSON.parse(
+ readFileSync(resolve(repoRoot, 'packages/client/package.json'), 'utf8'),
+ ) as Record<string, unknown>;
+ const declared: string[] = [];
+ const collect = (value: unknown): void => {
+ if (typeof value === 'string') {
+ const path = value.replace(/^\.\//, '');
+ if (path.startsWith('dist/')) declared.push(path);
+ return;
+ }
+ if (typeof value === 'object' && value !== null) Object.values(value).forEach(collect);
+ };
+ for (const field of ['main', 'module', 'types', 'exports']) collect(manifest[field]);
+ return [...new Set(declared)];
+}
diff --git a/eslint-suppressions.json b/eslint-suppressions.json
new file mode 100644
index 0000000000..980a27a0a8
--- /dev/null
+++ b/eslint-suppressions.json
@@ -0,0 +1,2670 @@
+{
+ "client/src/a11y/MessageBlock.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 7
+ }
+ },
+ "client/src/components/Agents/AgentCard.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ }
+ },
+ "client/src/components/Agents/AgentDetailContent.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 4
+ },
+ "shadcn/no-restyle": {
+ "count": 18
+ }
+ },
+ "client/src/components/Agents/AgentGrid.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Agents/CategoryTabs.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ }
+ },
+ "client/src/components/Agents/CopyLink.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Agents/GridSkeleton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Agents/Marketplace.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Agents/MarketplaceAdminSettings.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Agents/MineFilterToggle.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Agents/SearchBar.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Agents/SortDropdown.tsx": {
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/Agents/VirtualizedAgentGrid.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ }
+ },
+ "client/src/components/Artifacts/ArtifactCodeEditor.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Artifacts/Artifacts.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ },
+ "shadcn/no-inline-styles": {
+ "count": 4
+ },
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Audio/TTS.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 6
+ }
+ },
+ "client/src/components/Auth/AuthLayout.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Auth/ErrorMessage.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Auth/Footer.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Auth/LoginForm.tsx": {
+ "shadcn/no-restyle": {
+ "count": 43
+ }
+ },
+ "client/src/components/Auth/Registration.tsx": {
+ "shadcn/no-restyle": {
+ "count": 43
+ }
+ },
+ "client/src/components/Auth/RequestPasswordReset.tsx": {
+ "shadcn/no-restyle": {
+ "count": 18
+ }
+ },
+ "client/src/components/Auth/ResetPassword.tsx": {
+ "shadcn/no-restyle": {
+ "count": 59
+ }
+ },
+ "client/src/components/Auth/TwoFactorScreen.tsx": {
+ "shadcn/no-restyle": {
+ "count": 19
+ }
+ },
+ "client/src/components/Auth/VerifyEmail.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Bookmarks/BookmarkForm.tsx": {
+ "shadcn/no-restyle": {
+ "count": 14
+ }
+ },
+ "client/src/components/Bookmarks/BookmarkItem.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ }
+ },
+ "client/src/components/Bookmarks/DeleteBookmarkButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Bookmarks/EditBookmarkButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/AddMultiConvo.tsx": {
+ "shadcn/no-restyle": {
+ "count": 11
+ }
+ },
+ "client/src/components/Chat/ChatView.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Footer.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Input/Artifacts.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/AskUserQuestionPopover.tsx": {
+ "shadcn/no-restyle": {
+ "count": 13
+ }
+ },
+ "client/src/components/Chat/Input/AudioRecorder.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Chat/Input/BadgeRow.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Input/ChatForm.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 4
+ },
+ "shadcn/no-inline-styles": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 3
+ },
+ "shadcn/require-static-classes": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Input/CodeApprovalMenu.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/CodeInterpreter.tsx": {
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/CodeWorkspaceMenu.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/ConversationStarters.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Input/EditBadges.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Input/FileSearch.tsx": {
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/Files/AttachFileMenu.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Input/Files/DragDropOverlay.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 4
+ },
+ "shadcn/no-raw-colors": {
+ "count": 5
+ }
+ },
+ "client/src/components/Chat/Input/Files/FileRow.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 10
+ }
+ },
+ "client/src/components/Chat/Input/Files/FileUpload.tsx": {
+ "shadcn/no-restyle": {
+ "count": 11
+ },
+ "shadcn/require-static-classes": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Input/Files/ImagePreview.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Input/Files/MyFilesModal.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/Input/Files/PastedTextDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Input/Files/ProgressCircle.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/Files/SourceIcon.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/Files/Table/Columns.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 23
+ }
+ },
+ "client/src/components/Chat/Input/Files/Table/DataTable.tsx": {
+ "shadcn/no-restyle": {
+ "count": 28
+ }
+ },
+ "client/src/components/Chat/Input/Files/Table/TemplateTable.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 31
+ }
+ },
+ "client/src/components/Chat/Input/HeaderOptions.tsx": {
+ "shadcn/no-restyle": {
+ "count": 10
+ }
+ },
+ "client/src/components/Chat/Input/InFlightSteers.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 1
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/MCPConfigDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 19
+ }
+ },
+ "client/src/components/Chat/Input/MCPSelect.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/MCPSubMenu.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Input/Memory.tsx": {
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/Mention.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Chat/Input/OptionsPopover.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/Chat/Input/PendingSteerChips.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Chat/Input/PopoverButtons.tsx": {
+ "shadcn/no-restyle": {
+ "count": 22
+ },
+ "shadcn/require-static-classes": {
+ "count": 7
+ }
+ },
+ "client/src/components/Chat/Input/PromptsCommand.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Chat/Input/QuoteButton.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/Skills.tsx": {
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/SkillsCommand.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Chat/Input/SteerMenu.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/require-static-classes": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/Input/StreamAudio.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/Input/TokenUsage/Breakdown.tsx": {
+ "shadcn/no-restyle": {
+ "count": 14
+ }
+ },
+ "client/src/components/Chat/Input/TokenUsage/CompactAction.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Input/TokenUsage/index.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Input/ToolsDropdown.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/Input/WebSearch.tsx": {
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Landing.tsx": {
+ "shadcn/no-restyle": {
+ "count": 16
+ },
+ "shadcn/require-static-classes": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Menus/Endpoints/components/EndpointItem.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Menus/Endpoints/components/GroupIcon.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Menus/Endpoints/components/ModelSpecItem.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Menus/Endpoints/components/SearchResults.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Menus/HeaderMenu.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Chat/Menus/NewChat.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Chat/Menus/Presets/EditPresetDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 6
+ }
+ },
+ "client/src/components/Chat/Menus/Presets/PresetItems.tsx": {
+ "shadcn/no-restyle": {
+ "count": 44
+ }
+ },
+ "client/src/components/Chat/Menus/PresetsMenu.tsx": {
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/Chat/Messages/Content/ActionIcon.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 13
+ },
+ "shadcn/no-raw-colors": {
+ "count": 9
+ }
+ },
+ "client/src/components/Chat/Messages/Content/ActivityPhaseGroup.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-inline-styles": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 14
+ }
+ },
+ "client/src/components/Chat/Messages/Content/AgentHandoff.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 9
+ }
+ },
+ "client/src/components/Chat/Messages/Content/AskUserQuestion.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 15
+ }
+ },
+ "client/src/components/Chat/Messages/Content/AskUserQuestionCall.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/AskUserQuestions.tsx": {
+ "shadcn/no-restyle": {
+ "count": 10
+ }
+ },
+ "client/src/components/Chat/Messages/Content/CodeAnalyze.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-raw-colors": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Messages/Content/DialogImage.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 13
+ }
+ },
+ "client/src/components/Chat/Messages/Content/EditContentParts.tsx": {
+ "shadcn/no-restyle": {
+ "count": 11
+ }
+ },
+ "client/src/components/Chat/Messages/Content/EditMessage.tsx": {
+ "shadcn/no-restyle": {
+ "count": 10
+ }
+ },
+ "client/src/components/Chat/Messages/Content/FilePreviewDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Image.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Chat/Messages/Content/MemoryInfo.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Messages/Content/MessageContent.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/ArtifactRow.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 14
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/Attachment.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 9
+ },
+ "shadcn/no-restyle": {
+ "count": 6
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/BashCall.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-raw-colors": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/CollapsibleText.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/DiffView.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/FileAuthoringCall.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/LogContent.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/MemoryCall.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/PendingSkillCall.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/PtcToolTrace.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/ReadFileCall.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/Reasoning.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ },
+ "shadcn/no-inline-styles": {
+ "count": 4
+ },
+ "shadcn/no-restyle": {
+ "count": 6
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/SkillCall.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/Summary.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 19
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/Thinking.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/ToolMermaidArtifact.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Parts/WorkspaceChanges.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 6
+ }
+ },
+ "client/src/components/Chat/Messages/Content/ProgressCircle.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/ProgressText.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 8
+ }
+ },
+ "client/src/components/Chat/Messages/Content/RetrievalCall.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/RetrievalIcon.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 5
+ },
+ "shadcn/no-raw-colors": {
+ "count": 7
+ }
+ },
+ "client/src/components/Chat/Messages/Content/ToolApproval.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 27
+ }
+ },
+ "client/src/components/Chat/Messages/Content/ToolCall.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/Chat/Messages/Content/ToolCallGroup.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 12
+ }
+ },
+ "client/src/components/Chat/Messages/Content/ToolCallInfo.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/ToolCallLimitNotice.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/Messages/Content/ToolOutput/OutputRenderer.tsx": {
+ "shadcn/no-restyle": {
+ "count": 14
+ }
+ },
+ "client/src/components/Chat/Messages/Content/ToolOutput/ToolIcon.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/Messages/Content/UIResourceCarousel.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 24
+ }
+ },
+ "client/src/components/Chat/Messages/Content/Wakeup.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 2
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/WebSearch.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 4
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 16
+ }
+ },
+ "client/src/components/Chat/Messages/Content/WrenchIcon.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-raw-colors": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/animate.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Content/verticals.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 4
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/Feedback.tsx": {
+ "shadcn/no-restyle": {
+ "count": 18
+ },
+ "shadcn/require-static-classes": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/Messages/Fork.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 5
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/HoverButtons.tsx": {
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/MessageNav.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-inline-styles": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/Messages/MessagesView.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/Messages/MinimalHoverButtons.tsx": {
+ "shadcn/no-restyle": {
+ "count": 10
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/MinimalMessages.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-raw-colors": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/SiblingSwitch.tsx": {
+ "shadcn/no-restyle": {
+ "count": 18
+ }
+ },
+ "client/src/components/Chat/Messages/styles.ts": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Messages/ui/HeaderLabel.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 5
+ }
+ },
+ "client/src/components/Chat/Messages/ui/MessageRow.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/ProjectLandingChip.tsx": {
+ "shadcn/no-restyle": {
+ "count": 14
+ }
+ },
+ "client/src/components/Chat/SubagentThreadLink.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Subagents/EventSubagentActivityGroup.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 11
+ }
+ },
+ "client/src/components/Chat/Subagents/SharedSubagentActivityDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 9
+ }
+ },
+ "client/src/components/Chat/Subagents/SubagentActivity.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 14
+ }
+ },
+ "client/src/components/Chat/Subagents/SubagentConversation.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Subagents/SubagentThreadPanel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 9
+ }
+ },
+ "client/src/components/Chat/TemporaryChat.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Trace/Button.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Chat/Trace/Inspector.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Trace/Ledger.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ },
+ "shadcn/no-inline-styles": {
+ "count": 4
+ }
+ },
+ "client/src/components/Chat/Trace/Timeline.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Chat/Trace/Viewer.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Chat/approval/Review.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Chat/ask/options.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 8
+ }
+ },
+ "client/src/components/Conversations/ChatFilterMenu.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Conversations/Conversations.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Conversations/Convo.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Conversations/ConvoActions.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Conversations/ConvoLink.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 4
+ }
+ },
+ "client/src/components/Conversations/ConvoOptions/ProjectButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 13
+ }
+ },
+ "client/src/components/Conversations/ConvoOptions/ShareButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 11
+ }
+ },
+ "client/src/components/Conversations/ConvoOptions/SharedLinkButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Conversations/ConvoOptions/SharedLinkCopyButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/Conversations/Pages.tsx": {
+ "shadcn/require-static-classes": {
+ "count": 2
+ }
+ },
+ "client/src/components/Conversations/PinnedSection.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Conversations/ProjectsSection.tsx": {
+ "shadcn/no-restyle": {
+ "count": 28
+ }
+ },
+ "client/src/components/Conversations/RenameForm.tsx": {
+ "shadcn/no-restyle": {
+ "count": 15
+ }
+ },
+ "client/src/components/Conversations/UnpinButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/Endpoints/ConvoIcon.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Endpoints/Icon.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ }
+ },
+ "client/src/components/Endpoints/MessageEndpointIcon.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Endpoints/MinimalIcon.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Endpoints/SaveAsPresetDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Endpoints/Settings/Advanced.tsx": {
+ "shadcn/no-restyle": {
+ "count": 35
+ },
+ "shadcn/require-static-classes": {
+ "count": 12
+ }
+ },
+ "client/src/components/Endpoints/Settings/Assistants.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ },
+ "shadcn/require-static-classes": {
+ "count": 4
+ }
+ },
+ "client/src/components/Endpoints/Settings/Examples.tsx": {
+ "shadcn/no-restyle": {
+ "count": 26
+ }
+ },
+ "client/src/components/Endpoints/URLIcon.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 4
+ }
+ },
+ "client/src/components/Files/ActionButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 8
+ }
+ },
+ "client/src/components/Files/DeleteIconButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Files/FileDashboardView.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ }
+ },
+ "client/src/components/Files/FileList/DataTableFile.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 40
+ }
+ },
+ "client/src/components/Files/FileList/FileListItem.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-raw-colors": {
+ "count": 4
+ },
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/Files/FileList/FileListItem2.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 4
+ },
+ "shadcn/no-raw-colors": {
+ "count": 5
+ },
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Files/FileList/FilePreview.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 4
+ },
+ "shadcn/no-raw-colors": {
+ "count": 11
+ },
+ "shadcn/no-restyle": {
+ "count": 11
+ }
+ },
+ "client/src/components/Files/FileList/FileSidePanel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Files/FileList/FileTableColumns.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/Files/FileList/UploadFileButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Files/FileList/UploadFileModal.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ },
+ "shadcn/no-raw-colors": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 19
+ }
+ },
+ "client/src/components/Files/FilesSectionSelector.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 8
+ },
+ "shadcn/no-restyle": {
+ "count": 6
+ }
+ },
+ "client/src/components/Files/VectorStore/VectorStoreButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Files/VectorStore/VectorStoreListItem.tsx": {
+ "shadcn/no-restyle": {
+ "count": 11
+ }
+ },
+ "client/src/components/Files/VectorStore/VectorStorePreview.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ },
+ "shadcn/no-raw-colors": {
+ "count": 15
+ },
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/Files/VectorStore/VectorStoreSidePanel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Files/VectorStoreView.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Input/Generations/Button.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Input/Generations/Regenerate.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Input/Generations/Stop.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Input/SetKeyDialog/GoogleConfig.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Input/SetKeyDialog/InputWithLabel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 5
+ },
+ "shadcn/require-static-classes": {
+ "count": 2
+ }
+ },
+ "client/src/components/Input/SetKeyDialog/SetKeyDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 8
+ }
+ },
+ "client/src/components/Insights/InsightsView.tsx": {
+ "shadcn/no-restyle": {
+ "count": 32
+ }
+ },
+ "client/src/components/MCP/CustomUserVarsSection.tsx": {
+ "shadcn/no-restyle": {
+ "count": 20
+ }
+ },
+ "client/src/components/MCP/MCPConfigDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/MCP/MCPServerMenuItem.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/MCP/MCPServerStatusIcon.tsx": {
+ "shadcn/no-restyle": {
+ "count": 13
+ }
+ },
+ "client/src/components/MCP/McpOAuthDialog.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 9
+ }
+ },
+ "client/src/components/MCP/StackedMCPIcons.tsx": {
+ "shadcn/no-restyle": {
+ "count": 5
+ },
+ "shadcn/require-static-classes": {
+ "count": 3
+ }
+ },
+ "client/src/components/Messages/Content/CodeBlock.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Messages/Content/Error/parts.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Messages/Content/Mermaid/Export.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Messages/Content/Mermaid/Mermaid.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Messages/Content/Mermaid/MermaidDialog.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 41
+ }
+ },
+ "client/src/components/Messages/Content/RunCode.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Messages/ScrollToBottom.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Nav/AccountSettings.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ }
+ },
+ "client/src/components/Nav/AgentMarketplaceButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Nav/ExportConversation/ExportModal.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Nav/KeyboardShortcutsDialog.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 11
+ },
+ "shadcn/no-restyle": {
+ "count": 14
+ }
+ },
+ "client/src/components/Nav/NavToggle.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 4
+ }
+ },
+ "client/src/components/Nav/Settings/Dialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 9
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Account/Avatar.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Account/BackupCodesItem.tsx": {
+ "shadcn/no-restyle": {
+ "count": 15
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Account/DeleteAccount.tsx": {
+ "shadcn/no-restyle": {
+ "count": 21
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Account/TwoFactorAuthentication.tsx": {
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Account/TwoFactorPhases/BackupPhase.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Account/TwoFactorPhases/DisablePhase.tsx": {
+ "shadcn/no-restyle": {
+ "count": 10
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Account/TwoFactorPhases/QRPhase.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Account/TwoFactorPhases/VerifyPhase.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/ApiKeys/Admin.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/ApiKeys/ApiKeys.tsx": {
+ "shadcn/no-restyle": {
+ "count": 6
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/ApiKeys/List.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/ApiKeys/Reveal.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/DangerButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 5
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Data/ArchiveAllChats.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/General/ArchivedChatsModal.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Integrations/LangfuseConnection.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/ProviderKeys/ProviderKeys.tsx": {
+ "shadcn/no-restyle": {
+ "count": 9
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Speech/STT/AutoSendTextSelector.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ },
+ "shadcn/require-static-classes": {
+ "count": 2
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Speech/STT/DecibelSelector.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ },
+ "shadcn/require-static-classes": {
+ "count": 2
+ }
+ },
+ "client/src/components/Nav/SettingsTabs/Speech/TTS/PlaybackRate.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ },
+ "shadcn/require-static-classes": {
+ "count": 2
+ }
+ },
+ "client/src/components/Nav/ShortcutKeyCombo.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Nav/ShortcutRecorder.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ }
+ },
+ "client/src/components/Plugins/Store/PluginAuthForm.tsx": {
+ "shadcn/no-restyle": {
+ "count": 9
+ }
+ },
+ "client/src/components/Plugins/Store/PluginPagination.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ }
+ },
+ "client/src/components/Projects/ProjectChatList.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Projects/ProjectChatOptions.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Projects/ProjectCreateDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Projects/ProjectEditDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Projects/ProjectWorkspace.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Projects/ProjectsView.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Prompts/buttons/AutoSendPrompt.tsx": {
+ "shadcn/no-restyle": {
+ "count": 6
+ }
+ },
+ "client/src/components/Prompts/buttons/CreatePromptButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Prompts/dialogs/SharePrompt.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Prompts/dialogs/VariableDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Prompts/display/PromptActions.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Prompts/display/PromptTextCard.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Prompts/display/PromptVariables.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 5
+ }
+ },
+ "client/src/components/Prompts/editor/Markdown.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-raw-colors": {
+ "count": 1
+ }
+ },
+ "client/src/components/Prompts/editor/PromptEditor.tsx": {
+ "shadcn/no-restyle": {
+ "count": 12
+ }
+ },
+ "client/src/components/Prompts/editor/VariablesDropdown.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Prompts/fields/Command.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Prompts/fields/Description.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Prompts/fields/PromptName.tsx": {
+ "shadcn/no-restyle": {
+ "count": 13
+ }
+ },
+ "client/src/components/Prompts/forms/CreatePromptForm.tsx": {
+ "shadcn/no-restyle": {
+ "count": 17
+ }
+ },
+ "client/src/components/Prompts/forms/PromptForm.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 8
+ }
+ },
+ "client/src/components/Prompts/forms/VariableForm.tsx": {
+ "shadcn/no-restyle": {
+ "count": 8
+ },
+ "shadcn/require-static-classes": {
+ "count": 2
+ }
+ },
+ "client/src/components/Prompts/lists/ListCard.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Prompts/sidebar/FilterPrompts.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Prompts/sidebar/GroupSidePanel.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 11
+ }
+ },
+ "client/src/components/Prompts/utils/SkeletonForm.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Share/MessageIcon.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ }
+ },
+ "client/src/components/Share/MessagesView.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-raw-colors": {
+ "count": 1
+ }
+ },
+ "client/src/components/Share/ShareArtifacts.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Share/ShareView.tsx": {
+ "shadcn/no-restyle": {
+ "count": 23
+ }
+ },
+ "client/src/components/SharePoint/SharePointPickerDialog.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/Sharing/GenericGrantAccessDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 17
+ },
+ "shadcn/require-static-classes": {
+ "count": 2
+ }
+ },
+ "client/src/components/Sharing/PeoplePicker/SelectedPrincipalsList.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Sharing/PeoplePickerAdminSettings.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/Sharing/PublicSharingToggle.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/SidePanel/Agents/ActionsInput.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 25
+ }
+ },
+ "client/src/components/SidePanel/Agents/ActionsTable/Columns.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/ActionsTable/Skeleton.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/ActionsTable/Table.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/Advanced/AdvancedButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/Advanced/AdvancedPanel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 20
+ }
+ },
+ "client/src/components/SidePanel/Agents/Advanced/AgentHandoffs.tsx": {
+ "shadcn/no-restyle": {
+ "count": 12
+ }
+ },
+ "client/src/components/SidePanel/Agents/Advanced/AgentList.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 12
+ }
+ },
+ "client/src/components/SidePanel/Agents/Advanced/MaxAgentSteps.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/Advanced/ui.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 10
+ }
+ },
+ "client/src/components/SidePanel/Agents/AgentConfig.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 9
+ }
+ },
+ "client/src/components/SidePanel/Agents/AgentFooter.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/SidePanel/Agents/AgentPanelSkeleton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/AgentSelect.tsx": {
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/SidePanel/Agents/AgentTool.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 5
+ },
+ "shadcn/no-raw-colors": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 10
+ }
+ },
+ "client/src/components/SidePanel/Agents/Background.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/Code/Background.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/Code/Files.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/Code/Settings.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/FileContext.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ },
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 15
+ }
+ },
+ "client/src/components/SidePanel/Agents/FileSearch.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/Images.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ }
+ },
+ "client/src/components/SidePanel/Agents/Instructions.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/SidePanel/Agents/MCPIcon.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 9
+ }
+ },
+ "client/src/components/SidePanel/Agents/MCPToolItem.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/SidePanel/Agents/ModelPanel.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 16
+ }
+ },
+ "client/src/components/SidePanel/Agents/OptionToggle.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/Search/Action.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/CategoryFilter.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 6
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/ItemDialog/ItemDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/ItemDialog/ItemDialogHeader.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 13
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/ItemDialog/sections/McpSection.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 4
+ },
+ "shadcn/no-restyle": {
+ "count": 4
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/ItemDialog/sections/ToolSection.tsx": {
+ "shadcn/no-restyle": {
+ "count": 6
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/MarketplaceSidebar.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/SkillsDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 11
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/SkillsSection.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 10
+ },
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/ToolCard.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 4
+ },
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/ToolRow.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 8
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/ToolsMarketplaceDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/SidePanel/Agents/Tools/ToolsSection.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ }
+ },
+ "client/src/components/SidePanel/Agents/Version/VersionButton.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Agents/Version/VersionItem.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 12
+ }
+ },
+ "client/src/components/SidePanel/Agents/Version/VersionPanel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/SidePanel/ArtifactsPanel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/SidePanel/Bookmarks/BookmarkTable.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/SidePanel/Builder/Action.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Builder/ActionCallback.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/SidePanel/Builder/ActionsAuth.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/SidePanel/Builder/ActionsPanel.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Builder/AppendDateCheckbox.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Builder/AssistantConversationStarters.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 8
+ }
+ },
+ "client/src/components/SidePanel/Builder/AssistantPanel.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 4
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Builder/AssistantSelect.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 15
+ },
+ "shadcn/no-restyle": {
+ "count": 20
+ }
+ },
+ "client/src/components/SidePanel/Builder/AssistantTool.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 5
+ },
+ "shadcn/no-raw-colors": {
+ "count": 2
+ }
+ },
+ "client/src/components/SidePanel/Builder/Code.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Builder/CodeFiles.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Builder/ContextButton.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Builder/Images.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-inline-styles": {
+ "count": 3
+ },
+ "shadcn/no-raw-colors": {
+ "count": 6
+ }
+ },
+ "client/src/components/SidePanel/Builder/Knowledge.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Builder/Retrieval.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Files/PanelColumns.tsx": {
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/SidePanel/Files/PanelTable.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-inline-styles": {
+ "count": 3
+ },
+ "shadcn/no-restyle": {
+ "count": 18
+ }
+ },
+ "client/src/components/SidePanel/MCPBuilder/MCPBuilderPanel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/SidePanel/MCPBuilder/MCPCardActions.tsx": {
+ "shadcn/no-restyle": {
+ "count": 64
+ }
+ },
+ "client/src/components/SidePanel/MCPBuilder/MCPServerCard.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/SidePanel/MCPBuilder/MCPServerDialog/index.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/AuthSection.tsx": {
+ "shadcn/no-restyle": {
+ "count": 9
+ }
+ },
+ "client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/BasicInfoSection.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/ConnectionSection.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/TrustSection.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/MCPBuilder/MCPServerList.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Memories/MemoryCardActions.tsx": {
+ "shadcn/no-restyle": {
+ "count": 18
+ }
+ },
+ "client/src/components/SidePanel/Memories/MemoryCreateDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 13
+ }
+ },
+ "client/src/components/SidePanel/Memories/MemoryEditDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 14
+ }
+ },
+ "client/src/components/SidePanel/Memories/MemoryPanel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/SidePanel/Parameters/DynamicCombobox.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Parameters/DynamicDropdown.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/SidePanel/Parameters/DynamicInput.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/SidePanel/Parameters/DynamicSlider.tsx": {
+ "shadcn/no-restyle": {
+ "count": 13
+ },
+ "shadcn/require-static-classes": {
+ "count": 4
+ }
+ },
+ "client/src/components/SidePanel/Parameters/DynamicSwitch.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/SidePanel/Parameters/DynamicTags.tsx": {
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/SidePanel/Parameters/DynamicTextarea.tsx": {
+ "shadcn/no-restyle": {
+ "count": 9
+ }
+ },
+ "client/src/components/SidePanel/Parameters/Panel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 7
+ }
+ },
+ "client/src/components/SidePanel/Schedules/ScheduleDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 22
+ }
+ },
+ "client/src/components/SidePanel/Schedules/SchedulePanel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/components/SidePanel/SidePanelGroup.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Skills/buttons/ShareSkill.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Skills/buttons/SkillToggle.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Skills/dialogs/CreateSkillDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 39
+ }
+ },
+ "client/src/components/Skills/display/SkillDetail.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Skills/display/SkillFileViewer.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/Skills/display/SkillMarkdownRenderer.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Skills/display/SkillState.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ }
+ },
+ "client/src/components/Skills/forms/CreateSkillForm.tsx": {
+ "shadcn/no-restyle": {
+ "count": 25
+ }
+ },
+ "client/src/components/Skills/forms/SkillContentEditor.tsx": {
+ "shadcn/no-restyle": {
+ "count": 14
+ }
+ },
+ "client/src/components/Skills/forms/SkillForm.tsx": {
+ "shadcn/no-restyle": {
+ "count": 19
+ }
+ },
+ "client/src/components/Skills/layouts/SkillsView.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Skills/lists/SkillListItem.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "client/src/components/Skills/sidebar/SkillsSidePanel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/components/Skills/tree/SkillFileEditor.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 4
+ },
+ "shadcn/no-raw-colors": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 20
+ }
+ },
+ "client/src/components/Skills/tree/SkillFilePreview.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ },
+ "shadcn/no-raw-colors": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/Tools/AssistantToolsDialog.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 17
+ }
+ },
+ "client/src/components/Tools/ToolItem.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ }
+ },
+ "client/src/components/UnifiedSidebar/ExpandedPanel.tsx": {
+ "shadcn/no-restyle": {
+ "count": 6
+ }
+ },
+ "client/src/components/UnifiedSidebar/Sidebar.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ }
+ },
+ "client/src/components/UnifiedSidebar/UnifiedSidebar.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ }
+ },
+ "client/src/components/UnifiedSidebar/mobile/BottomBar.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 5
+ }
+ },
+ "client/src/components/UnifiedSidebar/mobile/Header.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/components/UnifiedSidebar/mobile/Scrim.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ },
+ "shadcn/no-restyle": {
+ "count": 4
+ }
+ },
+ "client/src/components/Variables/Editor.tsx": {
+ "shadcn/no-restyle": {
+ "count": 12
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/Web/SourceHovercard.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 6
+ }
+ },
+ "client/src/components/Web/Sources.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 1
+ },
+ "shadcn/no-raw-colors": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 59
+ }
+ },
+ "client/src/components/ui/AdminSettingsDialog.tsx": {
+ "shadcn/no-restyle": {
+ "count": 22
+ },
+ "shadcn/require-static-classes": {
+ "count": 1
+ }
+ },
+ "client/src/components/ui/Collapse.tsx": {
+ "shadcn/no-arbitrary-values": {
+ "count": 3
+ }
+ },
+ "client/src/components/ui/CustomIcon.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 9
+ }
+ },
+ "client/src/components/ui/LocalizedDateRangePicker.tsx": {
+ "shadcn/no-restyle": {
+ "count": 1
+ }
+ },
+ "client/src/routes/ChatRoute.tsx": {
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "client/src/routes/Root.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ }
+ },
+ "client/src/routes/RouteErrorBoundary.tsx": {
+ "shadcn/no-restyle": {
+ "count": 3
+ }
+ },
+ "client/src/routes/Search.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ },
+ "shadcn/no-restyle": {
+ "count": 2
+ }
+ },
+ "packages/client/src/components/Avatar.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 3
+ }
+ },
+ "packages/client/src/components/Combobox.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ }
+ },
+ "packages/client/src/components/ControlCombobox.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "packages/client/src/components/DataTable.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 6
+ }
+ },
+ "packages/client/src/components/DataTable/DataTable.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 7
+ }
+ },
+ "packages/client/src/components/DataTable/DataTableComponents.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "packages/client/src/components/DropdownPopup.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "packages/client/src/components/FileUpload.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "packages/client/src/components/HoverCard.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "packages/client/src/components/LoadingDots.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "packages/client/src/components/PixelCard.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "packages/client/src/components/Radio.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "packages/client/src/components/SegmentedMeter.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ }
+ },
+ "packages/client/src/components/Select.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "packages/client/src/components/SplitText.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 7
+ }
+ },
+ "packages/client/src/components/Toast.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "packages/client/src/icons/provider/Avatar.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 2
+ }
+ },
+ "packages/client/src/svgs/AudioPaths.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 5
+ }
+ },
+ "packages/client/src/svgs/BirthdayIcon.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 10
+ }
+ },
+ "packages/client/src/svgs/CodePaths.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 2
+ }
+ },
+ "packages/client/src/svgs/DiscordIcon.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 2
+ }
+ },
+ "packages/client/src/svgs/FacebookIcon.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 3
+ }
+ },
+ "packages/client/src/svgs/FilePaths.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 2
+ }
+ },
+ "packages/client/src/svgs/GeminiIcon.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 2
+ }
+ },
+ "packages/client/src/svgs/GoogleIcon.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 4
+ }
+ },
+ "packages/client/src/svgs/PaLMIcon.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 7
+ }
+ },
+ "packages/client/src/svgs/SamlIcon.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 1
+ }
+ },
+ "packages/client/src/svgs/SendMessageIcon.tsx": {
+ "shadcn/no-inline-styles": {
+ "count": 1
+ }
+ },
+ "packages/client/src/svgs/SheetPaths.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 1
+ }
+ },
+ "packages/client/src/svgs/TextPaths.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 5
+ }
+ },
+ "packages/client/src/svgs/VideoPaths.tsx": {
+ "shadcn/no-raw-colors": {
+ "count": 2
+ }
+ }
+}
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 7c7f9d0e70..f1d0c82843 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -5,6 +5,7 @@ import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
import reactHooks from 'eslint-plugin-react-hooks';
import tsParser from '@typescript-eslint/parser';
import importPlugin from 'eslint-plugin-import';
+import { plugin as shadcn } from '@shadcn/lint';
import prettier from 'eslint-plugin-prettier';
import { FlatCompat } from '@eslint/eslintrc';
import jsxA11Y from 'eslint-plugin-jsx-a11y';
@@ -188,6 +189,95 @@ export default [
'jsx-a11y/img-redundant-alt': 'off',
},
},
+ // @shadcn/lint: design-system enforcement for the two client surfaces. The linter treats
+ // `@librechat/client` — plus the app-local `~/components/ui` re-exports — as the design
+ // system, reads each primitive's cva variants, and reports a className that overrides what
+ // the primitive owns, naming the variants and sizes to use instead. The tree's existing
+ // violations are recorded in eslint-suppressions.json, so these rules gate new and edited
+ // code without a tree-wide migration; see CLAUDE.md, "Theming and styling".
+ //
+ // `no-unknown-classes` is deliberately not enabled: it asks the installed Tailwind whether a
+ // class generates CSS and needs Tailwind v4, while this repo runs tailwindcss 3.4 with a JS
+ // preset. Its grammar fallback would report every preset utility (`duration-theme-fast`,
+ // `rounded-theme-control`, `icon-md`) as a typo.
+ //
+ // The client's entry points and helpers are `.jsx`/`.js` — App.jsx among them — so the globs
+ // name those extensions too: the rules have to see them.
+ {
+ files: ['client/src/**/*.{ts,tsx,js,jsx}', 'packages/client/src/**/*.{ts,tsx,js,jsx}'],
+ plugins: { shadcn },
+ settings: {
+ shadcn: {
+ ui: '@librechat/client',
+ componentImports: ['^~/components/ui(/|$)'],
+ note: 'See CLAUDE.md, "Theming and styling".',
+ },
+ },
+ rules: {
+ 'shadcn/no-restyle': [
+ 'error',
+ {
+ // `icon-*` is a sizing utility from client/src/style.css (height, width, stroke-width),
+ // so it belongs with layout rather than with a primitive's own appearance.
+ allow: ['layout', 'icon-*'],
+ // A contract replaces `allow` rather than extending it, so each one restates the
+ // baseline. These record policy, not debt: the categories below are the caller's to
+ // set, which is why they are not in eslint-suppressions.json.
+ contracts: [
+ // A text primitive renders the caller's text, so the caller owns its size, weight
+ // and leading. Color is still the theme's: it stays reported here.
+ {
+ pattern: '^(Label|Description|DialogTitle|DialogDescription)$',
+ allow: ['layout', 'icon-*', 'typography'],
+ },
+ // A skeleton stands in for the caller's content, so it takes that content's
+ // silhouette and footprint.
+ { pattern: '^Skeleton$', allow: ['layout', 'icon-*', 'shape', 'spacing'] },
+ ],
+ },
+ ],
+ 'shadcn/no-raw-colors': 'error',
+ 'shadcn/no-arbitrary-values': ['error', { allow: ['layout'] }],
+ 'shadcn/no-inline-styles': [
+ 'error',
+ {
+ // Geometry that carries a measured or animated number — a virtual row's height, a
+ // floating panel's offset, a drag transform — has no class form. Everything else
+ // (color, display, transition, spacing) does, and stays reported.
+ allow: [
+ 'width',
+ 'height',
+ 'minWidth',
+ 'minHeight',
+ 'maxWidth',
+ 'maxHeight',
+ 'top',
+ 'right',
+ 'bottom',
+ 'left',
+ 'transform',
+ 'transformOrigin',
+ 'zIndex',
+ ],
+ },
+ ],
+ 'shadcn/require-static-classes': 'error',
+ },
+ },
+ {
+ // A primitive owns its own internals, so the rules that police callers are off inside the
+ // component library. `no-raw-colors` and `no-inline-styles` stay on: the primitives are
+ // where theme tokens matter most. `client/src/components/ui` is deliberately not here:
+ // `componentImports` marks it as a place primitives are imported from, but what it holds
+ // are app composites — a dialog, a collapse, a date-range picker — and their overrides of a
+ // shared primitive are exactly what `no-restyle` exists to report.
+ files: ['packages/client/src/**/*.{ts,tsx,js,jsx}'],
+ rules: {
+ 'shadcn/no-restyle': 'off',
+ 'shadcn/no-arbitrary-values': 'off',
+ 'shadcn/require-static-classes': 'off',
+ },
+ },
{
files: ['**/.eslintrc.js', '**/jest.config.js', 'client/vite.config.ts'],
languageOptions: {
@@ -223,6 +313,12 @@ export default [
'jest/no-conditional-expect': 'off',
'jest/no-disabled-tests': 'off',
'@typescript-eslint/no-unused-vars': 'off',
+ // A spec's fixture markup is an assertion, not a design surface.
+ 'shadcn/no-restyle': 'off',
+ 'shadcn/no-raw-colors': 'off',
+ 'shadcn/no-arbitrary-values': 'off',
+ 'shadcn/no-inline-styles': 'off',
+ 'shadcn/require-static-classes': 'off',
},
},
...compat
diff --git a/package-lock.json b/package-lock.json
index e38aca93d3..0bbd79b771 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20,6 +20,7 @@
"@eslint/eslintrc": "^3.3.4",
"@eslint/js": "^9.20.0",
"@playwright/test": "^1.62.1",
+ "@shadcn/lint": "^0.1.0",
"@types/react-virtualized": "^9.22.0",
"brace-expansion": "^2.1.2",
"caniuse-lite": "^1.0.30001741",
@@ -12681,6 +12682,353 @@
"node": "^18.19.0 || >=20.6.0"
}
},
+ "node_modules/@oxc-parser/binding-android-arm-eabi": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm-eabi/-/binding-android-arm-eabi-0.148.0.tgz",
+ "integrity": "sha512-pHASv9g5pASxb7akHERZNSkrEqPhFaUix98o7d9hbTpolnnFWl7UiRrcMhCsV1+iVO4/cJwKsbKRJTFNs2tdBQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-android-arm64": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm64/-/binding-android-arm64-0.148.0.tgz",
+ "integrity": "sha512-sg/6Ez0KdAygsu0POELux9wN1Po2CP93WY8eNl4DBKIGprsd4QSHBXOb471Pu9i2OCD5sLkISSb2agZEhVn2Zw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-darwin-arm64": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-arm64/-/binding-darwin-arm64-0.148.0.tgz",
+ "integrity": "sha512-yiSJmzGUvCUaJT8X3j40gVcX+ckuHQMuiOtF8DvzTs5+JtB/7XuHFPp4M+vv5u+HlBtDUd4Ks5pyHpWz8mfnkg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-darwin-x64": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-x64/-/binding-darwin-x64-0.148.0.tgz",
+ "integrity": "sha512-6ZeklaamrMy4H2JmhvcJg6iip59tYILtuLaILxyAHT3l5FDxnI5ihVievAft5ZmAbqtlWHErOi1OpJK8gy1wcA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-freebsd-x64": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-freebsd-x64/-/binding-freebsd-x64-0.148.0.tgz",
+ "integrity": "sha512-vFsPx+a/qFECPnz/H8nC6x6MDvnWscLTCo/5muojEF54ERUq1kdgbvnWo95YnkhjF9sTIcG/uDxQBh1gffaufQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-linux-arm-gnueabihf": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.148.0.tgz",
+ "integrity": "sha512-eOr3M+6iGbbxNL4PSS0VtsyQ2eOUxSBh00BqO22SbolDimPSYsBuLr/LCrZBkiqW2BoabhR6V4R8jrRAay7hjg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-linux-arm-musleabihf": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.148.0.tgz",
+ "integrity": "sha512-58ZKDw0mQRbCNfrd2IDyV4o8T7enzGERJn41BH2tjrZVGyiKiFzcfDicuB7Zcpb/1xIOrObovr8Dja6lZi8dLw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-linux-arm64-gnu": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.148.0.tgz",
+ "integrity": "sha512-Fnu95O4eZ5i++GPvIzBEZ8y4ddTLR+D9paYa8JRaRk6ZK7nHQiWP5xtrhcPQsXqgat1d7sU/d5rbbI0p1FTHSQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-linux-arm64-musl": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.148.0.tgz",
+ "integrity": "sha512-3CQy/BMdx7N7H3qrcPxUL+a2CwUZodUcf6oq8iJuNZ9C6Ol1aq3mcWzsgySJ7CHFLvpX21ZDPp1r1X0QLbu/AQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-linux-ppc64-gnu": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.148.0.tgz",
+ "integrity": "sha512-9LkaYvfiF8hMOw900csAvkf1oxE8XlmMeGowu5BcastSSwV8mKvKRMNU7HsV+ycyj1dQD8pX5qgOw8ja6SJacg==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-linux-riscv64-gnu": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.148.0.tgz",
+ "integrity": "sha512-2GBiM9h26dR4WJfhoMvnFMnFLf7m/kYs4UMqjvrOfQG4BV1nuTJDH22Zc2MQr3INZF7nSKYQ6xlhD3hQ7A6gug==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-linux-riscv64-musl": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.148.0.tgz",
+ "integrity": "sha512-uPqZexvKJmEgq4mAu36qe2xTfXZE7oyik1R7KtZ5tl8qKlq1U1fIqTFRUEBZqRGvforoTrGIpatRzcoPKO66RA==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-linux-s390x-gnu": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.148.0.tgz",
+ "integrity": "sha512-9oUHvnTbp7ZraFsTC8PN6XhdhPSSxZumYvixWl7Smi353gEULvK6yV0sXNVrdFMHQeaDKFCi8TgDhNK7/A+Y+Q==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-linux-x64-gnu": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.148.0.tgz",
+ "integrity": "sha512-2qhDSJwKzbSZzF7lDqqk8sr/yXsmwr3PeUa4/nazIF+zFAYz1gVPEfC34GQtGxzJUUmklaYAL63368LEfrMeyw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-linux-x64-musl": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-musl/-/binding-linux-x64-musl-0.148.0.tgz",
+ "integrity": "sha512-qQoPDZUFV0bh9xA09XydmkjMBpgc1ukJuhMvzQ9QeVmFaHTS9W5TE5CoLmSl3QQyUP9OuHO3x/WPZTIIZPWR3Q==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-openharmony-arm64": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-openharmony-arm64/-/binding-openharmony-arm64-0.148.0.tgz",
+ "integrity": "sha512-1UGbaQWEXUCLqAmaR5kwRDjx/R4S5LQKZkM9CHmaHkuKhriOF32aRLfS0jCRNE2yGQJLMEA1z9UucbBVqjXnDw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-win32-arm64-msvc": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.148.0.tgz",
+ "integrity": "sha512-pWKdzRDNG2+NK4h/V6U/CYERcfYD6u28h5IB/VJVsrZaD3muvE58tUj22lieL5vLZ+XFi1GPv9YXckZbJZ9BLA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-win32-ia32-msvc": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.148.0.tgz",
+ "integrity": "sha512-i3p4x+mvwtjcE1J5HM6V7ggsbXiznExN/4MkNyOy3dfXrVV3bnkSfmZxvo6/84qCVX4ShkpNE1SKt9biIF31GQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@oxc-parser/binding-win32-x64-msvc": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.148.0.tgz",
+ "integrity": "sha512-Ye6vB7VQulghWYkYkECOBYFRVEizz4XyRTUAv+t8BuyurhKU7uD0P9eowL+mKG5Mf8MSYx+DI3Cm8SKZvYG7bQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
"node_modules/@oxc-project/types": {
"version": "0.147.0",
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.147.0.tgz",
@@ -16695,6 +17043,32 @@
"node": ">=14.18"
}
},
+ "node_modules/@shadcn/lint": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/@shadcn/lint/-/lint-0.1.0.tgz",
+ "integrity": "sha512-UDSxO4eQa8UAclN1tChum+L336CL2uB2ZLGYiJ7r/GDrYUBOKPWWNUVoAfh2dZs4LhcwJRCn62+fKG12eAy1FQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint/core": "^0.17.0",
+ "@typescript-eslint/parser": "^8.40.0",
+ "cn": "0.2.6"
+ },
+ "engines": {
+ "node": ">=20.19"
+ },
+ "optionalDependencies": {
+ "oxc-parser": "^0.148.0"
+ },
+ "peerDependencies": {
+ "eslint": ">=9.30.0"
+ },
+ "peerDependenciesMeta": {
+ "eslint": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@sinclair/typebox": {
"version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
@@ -21624,6 +21998,19 @@
"node": ">=0.10.0"
}
},
+ "node_modules/cn": {
+ "version": "0.2.6",
+ "resolved": "https://registry.npmjs.org/cn/-/cn-0.2.6.tgz",
+ "integrity": "sha512-+i4L0zUGgRcEnhsxueVrP7iBGxBx5iD0WOTYg1MwFEu2ZyCmH5Ov2V1cul2Ht5UchRQQgftCf4be/RxspuW6QQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "cn": "bin/cn.mjs"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
"node_modules/co": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
@@ -33465,6 +33852,55 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/oxc-parser": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.148.0.tgz",
+ "integrity": "sha512-syxUKHeUll89RIABQADcI7sikYrwyssvA6gj4phSSIPezKVM8yMaLAiLLSc7fmzVvrwybfFGFbW5zme9sX87rg==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "@oxc-project/types": "^0.148.0"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/oxc-project"
+ },
+ "optionalDependencies": {
+ "@oxc-parser/binding-android-arm-eabi": "0.148.0",
+ "@oxc-parser/binding-android-arm64": "0.148.0",
+ "@oxc-parser/binding-darwin-arm64": "0.148.0",
+ "@oxc-parser/binding-darwin-x64": "0.148.0",
+ "@oxc-parser/binding-freebsd-x64": "0.148.0",
+ "@oxc-parser/binding-linux-arm-gnueabihf": "0.148.0",
+ "@oxc-parser/binding-linux-arm-musleabihf": "0.148.0",
+ "@oxc-parser/binding-linux-arm64-gnu": "0.148.0",
+ "@oxc-parser/binding-linux-arm64-musl": "0.148.0",
+ "@oxc-parser/binding-linux-ppc64-gnu": "0.148.0",
+ "@oxc-parser/binding-linux-riscv64-gnu": "0.148.0",
+ "@oxc-parser/binding-linux-riscv64-musl": "0.148.0",
+ "@oxc-parser/binding-linux-s390x-gnu": "0.148.0",
+ "@oxc-parser/binding-linux-x64-gnu": "0.148.0",
+ "@oxc-parser/binding-linux-x64-musl": "0.148.0",
+ "@oxc-parser/binding-openharmony-arm64": "0.148.0",
+ "@oxc-parser/binding-win32-arm64-msvc": "0.148.0",
+ "@oxc-parser/binding-win32-ia32-msvc": "0.148.0",
+ "@oxc-parser/binding-win32-x64-msvc": "0.148.0"
+ }
+ },
+ "node_modules/oxc-parser/node_modules/@oxc-project/types": {
+ "version": "0.148.0",
+ "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.148.0.tgz",
+ "integrity": "sha512-Nm4s/jB+4FpFsPhWGEC4h7rzksesmtnMXomo6rCMcg/b8zLQuOziRgkCS1fxDCXOlJB/6Q8oABOZ/OP6RIPj9A==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "funding": {
+ "url": "https://github.com/sponsors/oxc-project"
+ }
+ },
"node_modules/p-finally": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
diff --git a/package.json b/package.json
index 9b0760c9dd..acd6b8c8d9 100644
--- a/package.json
+++ b/package.json
@@ -109,8 +109,11 @@
"test:all": "npm run test:client && npm run test:api && npm run test:packages:api && npm run test:packages:data-provider && npm run test:packages:data-schemas",
"e2e:update": "npm run e2e:prepare && playwright test --config=e2e/playwright.config.local.ts --update-snapshots",
"e2e:report": "npx playwright show-report e2e/playwright-report",
- "lint:fix": "eslint . --fix",
- "lint": "eslint .",
+ "lint:fix": "npm run build:client-package && eslint . --fix --pass-on-unpruned-suppressions",
+ "lint": "npm run build:client-package && eslint . --pass-on-unpruned-suppressions",
+ "lint:design:record": "npm run build:client-package && eslint --no-warn-ignored --suppress-rule shadcn/no-restyle --suppress-rule shadcn/no-raw-colors --suppress-rule shadcn/no-arbitrary-values --suppress-rule shadcn/no-inline-styles --suppress-rule shadcn/require-static-classes client/src packages/client/src",
+ "lint:design:suppress": "(npm run --silent lint:design:record || node -e \"\") && npm run lint:design:prune",
+ "lint:design:prune": "npm run build:client-package && eslint --no-warn-ignored --prune-suppressions client/src packages/client/src",
"sort-imports": "node scripts/sort-imports.mts",
"sort-imports:check": "node scripts/sort-imports.mts --check",
"static-checks": "node scripts/static-checks.mts",
@@ -171,6 +174,7 @@
"@eslint/eslintrc": "^3.3.4",
"@eslint/js": "^9.20.0",
"@playwright/test": "^1.62.1",
+ "@shadcn/lint": "^0.1.0",
"@types/react-virtualized": "^9.22.0",
"brace-expansion": "^2.1.2",
"caniuse-lite": "^1.0.30001741",
diff --git a/packages/client/src/components/Textarea.tsx b/packages/client/src/components/Textarea.tsx
index 19259faa18..033c63db4f 100644
--- a/packages/client/src/components/Textarea.tsx
+++ b/packages/client/src/components/Textarea.tsx
@@ -1,11 +1,9 @@
-/* eslint-disable */
import * as React from 'react';
-import TextareaAutosize from 'react-textarea-autosize';
import { fieldBase } from './Field';
import { cn } from '~/utils';
import './Field.css';
-export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
+export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
const Textarea: React.ForwardRefExoticComponent<
TextareaProps & React.RefAttributes<HTMLTextAreaElement>
diff --git a/scripts/static-checks.mts b/scripts/static-checks.mts
index 561d6a5c0e..a97012f956 100644
--- a/scripts/static-checks.mts
+++ b/scripts/static-checks.mts
@@ -35,7 +35,7 @@
*
* Flags: --staged, --full, --fast, --only <ids>, --skip <ids>, --verbose,
* --list. Check ids: eslint, prettier, imports, eslint-config, json,
- * circular-deps, typecheck, config-tests, i18n, depcheck.
+ * suppressions, circular-deps, typecheck, config-tests, i18n, depcheck.
*/
import { fileURLToPath } from 'node:url';
@@ -43,7 +43,18 @@ import { createRequire } from 'node:module';
import { spawnSync } from 'node:child_process';
import { readFile, readdir } from 'node:fs/promises';
import { join, relative, resolve, dirname } from 'node:path';
-import { existsSync, mkdirSync, copyFileSync, readFileSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import {
+ existsSync,
+ mkdirSync,
+ mkdtempSync,
+ copyFileSync,
+ readFileSync,
+ readdirSync,
+ rmSync,
+ statSync,
+ writeFileSync,
+} from 'node:fs';
import type { Dirent } from 'node:fs';
@@ -62,10 +73,40 @@ const FILTERS = {
'client/**',
'packages/**',
'eslint.config.mjs',
+ 'eslint-suppressions.json',
'.github/workflows/static-checks.yml',
'!**.md',
],
eslint_config: ['eslint.config.mjs', '.github/workflows/static-checks.yml'],
+ // The design-rule backlog is data the lint reads, so a diff that only edits it
+ // reaches no lintable file and would otherwise be checked by nothing.
+ // Deleting or renaming a recorded file has to reach this group too: the entry
+ // it leaves behind would silence whatever next takes that path.
+ // Deleting or renaming a recorded file has to reach this group, and so does the
+ // config: narrowing a rule or widening a contract changes how many violations
+ // an entry stands for without touching a single source file.
+ suppressions: [
+ 'eslint-suppressions.json',
+ '**/eslint-suppressions.json',
+ 'client/src/**',
+ 'packages/client/src/**',
+ /** The bundle the rules resolve primitives through is named by the library's
+ * manifest, produced by its build config and shaped by its compiler
+ * options. */
+ 'packages/client/package.json',
+ 'packages/client/tsdown.config.mjs',
+ 'packages/client/tsconfig.json',
+ 'eslint.config.mjs',
+ /** The plugin is a dependency: a bump changes what the rules classify, and a
+ * removal takes the rules with it, neither of which touches a source file. */
+ 'package.json',
+ 'package-lock.json',
+ /** This runner is the gate: `validateSuppressions` is what a recorded count
+ * is measured against, so a change to it has to run against the record. */
+ 'scripts/static-checks.mts',
+ '.github/workflows/static-checks.yml',
+ '!**.md',
+ ],
config: ['api/**', 'config/**', 'packages/**', '.github/workflows/static-checks.yml', '!**.md'],
i18n: [
'api/**',
@@ -136,6 +177,94 @@ const PACKAGE_JSON_FILES = [
'packages/data-schemas/package.json',
];
+/** The recorded design-rule backlog ESLint reads on every lint. */
+const SUPPRESSIONS_FILE = 'eslint-suppressions.json';
+
+/** Files per ESLint run when checking recorded counts: the whole baseline is
+ * hundreds of paths, and one argv has a platform limit. */
+const SUPPRESSION_LINT_CHUNK = 150;
+
+/** Sources the design rules read: the extensions ESLint lints, which is also
+ * what carries a primitive's `cva` variants. */
+const DESIGN_SOURCE = /\.(?:ts|tsx|js|jsx)$/;
+
+/** Sources that look like design sources and cannot be one. Every design rule is
+ * off inside a spec (`eslint.config.mjs`), and `packages/client/tsconfig.json`
+ * keeps specs out of the bundle the caller rules resolve primitives through, so
+ * a spec carries no `cva` variant to compare against and can report no design
+ * diagnostic of its own. Editing one moves no count, in its own file or
+ * anywhere else. */
+const DESIGN_TEST_SOURCE = /\.(?:test|spec)\.(?:ts|tsx|js|jsx)$/;
+
+/** What the design rules are configured by, and what they are installed from:
+ * narrowing a rule, widening a contract, or upgrading the plugin all change
+ * what every recorded count stands for, without touching a source file. */
+const DESIGN_INPUTS = ['eslint.config.mjs', 'package.json', 'package-lock.json'];
+
+/** Where the rules read component metadata from: the published library and the
+ * app-local path `componentImports` marks as a component source. A change in
+ * either moves what the caller rules report in files the diff never touches. */
+const DESIGN_METADATA_ROOTS = ['packages/client/src/', 'client/src/components/ui/'];
+
+/** The library's own manifest, build config and compiler options decide what is
+ * emitted into the bundle the rules resolve primitives through — the entry
+ * point, the `~/*` path mapping, what `include`/`exclude` leaves out — so they
+ * move what the caller rules report as surely as a `cva` variant does. The
+ * repository's own build caches key on `<package>/tsconfig*.json` for the same
+ * reason. */
+const DESIGN_METADATA_FILES = [
+ 'packages/client/package.json',
+ 'packages/client/tsdown.config.mjs',
+ 'packages/client/tsconfig.json',
+];
+
+/** The two trees the design rules police, and what `lint:design:record` records. */
+const DESIGN_ROOTS = ['client/src', 'packages/client/src'];
+
+/**
+ * This runner is the gate the record is measured against: `unusedCapacity` and
+ * `inlineDirectives` decide which files a recorded count is compared with and
+ * what counts as a hole. A change to them moves that verdict for every entry
+ * while touching no source file and no config, so it revalidates the whole
+ * record — the only way the change is exercised at all.
+ */
+const GATE_SOURCE = 'scripts/static-checks.mts';
+
+/**
+ * ESLint's on-disk suppressions shape, which the recorded baseline claims to be:
+ * a count per file, per rule. `validateSuppressions` is what checks the claim, so
+ * the leaf stays `unknown` — a string or a float there is one of the failures.
+ */
+type SuppressionsFile = Record<string, Record<string, { count?: unknown }>>;
+
+/**
+ * One file's entry in ESLint's JSON report, as the checks here read it. A
+ * suppressed message carries its text too: the swap check compares messages,
+ * and what the baseline silences is exactly what it has to see.
+ */
+type LintReport = {
+ filePath: string;
+ /** `message` also carries ESLint's unused-directive text, where `ruleId` is null. */
+ messages: { ruleId: string | null; message?: string }[];
+ suppressedMessages?: {
+ ruleId: string | null;
+ message?: string;
+ suppressions?: { kind: string; justification?: string }[];
+ }[];
+};
+
+/** A path in ESLint's report, as the repository names it. */
+const reportedPath = (filePath: string): string =>
+ filePath.startsWith(ROOT)
+ ? filePath
+ .slice(ROOT.length + 1)
+ .split('\\')
+ .join('/')
+ : filePath;
+
+/** `@shadcn/lint`'s rule map, the authority on which recorded rule names exist. */
+type SuppressionsPlugin = { plugin: { rules: Record<string, unknown> } };
+
const I18N_FILE = 'client/src/locales/en/translation.json';
const I18N_SOURCE_DIRS = [
'client/src',
@@ -417,12 +546,21 @@ interface Target {
* so they never hand a deleted path to a tool. Activating gates off the
* narrowed list would let a delete-only commit — the last reference to a
* translation key, say — slip past the i18n and depcheck gates.
+ *
+ * `--no-renames` is what makes a rename two paths. Git's rename detection
+ * reports `git mv eslint-suppressions.json backlog.json` as the destination
+ * alone, so the group that owns the source — the baseline that just
+ * disappeared, the recorded design source that just left its root — is never
+ * activated and nothing notices the departure. Selection is about which paths a
+ * diff touches, and a rename touches both; the one place that wants the pairing
+ * asks for it separately, with `--name-status -M`.
*/
function diffPaths(args: string[]): { files: string[]; existing: string[] } {
const split = (output: string): string[] => output.split('\0').filter(Boolean);
+ const named = [...args, '--no-renames'];
return {
- files: split(captureStdout(GIT, args)),
- existing: split(captureStdout(GIT, [...args, '--diff-filter=ACMRTUXB'])),
+ files: split(captureStdout(GIT, named)),
+ existing: split(captureStdout(GIT, [...named, '--diff-filter=ACMRTUXB'])),
};
}
@@ -546,9 +684,17 @@ function lintChangedFiles(context: CheckContext): CheckOutcome {
}
const eslint = resolveBin('eslint');
if (!eslint) return missingBin('eslint');
+ const built = buildClientPackage();
+ if (built) return built;
// --no-warn-ignored: changed files under config-ignored paths
// (e.g. packages/data-schemas/misc/**) must not fail --max-warnings=0.
+ // --pass-on-unpruned-suppressions: the @shadcn/lint design rules run at error
+ // against the recorded backlog in eslint-suppressions.json, and fixing one of
+ // those violations leaves its suppression unused, which would otherwise fail the
+ // very diff that fixed it. `npm run lint:design:prune` tightens the counts. The
+ // CI step passes the same flag; a local run that failed here would be a lie about
+ // what the pull request will do.
const result = runOnFiles(
eslint,
[
@@ -557,6 +703,7 @@ function lintChangedFiles(context: CheckContext): CheckOutcome {
'eslint.config.mjs',
'--no-warn-ignored',
'--max-warnings=0',
+ '--pass-on-unpruned-suppressions',
'--',
],
context.sourceFiles,
@@ -634,6 +781,905 @@ async function validatePackageJson(): Promise<CheckOutcome> {
return { ok: invalid.length === 0, output: invalid.join('\n') };
}
+/**
+ * The design-rule backlog is the one input to `npm run lint` that is data rather
+ * than code: ESLint loads `eslint-suppressions.json` on every run and silences up
+ * to the count it records for each file and rule. The changed-file lint only ever
+ * points ESLint at JS/TS sources, so a diff that edits the baseline alone reaches
+ * no lintable file — nothing else reads it. Four ways it can stop saying what it
+ * claims: a shape ESLint cannot load, a count no run can ever reach, a rule the
+ * plugin does not define (a rename leaves the old key silencing nothing), and a
+ * path that no longer exists, which is the entry `--prune-suppressions` clears and
+ * which would otherwise silence a future file that reuses the path.
+ *
+ * A diff may carry a baseline that is not the repository's — a generated one, or
+ * a second one under a lane's own directory — so every suppressions file the
+ * target names is validated, and the repository's own is always among them.
+ */
+async function validateSuppressions(context: CheckContext): Promise<CheckOutcome> {
+ const named = context.files.filter((file) => file.endsWith(`/${SUPPRESSIONS_FILE}`));
+ // A diff that deletes a baseline still activates this group, and the
+ // changed-file lint would see no source file to report through: the deletion
+ // has to fail here rather than read as "nothing to validate". That holds for
+ // a baseline under a lane's own directory as much as for the repository's:
+ // what either one silences goes back to being reported, or stops being
+ // reported, and no other step reads it.
+ const missing = [SUPPRESSIONS_FILE, ...named].filter((file) => !existsSync(resolve(ROOT, file)));
+ if (missing.length > 0) {
+ return {
+ ok: false,
+ output: missing
+ .map(
+ (file) =>
+ `${file} is missing: the design rules run at error against it, so removing it changes what they report and nothing else reads it.`,
+ )
+ .join('\n'),
+ hints: ['Restore it, or re-record it with: npm run lint:design:suppress'],
+ };
+ }
+ const targets = [SUPPRESSIONS_FILE, ...named];
+
+ const problems: string[] = [];
+ // Read the rule names from the plugin rather than listing them here, so a rule
+ // this stack has not enabled yet is still a valid key and a renamed one is not.
+ let known: Set<string>;
+ try {
+ const { plugin } = (await import('@shadcn/lint')) as SuppressionsPlugin;
+ known = new Set(Object.keys(plugin.rules).map((rule) => `shadcn/${rule}`));
+ } catch (error) {
+ return { ok: false, output: `@shadcn/lint did not load: ${(error as Error).message}` };
+ }
+
+ /** Every lint below classifies against the primitives' `cva` variants, which
+ * the rules read through `packages/client/dist`. Built here rather than
+ * inside the capacity scan: the directive check lints first, and without the
+ * metadata it reports strictly fewer design diagnostics — so a comment
+ * silencing a `no-restyle` violation would be invisible in both of its runs. */
+ const built = buildClientPackage();
+ if (built) return built;
+
+ problems.push(...workflowSelectsWhatItFilters());
+ problems.push(...(await inlineDirectives(context)));
+ for (const target of targets) {
+ problems.push(...(await suppressionProblems(target, known)));
+ problems.push(...(await unusedCapacity(target, context)));
+ }
+
+ return {
+ ok: problems.length === 0,
+ output: problems.join('\n'),
+ hints: [
+ 'Drop entries for paths that moved or were fixed with: npm run lint:design:prune',
+ 'Re-record a moved file with: npm run lint:design:suppress',
+ ],
+ };
+}
+
+/**
+ * The Static Checks lane names its files twice: once in `on.pull_request.paths`,
+ * which decides whether the workflow runs at all, and once in the job's own
+ * `suppressions` filter, which decides whether this check runs inside it. A
+ * pattern in the second that no pattern in the first matches is a file this
+ * gate claims to cover and CI never sees — a nested baseline outside the source
+ * trees the trigger enumerates was exactly that.
+ *
+ * Asked here rather than in a spec because the file that breaks it is
+ * `.github/workflows/static-checks.yml`, and this group is what a change to it
+ * runs. A test in the mock Playwright lane cannot make that claim: that lane's
+ * own trigger excludes `.github/workflows/**` apart from its own file, so a
+ * workflow-only diff would never execute the assertion guarding it.
+ */
+function workflowSelectsWhatItFilters(): string[] {
+ const path = '.github/workflows/static-checks.yml';
+ let workflow: string;
+ try {
+ workflow = readFileSync(resolve(ROOT, path), 'utf8');
+ } catch {
+ return [`${path} could not be read; the lane it defines is what this check runs in`];
+ }
+ /** A block ends at its first sibling, which sits at the same indent: a
+ * terminator that only fires on shallower lines runs on through the next
+ * filter and reads its patterns as this one's. */
+ const list = (section: RegExp, indent: number): string[] =>
+ (workflow.split(section)[1] ?? '')
+ .split(new RegExp(`^ {0,${indent}}\\S`, 'm'))[0]
+ .split('\n')
+ .map((line) => new RegExp(`^ {${indent + 2}}- '([^']+)'$`).exec(line)?.[1])
+ .filter((pattern): pattern is string => Boolean(pattern) && !pattern.startsWith('!'));
+
+ const trigger = list(/^ {4}paths:$/m, 4);
+ const lane = list(/^ {12}suppressions:$/m, 12);
+ if (trigger.length === 0 || lane.length === 0) {
+ return [`${path}: the trigger or the suppressions filter could not be read`];
+ }
+ /** GitHub's filter syntax, in the shapes both lists use: an exact path, a
+ * subtree, and a basename at any depth. */
+ const starts = (file: string, pattern: string): boolean => {
+ if (pattern.endsWith('/**')) return file.startsWith(`${pattern.slice(0, -3)}/`);
+ if (pattern.startsWith('**/')) {
+ const name = pattern.slice(3);
+ return file === name || file.endsWith(`/${name}`);
+ }
+ return file === pattern;
+ };
+ return lane
+ .map((pattern) => pattern.replace('**/', 'e2e/fixtures/').replace('/**', '/Probe.tsx'))
+ .filter((file) => !trigger.some((pattern) => starts(file, pattern)))
+ .map(
+ (file) =>
+ `${path}: the suppressions filter selects ${file}, which no \`on.pull_request.paths\` pattern starts the workflow for`,
+ );
+}
+
+/**
+ * Design-rule violations belong in the record, where they are counted and can be
+ * pruned; an inline comment is the one way to silence one that leaves nothing
+ * behind to review. A file with no entry can carry one and pass every other
+ * check here, so the diff's own sources are read for one, two ways.
+ *
+ * Asked of ESLint twice: the same files with and without `--no-inline-config`.
+ * Any design-rule diagnostic that only the second run reports was silenced by a
+ * comment, whatever its spelling. That is the runtime half, and it only ever
+ * sees a comment that is silencing something today.
+ *
+ * The other half reads the comments themselves, out of the parser rather than
+ * out of the text, so a string or a JSX attribute that looks like a directive is
+ * not one: a disable naming a design rule, a blanket disable (which covers the
+ * design rules whatever else it covers), and inline `eslint rule: severity`
+ * configuration naming a design rule. None of those has to be suppressing
+ * anything yet — a directive over a clean file silences the first violation
+ * anyone adds, and ESLint's own unused-directive report cannot see a blanket one
+ * that is busy silencing some other rule. Neither design root carries one today.
+ *
+ * Specs are left out. Every design rule is already off inside one, so a
+ * directive there — blanket or named — takes no design diagnostic out of play
+ * now or later, and rejecting it would be this gate failing a commit over a
+ * comment about some other rule entirely.
+ */
+async function inlineDirectives(context: CheckContext): Promise<string[]> {
+ const files = context.sourceFiles.filter(
+ (file) =>
+ DESIGN_SOURCE.test(file) &&
+ !DESIGN_TEST_SOURCE.test(file) &&
+ DESIGN_ROOTS.some((root) => file.startsWith(`${root}/`)) &&
+ existsSync(resolve(ROOT, file)),
+ );
+ if (files.length === 0) return [];
+ const eslint = resolveBin('eslint');
+ if (!eslint) return [];
+
+ /** A directive-suppressed diagnostic is still reported, under
+ * `suppressedMessages`, so the configured run counts only what the baseline
+ * silenced; everything an inline comment took out of play is then exactly the
+ * difference against the run that ignores inline configuration. */
+ const count = (
+ chunk: string[],
+ extra: string[],
+ baselineOnly: boolean,
+ ): Map<string, number> | string => {
+ const directory = mkdtempSync(join(tmpdir(), 'librechat-directives-'));
+ const reportPath = join(directory, 'report.json');
+ const result = runCommand(eslint, [
+ '--no-error-on-unmatched-pattern',
+ '--config',
+ 'eslint.config.mjs',
+ '--no-warn-ignored',
+ '--pass-on-unpruned-suppressions',
+ ...extra,
+ '--format',
+ 'json',
+ '-o',
+ reportPath,
+ '--',
+ ...chunk,
+ ]);
+ if (result.status > 1 || !existsSync(reportPath)) {
+ rmSync(directory, { force: true, recursive: true });
+ return `the design sources could not be linted for inline directives (exit ${result.status})`;
+ }
+ const report = JSON.parse(readFileSync(reportPath, 'utf8')) as LintReport[];
+ rmSync(directory, { force: true, recursive: true });
+ const counts = new Map<string, number>();
+ for (const file of report) {
+ const relative = reportedPath(file.filePath);
+ const suppressed = (file.suppressedMessages ?? []).filter((message) =>
+ baselineOnly
+ ? message.suppressions?.every((suppression) => suppression.kind === 'file')
+ : true,
+ );
+ for (const message of [...file.messages, ...suppressed]) {
+ if (!message.ruleId?.startsWith('shadcn/')) continue;
+ const key = `${relative}\u0000${message.ruleId}`;
+ counts.set(key, (counts.get(key) ?? 0) + 1);
+ }
+ }
+ return counts;
+ };
+
+ const problems = new Set(await directiveComments(files));
+ for (let index = 0; index < files.length; index += SUPPRESSION_LINT_CHUNK) {
+ const chunk = files.slice(index, index + SUPPRESSION_LINT_CHUNK);
+ const configured = count(chunk, [], true);
+ if (typeof configured === 'string') return [configured];
+ const ignored = count(chunk, ['--no-inline-config'], false);
+ if (typeof ignored === 'string') return [ignored];
+ for (const [key, total] of ignored) {
+ if (total <= (configured.get(key) ?? 0)) continue;
+ const [file, rule] = key.split('\u0000');
+ problems.add(
+ `${file}: ${rule} is silenced by an inline comment; record it in ${SUPPRESSIONS_FILE} instead, where the count is reviewable and \`npm run lint:design:prune\` can retire it`,
+ );
+ }
+ }
+ return [...problems];
+}
+
+/**
+ * Every directive comment in the diff's design sources that takes a design rule
+ * out of play, read from the parser's comment list so a string or a JSX
+ * attribute that reads like one is not one. ESLint's description syntax (`--`)
+ * is stripped first, so a justified directive is the same directive.
+ *
+ * A file ESLint cannot parse is left to ESLint, which reports it as a parse
+ * error on its own account.
+ */
+async function directiveComments(files: string[]): Promise<string[]> {
+ let parse: (code: string, options: Record<string, unknown>) => { comments?: { value: string }[] };
+ try {
+ ({ parse } = (await import('@typescript-eslint/parser')) as {
+ parse: typeof parse;
+ });
+ } catch (error) {
+ return [`the design sources could not be read for directives: ${(error as Error).message}`];
+ }
+
+ const problems: string[] = [];
+ for (const file of files) {
+ let comments: { value: string }[];
+ try {
+ const source = readFileSync(resolve(ROOT, file), 'utf8');
+ comments =
+ parse(source, { comment: true, jsx: true, loc: false, range: false }).comments ?? [];
+ } catch {
+ continue;
+ }
+ for (const comment of comments) {
+ /** ESLint reads everything after ` -- ` as the author's justification. */
+ const body = comment.value
+ .trim()
+ .split(/\s+--\s+/)[0]
+ .trim();
+ const disable = /^eslint-disable(?:-next-line|-line)?\b/.exec(body);
+ if (disable) {
+ const named = body
+ .slice(disable[0].length)
+ .split(',')
+ .map((rule) => rule.trim())
+ .filter(Boolean);
+ if (named.length === 0) {
+ problems.push(
+ `${file}: a blanket \`${body}\` covers the design rules too, now or the first time this file violates one; record what is owed in ${SUPPRESSIONS_FILE} instead`,
+ );
+ }
+ for (const rule of named.filter((rule) => rule.startsWith('shadcn/'))) {
+ problems.push(
+ `${file}: ${rule} is disabled by an inline comment; record it in ${SUPPRESSIONS_FILE} instead, where the count is reviewable and \`npm run lint:design:prune\` can retire it`,
+ );
+ }
+ continue;
+ }
+ /** `/* eslint rule: severity *\/` does not suppress a violation, it turns
+ * the rule off for the file — dormant or not, that is the same hole.
+ *
+ * ESLint reads what follows as an object literal, so a rule key is
+ * whatever the token decodes to, not how it is written:
+ * `shadcn/no-raw-colors`, `"shadcn/no-raw-colors"`,
+ * `"shadcn\/no-raw-colors"` and `"shadcn\u002fno-raw-colors"` are one
+ * key spelled four ways, and ESLint disables the rule for all four.
+ * Matching the spelling is what kept losing to the next one; decoding
+ * the token is what stops the question being about spelling at all. */
+ if (!/^eslint\s/.test(body)) continue;
+ for (const [, doubled, singled, bare] of body.matchAll(
+ /(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'|([A-Za-z@][\w@\-./]*))\s*:/g,
+ )) {
+ const rule = decodeRuleKey(doubled ?? singled ?? bare ?? '');
+ if (!rule.startsWith('shadcn/')) continue;
+ problems.push(
+ `${file}: ${rule} is configured by an inline comment; the record is where a design rule is answered, not the file that owes it`,
+ );
+ }
+ }
+ }
+ return problems;
+}
+
+/**
+ * One rule key from an inline `eslint` configuration comment, as ESLint reads
+ * it rather than as it was typed. A quoted key is a JSON string, so its escapes
+ * are part of the encoding and not of the name: `\/` and `\u002f` are both `/`.
+ * An undecodable token is returned unchanged — ESLint would not honour it
+ * either, and inventing a name here would invent a violation.
+ */
+function decodeRuleKey(token: string): string {
+ if (!token.includes('\\')) return token;
+ try {
+ return JSON.parse(`"${token.replace(/\\'/g, "'").replace(/"/g, '\\"')}"`) as string;
+ } catch {
+ return token;
+ }
+}
+
+/** Everything wrong with one recorded baseline, named by its own path. */
+async function suppressionProblems(target: string, known: Set<string>): Promise<string[]> {
+ let parsed: unknown;
+ try {
+ parsed = JSON.parse(await readFile(resolve(ROOT, target), 'utf8'));
+ } catch (error) {
+ return [`${target}: ${(error as Error).message}`];
+ }
+
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
+ return [
+ `${target}: expected an object keyed by file path, got ${Array.isArray(parsed) ? 'an array' : typeof parsed}`,
+ ];
+ }
+
+ const problems: string[] = [];
+ for (const [file, rules] of Object.entries(parsed as SuppressionsFile)) {
+ const where = target === SUPPRESSIONS_FILE ? file : `${target} → ${file}`;
+ if (typeof rules !== 'object' || rules === null || Array.isArray(rules)) {
+ problems.push(`${where}: expected an object keyed by rule name`);
+ continue;
+ }
+ if (!existsSync(resolve(ROOT, file))) {
+ problems.push(`${where}: recorded path no longer exists`);
+ }
+ for (const [rule, entry] of Object.entries(rules)) {
+ if (!known.has(rule)) {
+ problems.push(`${where}: ${rule} is not a rule @shadcn/lint defines`);
+ }
+ const count = typeof entry === 'object' && entry !== null ? entry.count : undefined;
+ if (typeof count !== 'number' || !Number.isInteger(count) || count < 1) {
+ problems.push(
+ `${where}: ${rule} records ${JSON.stringify(count) ?? 'nothing'} where a positive integer count belongs`,
+ );
+ }
+ }
+ }
+ return problems;
+}
+
+/**
+ * A recorded count that no longer matches the file is a hole in both
+ * directions. Higher than the file's violations is capacity the next change can
+ * spend: `--pass-on-unpruned-suppressions` keeps the diff that fixed a violation
+ * committable, and nothing else asks for the count to come down, so a later
+ * violation of the same rule in the same file is silenced by the slack. Lower
+ * than the file's violations only fails while the file is in the changed-file
+ * lint's scope; recorded against an untouched file it is a lint that starts
+ * failing for whoever edits it next. A count against a path no design-rule lint
+ * reaches at all is the third shape of the same hole: nothing spends it, the
+ * prune never sees it, and it silences whatever is linted at that path later.
+ *
+ * The set checked is the files this diff touches plus the files whose entries it
+ * edits — and everything recorded when the baseline is the only thing that
+ * changed, since that edit is precisely the one nothing else re-reads, or when
+ * the diff changes a component-library source, the rules' own config, the
+ * manifests the plugin is installed from, or this runner: a primitive's
+ * variants, the config's contracts, the plugin's version and the gate's own
+ * rules each decide what every recorded count stands for. A baseline named in
+ * the diff is always checked in full: what it silences is its whole purpose.
+ */
+async function unusedCapacity(target: string, context: CheckContext): Promise<string[]> {
+ let recorded: SuppressionsFile;
+ try {
+ recorded = JSON.parse(await readFile(resolve(ROOT, target), 'utf8')) as SuppressionsFile;
+ } catch {
+ // Shape problems are reported by the validation above; nothing to add here.
+ return [];
+ }
+ if (typeof recorded !== 'object' || recorded === null || Array.isArray(recorded)) return [];
+
+ const touched = new Set(context.sourceFiles.filter((file) => recorded[file]));
+ /** Entries this diff edits, including the ones it removes: dropping an entry
+ * while the file still violates the rule is the same hole wearing the other
+ * hat, and the changed-file lint only sees it if the file itself changed. */
+ for (const file of editedEntries(target, context)) touched.add(file);
+ /** Three kinds of change move counts in files the diff never touches, and
+ * nothing else re-reads those entries — the changed-file lint is scoped to
+ * the diff and the caller rules are off inside the library. A primitive's
+ * `cva` variants are what `no-restyle` compares a caller's className
+ * against; the config decides which classes each rule can classify at all;
+ * and this runner decides what a count has to match. Any of them validates
+ * the whole record.
+ *
+ * A spec under either root is none of them: nothing it contains reaches the
+ * bundle or carries a variant, so it cannot move a caller's diagnostic and
+ * does not buy a two-root sweep. Both roots are full of them. */
+ const wholeRecord = context.files.some(
+ (file) =>
+ file === GATE_SOURCE ||
+ DESIGN_INPUTS.includes(file) ||
+ DESIGN_METADATA_FILES.includes(file) ||
+ (DESIGN_SOURCE.test(file) &&
+ !DESIGN_TEST_SOURCE.test(file) &&
+ DESIGN_METADATA_ROOTS.some((root) => file.startsWith(root))),
+ );
+ /** When the whole record is in question the targets are the roots themselves,
+ * not the recorded paths: a primitive's new contract can give a caller that
+ * never owed anything its first violation, and a file with no entry is
+ * exactly what enumerating the record cannot see. `touched` is unioned in so
+ * a path this diff removed from a nested baseline stays checked. */
+ const files = (
+ target !== SUPPRESSIONS_FILE
+ ? /** A nested baseline is checked in full, and the entries this diff
+ * removed from it belong to that full set: the source they used to
+ * speak for still violates the rule, and nothing else re-reads it. */
+ [...new Set([...Object.keys(recorded), ...touched])]
+ : wholeRecord
+ ? [...new Set([...DESIGN_ROOTS, ...touched])]
+ : context.files.includes(target)
+ ? /** The baseline is in the diff: what it silences is its whole
+ * purpose, so every path it records is read, not only the entries
+ * the diff moved. */
+ [...new Set([...Object.keys(recorded), ...touched])]
+ : [...touched]
+ ).filter((file) => existsSync(resolve(ROOT, file)));
+ if (files.length === 0) return [];
+ /** The recorded paths this run put a question to. A root sweep asks about
+ * every one of them; otherwise it is the explicit list. Either way an entry
+ * ESLint then says nothing about is an entry that silences nothing, which is
+ * checked once the report is in. */
+ const asked = (
+ (target === SUPPRESSIONS_FILE && wholeRecord) || context.files.includes(target)
+ ? Object.keys(recorded)
+ : files
+ ).filter((file) => recorded[file] && existsSync(resolve(ROOT, file)));
+
+ const eslint = resolveBin('eslint');
+ if (!eslint) return [`${target}: ESLint is not installed, so recorded counts cannot be checked`];
+ const built = buildClientPackage();
+ if (built) return [`${target}: ${built.output ?? 'the component library did not build'}`];
+
+ /** Chunked by hand, each chunk's report read from its own file: concatenated
+ * JSON arrays cannot be rejoined safely — a rule message may contain `][` —
+ * and ESLint's exit status has to be read, because 2 means it never linted. */
+ const report: LintReport[] = [];
+ for (let index = 0; index < files.length; index += SUPPRESSION_LINT_CHUNK) {
+ const chunk = files.slice(index, index + SUPPRESSION_LINT_CHUNK);
+ const directory = mkdtempSync(join(tmpdir(), 'librechat-suppressions-'));
+ const reportPath = join(directory, 'report.json');
+ const result = runCommand(eslint, [
+ '--no-error-on-unmatched-pattern',
+ '--config',
+ 'eslint.config.mjs',
+ '--no-warn-ignored',
+ '--pass-on-unpruned-suppressions',
+ /** Read the baseline under test, not the repository's: a nested one is
+ * checked against what it silences, not against what the root records. */
+ '--suppressions-location',
+ resolve(ROOT, target),
+ '--format',
+ 'json',
+ '-o',
+ reportPath,
+ '--',
+ ...chunk,
+ ]);
+ if (result.status > 1 || !existsSync(reportPath)) {
+ rmSync(directory, { force: true, recursive: true });
+ return [
+ `${target}: ESLint could not report on the recorded files (exit ${result.status}):\n${result.output}`,
+ ];
+ }
+ report.push(...(JSON.parse(readFileSync(reportPath, 'utf8')) as LintReport[]));
+ rmSync(directory, { force: true, recursive: true });
+ }
+ const problems: string[] = [];
+ const reported = new Set(report.map((file) => reportedPath(file.filePath)));
+ /** A recorded path ESLint does not report on is dormant, not clean: the flat
+ * config ignores it, or it lies outside the roots the rules police. Nothing
+ * spends that count today and nothing prunes it, so it is waiting for
+ * whatever is next linted at that path. */
+ for (const file of asked) {
+ if (reported.has(file)) continue;
+ problems.push(
+ `${file}: recorded but no design-rule lint reports on it — the flat config ignores it, or it is outside ${DESIGN_ROOTS.join(' and ')} — so the entry silences nothing and would silence whatever is linted at this path later`,
+ );
+ }
+ problems.push(...(await introducedWithinAllowance(target, recorded, context, report)));
+ for (const file of report) {
+ const relative = reportedPath(file.filePath);
+ const actual = new Map<string, number>();
+ for (const message of [...file.messages, ...(file.suppressedMessages ?? [])]) {
+ if (message.ruleId?.startsWith('shadcn/')) {
+ actual.set(message.ruleId, (actual.get(message.ruleId) ?? 0) + 1);
+ }
+ }
+ for (const [rule, count] of actual) {
+ if (recorded[relative]?.[rule] === undefined && count > 0) {
+ problems.push(
+ `${relative}: ${rule} records nothing but the file has ${count}; the lint fails for whoever edits it next`,
+ );
+ }
+ }
+ for (const [rule, entry] of Object.entries(recorded[relative] ?? {})) {
+ const count = typeof entry === 'object' && entry !== null ? entry.count : undefined;
+ if (typeof count !== 'number') continue;
+ const now = actual.get(rule) ?? 0;
+ if (now < count) {
+ problems.push(
+ `${relative}: ${rule} records ${count} but the file now has ${now}; the unused ${count - now} would silence a later violation`,
+ );
+ }
+ if (now > count) {
+ problems.push(
+ `${relative}: ${rule} records ${count} but the file now has ${now}; the ${now - count} beyond the record fail the lint for whoever edits it next`,
+ );
+ }
+ }
+ }
+ return problems;
+}
+
+/**
+ * The design-rule violations this diff adds to a file that already records some
+ * and does not grow its record to cover them. The record is a budget per file
+ * and rule, so swapping one raw colour for another keeps the total equal and
+ * the changed-file lint suppresses the new one inside the old allowance — the
+ * debt changes hands and nothing says so.
+ *
+ * What the count cannot distinguish, the diagnostics can: each file's version at
+ * the base is linted as itself, through ESLint's API so one process answers for
+ * the whole diff, and a message the head reports that the base did not is a
+ * violation this change introduced. Introducing one is allowed when the record
+ * says so out loud — the recipe in CLAUDE.md is to record what a change owes,
+ * and a count that grows is a visible line in the diff — so what is reported is
+ * the violations beyond that growth. A violation that only moved keeps its
+ * message and is not reported; a file with no version at the base brings no
+ * allowance with it; a renamed file brings the one its violations came with.
+ *
+ * Specs are left out: with every design rule off inside one, neither its base
+ * nor its head version can report a design diagnostic, so fetching the base
+ * version and linting it answers a question with one possible answer.
+ */
+async function introducedWithinAllowance(
+ target: string,
+ recorded: SuppressionsFile,
+ context: CheckContext,
+ head: LintReport[],
+): Promise<string[]> {
+ const changed = new Set(
+ context.sourceFiles.filter(
+ (file) =>
+ DESIGN_SOURCE.test(file) &&
+ !DESIGN_TEST_SOURCE.test(file) &&
+ DESIGN_ROOTS.some((root) => file.startsWith(`${root}/`)),
+ ),
+ );
+ const subjects = head.filter((file) => changed.has(reportedPath(file.filePath)));
+ if (subjects.length === 0) return [];
+
+ const baseRef = baseCommit();
+ /** Where each file came from: a rename carries its violations with it, and
+ * asking for the new path at the base would call every one of them new. */
+ const renames = new Map<string, string>();
+ const renamed = runCommand(GIT, ['diff', '--name-status', '-M', baseRef, '--']);
+ if (renamed.status === 0) {
+ for (const line of renamed.stdout.split('\n')) {
+ /** Trimmed: git's output carries CRLF on some checkouts, and a `\r` would
+ * key the map on a path no report ever names. */
+ const [status, from, to] = line.trim().split('\t');
+ if (status?.startsWith('R') && from && to) renames.set(to, from);
+ }
+ }
+
+ /** Whether a file existed at the base, and under which name — asked of git,
+ * not inferred from its contents: a tracked empty file reads the same as a
+ * missing one, and a rename means both the source and the entry that speaks
+ * for it lived under the old path. A base commit that is not in this clone
+ * cannot answer at all, and saying so is better than calling every changed
+ * file new. */
+ if (runCommand(GIT, ['cat-file', '-e', `${baseRef}^{commit}`]).status !== 0) {
+ return [
+ `the violations this change introduces could not be read: ${baseRef} is not in this clone, so nothing says what these files held before`,
+ ];
+ }
+ const before = new Map<string, { path: string; source: string } | undefined>();
+ for (const file of subjects) {
+ const relative = reportedPath(file.filePath);
+ const path = renames.get(relative) ?? relative;
+ const source = runCommand(GIT, ['show', `${baseRef}:${path}`]);
+ before.set(relative, source.status === 0 ? { path, source: source.stdout } : undefined);
+ }
+
+ let lintText: (source: string, options: { filePath: string }) => Promise<LintReport[]>;
+ try {
+ const { ESLint } = createRequire(import.meta.url)('eslint') as {
+ ESLint: new (options: Record<string, unknown>) => {
+ lintText: (source: string, options: { filePath: string }) => Promise<LintReport[]>;
+ };
+ };
+ const instance = new ESLint({
+ cwd: ROOT,
+ overrideConfigFile: resolve(ROOT, 'eslint.config.mjs'),
+ warnIgnored: false,
+ });
+ lintText = (source, options) => instance.lintText(source, options);
+ } catch (error) {
+ return [`the base versions could not be linted: ${(error as Error).message}`];
+ }
+
+ const signatures = (reports: LintReport[]): string[] =>
+ reports
+ .flatMap((file) => [...file.messages, ...(file.suppressedMessages ?? [])])
+ .filter((message) => message.ruleId?.startsWith('shadcn/'))
+ .map((message) => `${message.ruleId}: ${message.message ?? ''}`);
+
+ /** The record as the base held it: how much an entry grew between there and
+ * here is what this change may add. A count that goes up is a line in the
+ * diff and the recipe CLAUDE.md documents; a count that stands still is the
+ * swap. A baseline the base cannot parse grants nothing, and the shape
+ * checks say why. */
+ let recordedBefore: SuppressionsFile = {};
+ const previousRecord = runCommand(GIT, ['show', `${baseRef}:${target}`]);
+ if (previousRecord.status === 0) {
+ try {
+ recordedBefore = JSON.parse(previousRecord.stdout) as SuppressionsFile;
+ } catch {
+ recordedBefore = {};
+ }
+ }
+ const countOf = (record: SuppressionsFile, file: string, rule: string): number => {
+ const entry = record[file]?.[rule]?.count;
+ return typeof entry === 'number' ? entry : 0;
+ };
+
+ const problems: string[] = [];
+ for (const file of subjects) {
+ const relative = reportedPath(file.filePath);
+ const inheritedFrom = before.get(relative);
+ /** A file the change adds owes everything in it: the record may not grow to
+ * cover a violation written in the same commit as its entry, or the rules
+ * would police nothing but the tree they landed on. A file that existed at
+ * the base — renamed or not — brings its allowance and may grow it, and a
+ * rename's allowance is the one recorded under the name it had. */
+ const inherited = inheritedFrom !== undefined;
+ const had = new Map<string, number>();
+ if (inheritedFrom !== undefined) {
+ /** Linted as the path it had, not the one it has: moving a component out
+ * of the library and into the app enters a stricter scope, and reading
+ * the old contents under the new path would let the destination's own
+ * diagnostics appear on both sides and pass as inherited. */
+ const was = resolve(ROOT, inheritedFrom.path);
+ for (const signature of signatures(await lintText(inheritedFrom.source, { filePath: was }))) {
+ had.set(signature, (had.get(signature) ?? 0) + 1);
+ }
+ }
+ const allowed = new Map<string, number>();
+ for (const signature of signatures([file])) {
+ const remaining = had.get(signature) ?? 0;
+ if (remaining > 0) {
+ had.set(signature, remaining - 1);
+ continue;
+ }
+ /** Beyond what the base held: chargeable to this change unless the entry
+ * grew for that rule, and only as far as it grew. A renamed file's
+ * allowance is the one recorded under the name it had, or the move
+ * itself would read as room to spend. */
+ const rule = signature.slice(0, signature.indexOf(':'));
+ const grew =
+ countOf(recorded, relative, rule) -
+ countOf(recordedBefore, inheritedFrom?.path ?? relative, rule);
+ const key = `${relative}\u0000${rule}`;
+ const spent = allowed.get(key) ?? 0;
+ if (inherited && spent < grew) {
+ allowed.set(key, spent + 1);
+ continue;
+ }
+ problems.push(
+ inherited
+ ? `${relative}: ${signature} is new here and the record did not grow to cover it; fix it, or record what this change owes with \`npm run lint:design:suppress\` so the count says so`
+ : `${relative}: ${signature} is in a file this change adds; the backlog records what the tree owed when the rules landed, not what a new file brings, so fix it`,
+ );
+ }
+ }
+ return problems;
+}
+
+/**
+ * The commit this change is measured against: the merge base of the requested
+ * base and `HEAD` for a range, the checked commit's parent when one commit is
+ * named, and `HEAD` for a staged run. A pull request's diff starts at the
+ * merge base, so reading prior content from the base branch's tip instead
+ * would call a violation that branch added since the divergence this change's
+ * doing, and forgive one this change added that the tip happens to carry; and
+ * `--commit HEAD` compared against `HEAD` would be the commit against itself,
+ * which forgives everything. Resolved once, because two checks ask and they
+ * have to agree.
+ */
+let resolvedBase: string | undefined;
+function baseCommit(): string {
+ if (resolvedBase !== undefined) return resolvedBase;
+ if (OPTIONS.commit !== undefined) {
+ const parent = runCommand(GIT, ['rev-parse', `${OPTIONS.commit}^`]);
+ resolvedBase = parent.status === 0 ? parent.stdout.trim() : OPTIONS.commit;
+ return resolvedBase;
+ }
+ const requested = OPTIONS.against ?? 'HEAD';
+ const merged = runCommand(GIT, ['merge-base', requested, 'HEAD']);
+ resolvedBase = merged.status === 0 ? merged.stdout.trim() : requested;
+ return resolvedBase;
+}
+
+/**
+ * The files whose recorded entries this diff edits, read by comparing the
+ * baseline against the merge base. A mixed diff that leaves a file alone while
+ * loosening its entry would otherwise be checked by nothing.
+ */
+function editedEntries(target: string, context: CheckContext): string[] {
+ if (!context.files.includes(target)) return [];
+ const base = runCommand(GIT, ['show', `${baseCommit()}:${target}`]);
+ /** The base commit may not carry the baseline at all — the change that adds
+ * it is exactly one such diff — so this read must not be fatal. */
+ if (base.status !== 0) return [];
+ let previous: SuppressionsFile;
+ try {
+ previous = JSON.parse(base.stdout) as SuppressionsFile;
+ } catch {
+ return [];
+ }
+ let current: SuppressionsFile;
+ try {
+ current = JSON.parse(readFileSync(resolve(ROOT, target), 'utf8')) as SuppressionsFile;
+ } catch {
+ return [];
+ }
+ return [...new Set([...Object.keys(previous), ...Object.keys(current)])].filter(
+ (file) => JSON.stringify(previous[file]) !== JSON.stringify(current[file]),
+ );
+}
+
+/**
+ * Whether `packages/client/dist` describes the current sources. A missing build
+ * is the obvious case; a stale one is the quiet case — it reports variants that
+ * no longer exist and misses the ones that do, which is a lint that disagrees
+ * with CI while looking clean.
+ *
+ * Two things are asked, because a timestamp alone answers neither. What the
+ * manifest declares has to be there: the build empties `dist` before it writes,
+ * so a build that failed halfway leaves a recent directory over a bundle that
+ * no longer has an entry point, and the newest mtime under it would read as
+ * proof. And the build has to be newer than everything it is built from — the
+ * library's manifest, build config and compiler options, which decide what is
+ * emitted, and the root manifests, which decide what `build:client-package`
+ * runs and which toolchain it runs with — while every file under `src` the
+ * tsconfig actually emits stays older than the last build. CI always builds, so
+ * either divergence would only appear locally.
+ *
+ * Freshness is asked of every declared output, not of the newest file anywhere
+ * under `dist`. A resolver loads one entry, not the directory: a build that
+ * rewrote the ESM bundle and left the CJS one or the type declarations behind
+ * would pass a `max` comparison while `@shadcn/lint` reads the stale one and
+ * classifies callers against variants that no longer exist. The weakest output
+ * is the one that decides, which is the same reason their existence is checked
+ * one by one rather than by the directory's mtime.
+ *
+ * Specs are not among those sources: `packages/client/tsconfig.json` excludes
+ * them, so no edit to one can make the bundle describe something else. Adding or
+ * deleting a spec still moves its directory's own mtime, which is read because a
+ * deleted source leaves no file behind to be newer than the build; that errs
+ * toward rebuilding, which is the safe direction.
+ */
+function designMetadataIsFresh(): boolean {
+ const dist = resolve(ROOT, 'packages/client/dist');
+ if (!existsSync(dist)) return false;
+ const declared = declaredBundleFiles().map((file) => resolve(ROOT, 'packages/client', file));
+ if (declared.length === 0 || declared.some((file) => !existsSync(file))) return false;
+ let sourcedAt = newestModification(resolve(ROOT, 'packages/client/src'), (path) =>
+ DESIGN_TEST_SOURCE.test(path),
+ );
+ for (const file of [...DESIGN_METADATA_FILES, 'package.json', 'package-lock.json']) {
+ const path = resolve(ROOT, file);
+ if (existsSync(path)) sourcedAt = Math.max(sourcedAt, statSync(path).mtimeMs);
+ }
+ return declared.every((file) => statSync(file).mtimeMs >= sourcedAt);
+}
+
+/**
+ * The bundle paths `packages/client/package.json` promises: its entry fields and
+ * every string leaf of `exports`, kept to the ones inside `dist`. These are what
+ * a caller — and so the design rules, resolving `@librechat/client` — actually
+ * loads, which is what makes their absence a build that did not happen rather
+ * than a build that is merely old.
+ */
+function declaredBundleFiles(): string[] {
+ let manifest: Record<string, unknown>;
+ try {
+ manifest = JSON.parse(
+ readFileSync(resolve(ROOT, 'packages/client/package.json'), 'utf8'),
+ ) as Record<string, unknown>;
+ } catch {
+ return [];
+ }
+ const declared: string[] = [];
+ const collect = (value: unknown): void => {
+ if (typeof value === 'string') {
+ const path = value.replace(/^\.\//, '');
+ if (path.startsWith('dist/')) declared.push(path);
+ return;
+ }
+ if (typeof value === 'object' && value !== null) Object.values(value).forEach(collect);
+ };
+ for (const field of ['main', 'module', 'types', 'exports']) collect(manifest[field]);
+ return [...new Set(declared)];
+}
+
+/**
+ * The newest mtime under `directory`, in milliseconds; 0 when it is absent. The
+ * directories count too, not only the files in them: deleting a source leaves
+ * every surviving file older than the build, and the parent directory's mtime is
+ * the only record that the module a stale `dist` still exports is gone.
+ *
+ * `skip` drops files the caller does not build from, by absolute path. It is not
+ * applied to directories, for the reason above.
+ */
+function newestModification(directory: string, skip?: (path: string) => boolean): number {
+ if (!existsSync(directory)) return 0;
+ let newest = statSync(directory).mtimeMs;
+ const walk = (current: string): void => {
+ for (const entry of readdirSync(current, { withFileTypes: true })) {
+ if (entry.name.startsWith('.')) continue;
+ const path = join(current, entry.name);
+ if (entry.isDirectory()) {
+ newest = Math.max(newest, statSync(path).mtimeMs);
+ walk(path);
+ continue;
+ }
+ if (skip?.(path)) continue;
+ newest = Math.max(newest, statSync(path).mtimeMs);
+ }
+ };
+ walk(directory);
+ return newest;
+}
+
+/**
+ * The design rules read each primitive's `cva` variants through the
+ * `@librechat/client` entry point, which resolves to `packages/client/dist`. With
+ * no build present the rules cannot classify what a primitive owns and report
+ * strictly fewer violations — a lint that passes for the wrong reason, and a
+ * recorded baseline that disagrees with the same tree on a machine that did
+ * build. Building here, rather than skipping, is the same choice the config
+ * suite makes below.
+ *
+ * A zero exit is not the postcondition. The question `designMetadataIsFresh`
+ * asks is whether `dist` describes these sources, and a build that reports
+ * success while leaving the bundle incomplete or older than what it was built
+ * from answers it the same way it did before — so it is asked again. Otherwise
+ * the lint that follows classifies against a bundle that describes something
+ * else, which is the failure this whole function exists to prevent, arrived at
+ * through the branch that was supposed to fix it.
+ */
+function buildClientPackage(): CheckOutcome | null {
+ if (designMetadataIsFresh()) return null;
+ const build = runCommand(NPM, ['run', 'build:client-package']);
+ if (build.status !== 0) {
+ return {
+ ok: false,
+ output: `npm run build:client-package failed; the design rules cannot read the primitives' variants without it:\n${build.output}`,
+ };
+ }
+ if (!designMetadataIsFresh()) {
+ return {
+ ok: false,
+ output:
+ 'npm run build:client-package reported success, but packages/client/dist is still incomplete or older than the sources it is built from. The design rules would classify against a bundle that does not describe these primitives and report fewer violations than CI.',
+ };
+ }
+ return null;
+}
+
// --------------------------------------------------------------- config migration tests
/**
@@ -1061,6 +2107,13 @@ const CHECKS: Check[] = [
group: 'unused_packages',
run: validatePackageJson,
},
+ {
+ id: 'suppressions',
+ title: 'Design-rule suppressions',
+ tier: 'fast',
+ group: 'suppressions',
+ run: validateSuppressions,
+ },
{
id: 'circular-deps',
title: 'Circular dependencies',