ci: check locales, root links, and MDX imports #158
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pokebedrock/wiki!158
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/ci-validation-scope"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
wiki-cipushes tomainso PR branch updates are not linted twice (pull_requeststill runs).langvalues other thanenandes, and document those locales.npm run lintwhen a relative MDX import target is missing. Package imports stay ignored.*.md) along with docs and asset Markdown.CONTRIBUTING.mdpointed athttps://pokebedrock.com/support, which returns 404; it now points athttps://pokebedrock.com/contact(200).Closes #126
Closes #132
Closes #138
Closes #143
Test plan
npm run cilocallyfrto the lang enum fails the frontmatter self-checkREADME.mdfails linkinatorwiki-cigreen on this headFixes: #126
Fixes: #132
Fixes: #138
Fixes: #143
head
c15a55afReviewed head
c15a55af.wiki-ci / lint (pull_request)is green.The CI trigger,
langenum, root-Markdown link scope, and doc updates look right and match #126, #138, and #143.The gaps are in the new MDX import guard (#132):
import { A, B } from "../x.mdx"is skipped without any error.docs/en/_partials/ReleaseChecklist.mdxexisting andServicenodeCallout.mdxnot existing), so renaming that partial breaks lint with a misleading error.The smaller notes are inline. Not approving until the first two are addressed or explicitly accepted as out of scope.
@ -19,3 +18,4 @@const htmlImageRegex = /<img\s+[^>]*>/gi;const srcRegex = /src=["']([^"']+)["']/i;const altRegex = /alt=["']([^"']*)["']/i;const importFromRegex = /^\s*import\s.+?\sfrom\s+["']([^"']+)["']/gm;.+?doesn't cross newlines, so a multi-line import likeis skipped without any error. That's the exact blind spot #132 is closing. Something like
/^\s*import\s[\s\S]*?\sfrom\s+["']([^"']+)["']/gmhandles it, but strip fenced code blocks first (see the next note) so the lazy match can't run into example code.@ -22,0 +21,4 @@const importFromRegex = /^\s*import\s.+?\sfrom\s+["']([^"']+)["']/gm;const importBareRegex = /^\s*import\s+["']([^"']+)["']/gm;const isRelativeSpecifier = (specifier: string): boolean =>Nit (house rule, JSDoc on touched TS):
isRelativeSpecifier,findRelativeImportSpecifiers,localImportExists, andassertImportChecksare new helpers with no doc comments. One line each is enough, especially to say thatlocalImportExistsstrips?query/#hashand requires an exact file.@ -22,0 +42,4 @@return specifiers;};const localImportExists = (file: string, specifier: string): boolean => {isFile()on the literal specifier rejects extensionless imports (../_partials/ReleaseChecklist), which MDX/Vite resolve fine. Either try the usual extensions (.mdx,.md,.tsx,.ts,.jsx,.js) andindex.*, or document in CONTRIBUTING/DOCUMENTATION that relative MDX imports must include their extension. Right now that rule is only enforced, not written down anywhere.@ -22,0 +52,4 @@}};// ponytail: self-check is the regression net for the import guard. Always-trueTwo things here:
ponytail:looks like a stray tag. Drop it or use a normalNOTE:.docs/en/_partials/ReleaseChecklist.mdx, or adds aServicenodeCallout.mdx,npm run lintfails with "Import self-check missed ...", which reads like a tooling bug and not a content change. Point it at a dedicated fixture (for examplescripts/__fixtures__/import-target.mdxplus a known-missing name) so the guard's regression net doesn't depend on wiki pages.@ -22,0 +69,4 @@const fromFile = "docs/en/getting-started/faq.md";if (!localImportExists(fromFile, "../_partials/ReleaseChecklist.mdx")) {This scans the raw source, fenced code blocks included. A doc that shows an example relative import (this happened in
handbook/style-guide.mdxbefore, see #128 and #132) will fail lint even though nothing actually imports it. Strip the```and~~~fences before runningfindRelativeImportSpecifiers, and add a self-check sample for it.@ -89,4 +165,4 @@process.exit(1);}console.log(`Image validation succeeded for ${filesToValidate.length} markdown files.`);Nit: this script now validates imports too, and dropping the early exit means an empty docs tree prints "No markdown files found" followed by "Image validation succeeded for 0 markdown files." Consider reporting both counts, for example
Image validation succeeded for N files; import check covered M files.