Skip to content
TypeScript

chore(lint): exempt CollapsibleTrigger from no-restyle (#13024)

Julius Marmingebbd5cc03231b
diff --git a/scripts/lint-restyle-ceiling.ts b/scripts/lint-restyle-ceiling.ts
index 353481ac647..65177192cbd 100644
--- a/scripts/lint-restyle-ceiling.ts
+++ b/scripts/lint-restyle-ceiling.ts
@@ -8,7 +8,7 @@ import * as NodeURL from "node:url";
// components/ui exports are migrated to variants (see vite.config.ts). This gate keeps the
// count from growing: CI fails when findings exceed the ceiling. Lower the ceiling when you
// migrate a file, and delete this script when the rule becomes an error.
-export const RESTYLE_CEILING = 1143;
+export const RESTYLE_CEILING = 1074;
const RULE = "shadcn(no-restyle)";
diff --git a/vite.config.ts b/vite.config.ts
index 03811670994..6119c6f38bc 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -178,7 +178,21 @@ export default defineConfig({
files: ["apps/web/src/**"],
excludeFiles: ["apps/web/src/components/ui/**"],
rules: {
- "shadcn/no-restyle": ["warn", { allow: ["layout"] }],
+ "shadcn/no-restyle": [
+ "warn",
+ {
+ allow: ["layout"],
+ contracts: [
+ {
+ // CollapsibleTrigger is a bare button with no styled counterpart
+ // (a disclosure row is not a Button), so its className is the API.
+ // Every other trigger has one: style them with render={<Button …/>}.
+ pattern: "^CollapsibleTrigger$",
+ allow: ["layout", "color", "typography", "spacing", "shape", "effects", "motion"],
+ },
+ ],
+ },
+ ],
},
},
{