Skip to content

chore(remark-lint): migrate to @doc-kit/core - #9290

Merged
ovflowd merged 1 commit into
mainfrom
chore/remark-lint-doc-kit-2
Nov 4, 2026
Merged

ovflowd merged 1 commit into
mainfrom
chore/remark-lint-doc-kit-2

Conversation

@ovflowd

@ovflowd ovflowd commented Nov 1, 2026

Copy link
Copy Markdown
Member

Description

This PR moves @node-core/remark-lint from @node-core/doc-kit 1.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-kit 2.0.6 in #9286 fails, because two of the helpers invalid-type-reference used are gone.

  • duplicate-stability-nodes and validate-links import the same modules (QUERIES, the slugger) from @doc-kit/core.
  • invalid-type-reference keeps its type pattern locally and checks each | member with doc-kit's resolveTypeReference, 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.
  • doc-kit 2 keeps _ in slugs, so validate-links now expects #child_process for a child_process heading. That's also what the site's rehype-slug and the Node.js API docs generate.

The lockfile loses ~1,200 lines, since @doc-kit/core doesn'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's lint:js pass, and the site's lint:md stays clean with the new validate-links.
  • I ran the old and new invalid-type-reference over the 70 files in nodejs/node's doc/api with its type-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

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

Copilot AI balanced review requested due to automatic review settings November 1, 2026 21:14
@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nodejs-org Ready Ready Preview Nov 4, 2026 6:18pm UTC

Request Review

@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.00%. Comparing base (a2db8a5) to head (b3b3287).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9290      +/-   ##
==========================================
+ Coverage   86.97%   87.00%   +0.02%     
==========================================
  Files          88       88              
  Lines        6356     6377      +21     
  Branches      386      387       +1     
==========================================
+ Hits         5528     5548      +20     
- Misses        824      825       +1     
  Partials        4        4              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

📦 Build Size Comparison

Summary

Metric Value
Old Total First Load JS 7.19 MB
New Total First Load JS 7.19 MB
Delta 0 B (0.00%)

@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>
@ovflowd
ovflowd force-pushed the chore/remark-lint-doc-kit-2 branch from a5fcc2d to b3b3287 Compare November 4, 2026 18:17
@ovflowd
ovflowd added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit 9c1ac22 Nov 4, 2026
20 checks passed
@ovflowd
ovflowd deleted the chore/remark-lint-doc-kit-2 branch November 4, 2026 18:31

This branch was successfully deployed

1 active deployment
Preview — b3b3287e Deployed Nov 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fast-track Fast Tracking PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants