Stop new code from skipping its JSDoc or SassDoc, and tell agents to fix old gaps as they go
A ratchet test fails on any new exported function without a JSDoc block and keeps the list of the 496 older ones only shrinking. Every Sass sheet must now start with its role header, not only the listed ones. The root, website, styles and tests AGENTS.md files say to document new declarations at once and to complete an undocumented one whenever it is modified. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
db93420daf
commit
2f3c371d7b
11 changed files with 623 additions and 2 deletions
25
tests/function-docs.test.mjs
Normal file
25
tests/function-docs.test.mjs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* @file Cliquet de la JSDoc des fonctions exportées : aucune nouvelle fonction exportée sans bloc `/** … *\/`, et la liste
|
||||
* des anciennes fonctions encore sans commentaire ne fait que raccourcir.
|
||||
*
|
||||
* Attention : une fonction documentée doit sortir de tests/fixtures/undocumented-exports.json dans la même modification
|
||||
* (`node tests/helpers/exported-functions.mjs --write`). Ne jamais y ajouter une fonction nouvelle : la documenter.
|
||||
* @see website/AGENTS.md
|
||||
*/
|
||||
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { test } from "node:test";
|
||||
import { BASELINE_PATH, undocumentedExports } from "./helpers/exported-functions.mjs";
|
||||
|
||||
test("new exported functions come with a JSDoc block", async () => {
|
||||
const known = new Set(JSON.parse(await readFile(BASELINE_PATH, "utf8")));
|
||||
const added = (await undocumentedExports()).filter((entry) => !known.has(entry));
|
||||
assert.deepEqual(added, [], "Document these exported functions with a /** … */ block (see website/AGENTS.md)");
|
||||
});
|
||||
|
||||
test("the list of undocumented exports only shrinks", async () => {
|
||||
const current = new Set(await undocumentedExports());
|
||||
const stale = JSON.parse(await readFile(BASELINE_PATH, "utf8")).filter((entry) => !current.has(entry));
|
||||
assert.deepEqual(stale, [], `Remove these documented, renamed or deleted functions from ${BASELINE_PATH}: node tests/helpers/exported-functions.mjs --write`);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue