Skip to content

feat(remark-lint): add #8057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

feat(remark-lint): add #8057

wants to merge 3 commits into from

Conversation

avivkeller
Copy link
Member

@avivkeller avivkeller commented Aug 1, 2025

Fixes nodejs/doc-kit#350

This PR updates the monorepo to include a rewrite of remark-preset-lint-node. Now that we've migrated to the new generators, it makes sense to centralize our linting rules in one place, maintained by the same team. This ensures the generator syntax aligns exactly with the linting configuration.

The updated preset includes all existing rules plus the custom ones currently defined in doc-kit. With a follow-up in doc-kit, this will also address nodejs/doc-kit#328.

Once the migration to doc-kit is finished, we can follow up in node core to replace remark-preset-lint-node with @nodejs/remark-lint/api.

Our current setup is fragmented:

  • remark-preset-lint-node
  • Custom rules in node core
  • More rules in doc-kit
  • No clear separation in remark-preset-lint-node between general and API-specific rules

By consolidating everything into a single package, we’ll simplify future maintenance.

Tip

This package is versioned, and will only publish when the version package.json field is bumped (or via workflow_dispatch).

cc @nodejs/web-infra
cc @nodejs/linting
cc @Trott


Note: This PR is split into two commits. The first commit adds the package, and the second commit performs the linting adjustments (which is escaping).

Blocked: NPM_TOKEN secret needs to be updated to allow publishing @node-core/remark-lint

@avivkeller avivkeller requested review from Trott and Copilot August 1, 2025 15:59
@avivkeller avivkeller requested review from a team as code owners August 1, 2025 16:00
Copy link

vercel bot commented Aug 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Aug 8, 2025 11:31pm

Copilot

This comment was marked as outdated.

@avivkeller
Copy link
Member Author

The only lint changes are escaping characters (i.e _ because \_)

Copy link

codecov bot commented Aug 1, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8057      +/-   ##
==========================================
+ Coverage   72.81%   75.26%   +2.44%     
==========================================
  Files          96      112      +16     
  Lines        8328     9177     +849     
  Branches      214      286      +72     
==========================================
+ Hits         6064     6907     +843     
- Misses       2263     2269       +6     
  Partials        1        1              

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

Copy link
Member

@araujogui araujogui left a comment

Choose a reason for hiding this comment

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

Where's the llm_description lint rules?

@avivkeller
Copy link
Member Author

avivkeller commented Aug 1, 2025

Where's the llm_description lint rules?

🤦

I'll add them today, whoops

@Trott
Copy link
Member

Trott commented Aug 1, 2025

Is the idea that this is what will also be used to lint non-documentation .md files in the nodejs/node and nodejs/TSC repositories? Or will those continue to use remark-lint-preset-node and this is for website linting only?

@avivkeller
Copy link
Member Author

Is the idea that this is what will also be used to lint non-documentation .md files in the nodejs/node and nodejs/TSC repositories? Or will those continue to use remark-lint-preset-node and this is for website linting only?

The idea is for this to be the linter associated with doc-kit, the new generator for nodejs/node.

So, the web-infra and website teams will maintain a linter that complies with the generators we wrote (to ensure that they integrate well together).

Yes, it'll work on the other repositories, but there's no obligation to use it there.

@avivkeller
Copy link
Member Author

It's going to have two presets. index (just the default import), and api.

api will include all of the rules that are (as I see it) all over the place. (Some in doc kit, some in core, etc).

index will work for website linting, but could work anywhere in the organization.

Copy link
Collaborator

@bmuenzenmeyer bmuenzenmeyer left a comment

Choose a reason for hiding this comment

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

Am I missing a place or decision for us to have/not have READMEs in our packages? Seems like some of the context of this PR and the discussion already would be great to document as intents.

I noticed that the other packages don't have READMEs either. I don't intent to scope creep you but this seems like a good idea, no?

More review coming.

@ovflowd
Copy link
Member

ovflowd commented Aug 2, 2025

Blocked: NPM_TOKEN secret needs to be updated to allow publishing @node-core/remark-lint

Issue on /admin repo?

Copy link
Member

Choose a reason for hiding this comment

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

In order to avoid self-referenciating rules, can you rename this to base.mjs, and then simply export it also on index.mjs? Then api.mjs imports base.mjs

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think there is a difference, right? Am I missing something?

@avivkeller
Copy link
Member Author

Blocked: NPM_TOKEN secret needs to be updated to allow publishing @node-core/remark-lint

Issue on /admin repo?

Yes, I'll open one, once this gets some approvals

Copilot

This comment was marked as duplicate.

@avivkeller
Copy link
Member Author

Can someone tell me why Vercel failed? @nodejs/web-infra

@MattIPv4
Copy link
Member

MattIPv4 commented Aug 8, 2025

@node-core/website:build: Error: Cannot apply utility class `after:md:-left-1/2` because the `md` variant does not exist.
An unexpected error happened while finalizing this build. The real error may be shown somewhere else in the logs. We have been notified of the problem. If you have any questions, please contact Vercel Support https://vercel.com/help

@avivkeller
Copy link
Member Author

@node-core/website:build: Error: Cannot apply utility class `after:md:-left-1/2` because the `md` variant does not exist.

That's a warning disguised as an error, but has since been fixed.

An unexpected error happened while finalizing this build. The real error may be shown somewhere else in the logs. We have been notified of the problem. If you have any questions, please contact Vercel Support https://vercel.com/help

🤔 I'm going to rebase with main and see if it fixes itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doc-kit vs remark-preset-lint-node
6 participants