Skip to content

chore(rustdoc): refresh JS toolchain with Vite+#157907

Closed
ubugeeei wants to merge 1 commit into
rust-lang:mainfrom
ubugeeei-forks:chore/refresh-js-ts-toolchain
Closed

chore(rustdoc): refresh JS toolchain with Vite+#157907
ubugeeei wants to merge 1 commit into
rust-lang:mainfrom
ubugeeei-forks:chore/refresh-js-ts-toolchain

Conversation

@ubugeeei

@ubugeeei ubugeeei commented Jun 15, 2026

Copy link
Copy Markdown

This PR refreshes the JavaScript tooling used by rustdoc JS tidy checks.

Vite+ | The Unified Toolchain for the Web
https://viteplus.dev/

Powered by Rust, MIT
https://github.com/voidzero-dev/vite-plus

What changed

  • Replaced the rustdoc JS ESLint configs with Vite+ configuration in vite.config.ts.
  • Updated tidy to run vp fmt --check before vp lint for rustdoc JavaScript.
  • Kept the existing es-check and tsc checks in the tidy path.
  • Promoted Oxlint correctness diagnostics to errors in the rustdoc Vite+ configs.
  • Enabled unused disable directive reporting with warnings denied, so stale disable comments cannot silently remain.
  • Configured oxfmt with the previous formatting contract: tabWidth: 4, printWidth: 100, and arrowParens: "avoid".
  • Applied the initial oxfmt pass where it preserves the existing rustdoc JS layout intent.

Why

  • Rustdoc JS checks stay integrated with the existing ./x test tidy --extra-checks=js workflow.
  • The JS lint and format configuration now lives in typed vite.config.ts files instead of separate ESLint config files.
  • Oxlint/Oxfmt provide a Rust-based toolchain with faster local feedback than the previous ESLint path.
  • Keeping arrowParens: "avoid" preserves the previous single-argument arrow style from the ESLint arrow-parens: as-needed rule.
  • Vite+ is part of the VoidZero toolchain. Since VoidZero joined Cloudflare on June 4, 2026, the upstream projects are expected to continue receiving active maintenance, with the original team still leading them and Cloudflare committing engineering resources.

Review notes

The formatter intentionally excludes js/search.js and js/src-script.js. Those files wrap large bodies in a function while keeping the body visually at top-level indentation, and oxfmt currently does not have a setting to preserve that layout. They are still covered by the Oxlint, es-check, and tsc tidy checks.

The remaining oxfmt diff is mechanical formatting output: function spacing, wrapping, object formatting, and TypeScript suppression comments adjusted after formatting.

The functional tidy changes are concentrated in the Vite+ configs and src/tools/tidy/src/extra_checks/rustdoc_js.rs.

The rust-analyzer VS Code extension changes were removed from this PR in response to review feedback. They should be proposed separately against the rust-analyzer workflow instead of being bundled with this rustdoc/tidy change.

Validation

  • ./x test tidy --extra-checks=js
  • Also verified earlier with the source-tree node_modules directory temporarily moved aside, matching CI's dependency layout where JS packages are installed under build/node_modules.

@rustbot

rustbot commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @lolbinarycat

rustc-dev-guide is developed in its own repository. If possible, consider making this change to rust-lang/rustc-dev-guide instead.

cc @BoxyUwU, @tshepang

tidy extra checks were modified.

cc @lolbinarycat

@rustbot rustbot added A-rustc-dev-guide Area: rustc-dev-guide A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-search Area: Rustdoc's search feature A-tidy Area: The tidy tool labels Jun 15, 2026
@rustbot

rustbot commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @notriddle (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: rustdoc
  • rustdoc expanded to 9 candidates
  • Random selection from GuillaumeGomez, camelid, lolbinarycat, notriddle

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jun 15, 2026
@ubugeeei ubugeeei changed the title chore: refresh JS/TS toolchain with Vite+ Refresh JS/TS toolchain with Vite+ Jun 15, 2026
@rust-log-analyzer

This comment has been minimized.

@lnicola

lnicola commented Jun 15, 2026

Copy link
Copy Markdown
Member

For rust-analyzer what the bot said, but please split it in multiple PRs.

@ubugeeei ubugeeei changed the title Refresh JS/TS toolchain with Vite+ chore: refresh rustdoc JS toolchain with Vite+ Jun 15, 2026
@lnicola

lnicola commented Jun 15, 2026

Copy link
Copy Markdown
Member

And please shquash/rebase the rust-analyzer changes out of the history instead of reverting them.

@ubugeeei ubugeeei force-pushed the chore/refresh-js-ts-toolchain branch from ee75903 to 378cd2d Compare June 15, 2026 08:14
@ubugeeei ubugeeei changed the title chore: refresh rustdoc JS toolchain with Vite+ rustdoc: refresh JS toolchain with Vite+ Jun 15, 2026
@ubugeeei ubugeeei changed the title rustdoc: refresh JS toolchain with Vite+ chore(rustdoc): refresh JS toolchain with Vite+ Jun 15, 2026
Comment thread src/librustdoc/html/static/js/main.js Outdated
.map((s) => {
// https://github.com/rust-lang/rust/issues/119219
const pair = s.split("=").map(x => x.replace(/\+/g, " "));
const pair = s.split("=").map((x) => x.replace(/\+/g, " "));

@GuillaumeGomez GuillaumeGomez Jun 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Adding parens around single arg for closure is not great. :-/

View changes since the review


const rootPath = getVar("root-path");
(function () {
const rootPath = getVar("root-path");

@GuillaumeGomez GuillaumeGomez Jun 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We didn't indent on purpose. ^^'

View changes since the review

@GuillaumeGomez

Copy link
Copy Markdown
Member

Also before going any further: why should we use vite+ instead or yarn/npm? What are the gains from this switch? Nothing in your description is telling us that.

@ubugeeei ubugeeei force-pushed the chore/refresh-js-ts-toolchain branch from 378cd2d to 7911084 Compare June 15, 2026 09:53
@ubugeeei ubugeeei marked this pull request as draft June 15, 2026 10:19
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 15, 2026
@JorgeCepeda

Copy link
Copy Markdown

Judging by the 10k contributions in the last year... This is AI-generated.

@GuillaumeGomez

Copy link
Copy Markdown
Member

Noted.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 15, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member

So in this case, since there is no provided argument as to why we should switch to this tool, I'm going to close it. Feel free to open a thread on our zulip if you want it to be discussed again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustc-dev-guide Area: rustc-dev-guide A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-search Area: Rustdoc's search feature A-tidy Area: The tidy tool T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants