feat(lang-check): extend the content-style gate to .astro pages #243
Inga granskare
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-web!243
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "work/141"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
The gate read
src/content/**/*.mdandsrc/i18n/*.ts. The violations that motivated the glossary work were insrc/pages/pricing.astro, which it never read. A check that reports clean over the surface where the bug was gives false assurance.No new dependency.
@astrojs/compileris only a transitive dependency of@astrojs/checkand is not resolvable from project code under pnpm's strictnode_modules, and all three real violations were plain template text, not attribute values.maskAstroSyntax()inscripts/check-content-style.mjswalks an.astrofile once and blanks everything that is not rendered prose: the frontmatter fence, HTML comments, tags including multi-line and quoted attributes,<script>and<style>bodies, and top-level{expression}blocks. It replaces with spaces and keeps every newline, so line numbers never shift and the existing rules, tests andlang-check-ignore-next-linesuppression all work unchanged.scopeForFile()now treatssrc/pages/**/*.astrowithout anensegment as Swedish,src/pages/en/**as English, and everything else as the existing lenient chrome scope.Three rules were missing entirely, file scope aside:
sv-term/runner(the glossary row existed with no rule behind it),sv-short/dvsandsv-short/mm. Added, with guide text indocs/content-style.mdper its own "Adding a rule" process.Proven against the real faults, replayed from the pre-#136 blob:
Clean on current main:
✓ content style: no candidates in 141 file(s)(74.md, 4.ts, 63.astro, up from 78 files).Regression test in
scripts/check-content-style.test.mjs: a fixture carrying all three violations plus an import path, a frontmatter identifier, a class name and an href holding the same substrings, asserting exactly the three rules fire and nothing from the code. Plus scope tests for astro pages, the ignore directive as an HTML comment, and a<style>body that would fail without masking.lefthook's pre-commit glob gains
src/**/*.astro. The CI sweep runs barepnpm lang-check, so it picks up the extended default targets.Two known gaps, stated rather than hidden
{}expression wrapping nested JSX, for example{cond && <p>text</p>}, is masked opaquely, so prose nested that deep is not checked. One occurrence exists, a dev-only notice insrc/components/legal-entity.astro. Nothing on a governed page uses the pattern.<Card title="...">, is masked with the rest of the attribute. No governed page does this today.Verified:
pnpm lint,pnpm check,pnpm test(367 passed),pnpm lang-check.Closes #141
Mask everything in an .astro file that isn't rendered prose (frontmatter, tags, comments, script/style bodies, {expression} blocks) and run the existing line-based rules over what's left, so a template's own text nodes are checked without flagging class names, import paths or attribute values. Also add the runner/dvs/mm rules the gate never had, so lang-check would have caught the three real faults #136 fixed in pricing.astro. The ignore directive works inside .astro as an HTML comment, and both lefthook and the default target list now include src/**/*.astro.0338ab5c08f6da09d48e