test: for plugin and lint

This commit is contained in:
2026-09-26 16:14:36 +05:00
parent 8801c3dd91
commit bd941d5ac5
7 changed files with 419 additions and 8 deletions
+3 -3
View File
@@ -1,14 +1,14 @@
// Unused tokens: defined in app.css but never referenced via var()
// anywhere in src. A dead token is not the single source of truth — it's dust.
// Reported as a warning; it does not fail the run.
// Reported as a warning; it does not fail the run. The `used` set is injectable
// so tests can pass a fixture instead of scanning src.
import { collectUsedTokens } from "./helpers.mjs";
export function checkUnused(root) {
export function checkUnused(root, used = collectUsedTokens()) {
const defined = new Set();
root.walkDecls((decl) => {
if (decl.prop.startsWith("--")) defined.add(decl.prop);
});
const used = collectUsedTokens();
return [...defined].filter((token) => !used.has(token));
}