Document every Sass mixin and function with SassDoc and drop the unused ones
Each @mixin and @function now has a /// block: what it draws and when to use it, its parameters with their accepted values, and the mixin that goes with it. VS Code shows it on hover with SCSS IntelliSense. Ten mixins that nothing included are removed; the built CSS is byte-identical. tests/static-styles now requires the block, and website/AGENTS.md gives the template. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
64a1ad2835
commit
db93420daf
20 changed files with 333 additions and 108 deletions
|
|
@ -1,5 +1,6 @@
|
|||
/**
|
||||
* @file Protège les frontières Sass, les conventions publiques et le découpage des fichiers.
|
||||
* @file Protège les frontières Sass, les conventions publiques (en-têtes `// Rôle :`, blocs SassDoc `///` des mixins et
|
||||
* fonctions) et le découpage des fichiers.
|
||||
*/
|
||||
|
||||
import { readFile, readdir } from "node:fs/promises";
|
||||
|
|
@ -151,3 +152,17 @@ test("Sokko TCG styles load with their route and keep the single-sheet cascade",
|
|||
// L'icône du menu s'affiche sur toutes les pages : elle reste dans la feuille commune.
|
||||
assert.doesNotMatch(await readFile(`${root}/_nebula-cards.scss`, "utf8"), /\.nav-icon-cards/);
|
||||
});
|
||||
|
||||
test("every Sass mixin and function has a SassDoc block", async () => {
|
||||
const root = "website/src/styles";
|
||||
const paths = (await readdir(root, { recursive: true })).filter((path) => path.endsWith(".scss"));
|
||||
const missing = [];
|
||||
for (const path of paths) {
|
||||
const lines = (await readFile(`${root}/${path}`, "utf8")).split("\n");
|
||||
lines.forEach((line, index) => {
|
||||
const declared = line.match(/^\s*@(?:mixin|function)\s+([\w-]+)/);
|
||||
if (declared && !lines[index - 1]?.trimStart().startsWith("///")) missing.push(`${path}: ${declared[1]}`);
|
||||
});
|
||||
}
|
||||
assert.deepEqual(missing, [], "Describe these with a /// SassDoc block (see website/AGENTS.md)");
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue