Repository navigation
Conversation
@node-core/doc-kit 2 moved its internals to @doc-kit/core, and removed
the two helpers invalid-type-reference was built on:
`transformTypeToReferenceLink` and `QUERIES.normalizeTypes`.
- duplicate-stability-nodes and validate-links import the same modules
from @doc-kit/core.
- invalid-type-reference keeps its type pattern locally and resolves
each `|` member with doc-kit's `resolveTypeReference`, so it accepts
exactly what the generator can link. Types never reach it with `<>`
in them, so the old generic handling is gone.
- The old resolver accepted anything containing a `.`, which hid HTML
comments and tags being read as `<type>` references. The html branch
now only matches bare `<name>` nodes.
- doc-kit 2 no longer turns `_` into `-` in slugs, matching the site's
rehype-slug and the Node.js API anchors (`#child_process`).
Over Node.js's doc/api with its type-map.json, the rule reports nothing
new: it drops the HTML false positives (7103 -> 283 messages) and now
resolves {object}, {QuotaExceededError}, {WorkerGlobalScope} and
{DedicatedWorkerGlobalScope}. The site's markdown lint stays clean.
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9290 +/- ##
==========================================
+ Coverage 86.91% 87.03% +0.12%
==========================================
Files 88 88
Lines 6356 6377 +21
Branches 387 387
==========================================
+ Hits 5524 5550 +26
+ Misses 828 823 -5
Partials 4 4 ☔ View full report in Codecov by Harness. |
There was a problem hiding this comment.
🟡 Changes recommended
The rule incorrectly flags valid expressions such as {vm.Module[][]} and {typeof vm.Module} because it uses identifier-only resolution instead of the full annotation resolver.
1 open issue
1 file not reviewed
pnpm-lock.yaml: Generated file
What changed in this PR
Migrates @node-core/remark-lint to doc-kit’s extracted core package, replacing the incompatible dependency bump in #9286 and reducing generator-related dependencies.
Changes:
- Switches shared helper imports and dependencies to
@doc-kit/core. - Updates type-reference validation and underscore-preserving heading anchors.
- Adds regression tests and a patch changeset.
| File | Description |
|---|---|
pnpm-lock.yaml |
Locks the core dependency and removes unused transitive dependencies. |
packages/remark-lint/src/rules/validate-links.mjs |
Imports core’s heading slugger. |
packages/remark-lint/src/rules/invalid-type-reference.mjs |
Adds local type matching and identifier resolution. |
packages/remark-lint/src/rules/duplicate-stability-nodes.mjs |
Imports query helpers from core. |
packages/remark-lint/src/rules/__tests__/validate-links.test.mjs |
Expects underscores in heading anchors. |
packages/remark-lint/src/rules/__tests__/invalid-type-reference.test.mjs |
Covers HTML exclusions, arrays, qualified names, and unions. |
packages/remark-lint/package.json |
Replaces the doc-kit dependency with core. |
.changeset/quiet-rules-migrate.md |
Records the patch release and behavior changes. |
Review effort: Balanced
| const name = piece.trim().replace(/\[\]$/, ''); | ||
|
|
||
| return name.length > 0 && resolveTypeReference(name, typeMap) !== ''; |
📦 Build Size ComparisonSummary
|
| const TYPE_RE = /(\{|<)(?! )[^<({})>]+(?! )(\}|>)/g; | ||
| // Excludes HTML comments, closing tags and tags with attributes | ||
| const HTML_TYPE_RE = /^<[^\s!/=]+>$/; |
There was a problem hiding this comment.
Can we import this from somewhere?

Description
This PR moves
@node-core/remark-lintfrom@node-core/doc-kit1.x to@doc-kit/core, which is where doc-kit 2 keeps the internals our lint rules import. Dependabot's bump to@node-core/doc-kit2.0.6 in #9286 fails, because two of the helpersinvalid-type-referenceused are gone.duplicate-stability-nodesandvalidate-linksimport the same modules (QUERIES, the slugger) from@doc-kit/core.invalid-type-referencekeeps its type pattern locally and checks each|member with doc-kit'sresolveTypeReference, so it accepts exactly what the generator can link. The old resolver accepted anything with a.in it, which hid HTML comments and tags being read as<type>references. The html branch now only matches bare<name>nodes._in slugs, sovalidate-linksnow expects#child_processfor achild_processheading. That's also what the site'srehype-slugand the Node.js API docs generate.The lockfile loses ~1,200 lines, since
@doc-kit/coredoesn't pull in React, Orama and the rest of doc-kit 1's generators. A patch changeset releases it.Validation
pnpm test, Prettier and the package'slint:jspass, and the site'slint:mdstays clean with the newvalidate-links.invalid-type-referenceover the 70 files in nodejs/node'sdoc/apiwith itstype-map.json. The new rule reports nothing the old one didn't: it drops the HTML comment and tag false positives (7,103 → 283 messages) and now resolves{object},{QuotaExceededError},{WorkerGlobalScope}and{DedicatedWorkerGlobalScope}.Related Issues
Supersedes #9286
Check List
pnpm formatto ensure the code follows the style guide.pnpm testto check if all tests are passing.pnpm buildto check if the website builds without errors.