build(frontend): sweep every stylesheet, not index.css by name
CI / check (push) Skipped
CI / e2e (push) Skipped
CI / check (pull_request) Successful in 2m31s
CI / e2e (pull_request) Canceled after 20s

The hook fires on frontend/**/*.{ts,css} while the script read one hardcoded path, so a second stylesheet would have been silently unswept while the hook still went green over it. There is only index.css today, which is exactly when this is cheap to fix. Watched catching a planted nested rule in a second file.
This commit is contained in:
2026-08-21 10:46:22 -04:00
parent cee322dc31
commit 19d91639a4
2 changed files with 23 additions and 6 deletions
+19 -5
View File
@@ -18,10 +18,24 @@ import { findBareNestedRules } from './css-nesting.mjs';
const problems = [];
for (const { line, selector } of findBareNestedRules(
readFileSync('index.css', 'utf8'),
)) {
problems.push({ file: 'index.css', line, selector });
// Every stylesheet, not `index.css` by name: the hook that runs this
// fires on `frontend/**/*.{ts,css}`, so naming one file promises a
// coverage the sweep does not deliver -- a second stylesheet would be
// silently unswept while the hook still went green over it. There is
// only `index.css` today, which is exactly when this is free to fix.
const stylesheets = globSync('*.css', { cwd: process.cwd() });
if (stylesheets.length === 0) {
console.error('css-nesting-check: no stylesheet matched *.css');
process.exit(1);
}
for (const file of stylesheets) {
for (const { line, selector } of findBareNestedRules(
readFileSync(file, 'utf8'),
)) {
problems.push({ file, line, selector });
}
}
const sources = globSync('src/**/*.ts', { cwd: process.cwd() });
@@ -61,5 +75,5 @@ if (problems.length > 0) {
}
console.log(
`css-nesting-check: index.css + ${sources.length} files, no bare nested rules`,
`css-nesting-check: ${stylesheets.length} stylesheet(s) + ${sources.length} files, no bare nested rules`,
);