Skip to content

chore: migrate to vite-plus unified toolchain#2869

Merged
setchy merged 25 commits intomainfrom
migrate-to-oxlint-oxfmt
May 10, 2026
Merged

chore: migrate to vite-plus unified toolchain#2869
setchy merged 25 commits intomainfrom
migrate-to-oxlint-oxfmt

Conversation

@afonsojramos
Copy link
Copy Markdown
Member

@afonsojramos afonsojramos commented May 9, 2026

Summary

  • Replace @biomejs/biome with Vite+ (vite-plus@0.1.20), which bundles oxlint, oxfmt, Vitest, and the dev/build pipeline behind a single vp CLI.
  • Consolidate linter, formatter, and pre-commit configuration into the lint, fmt, and staged blocks of vite.config.ts.oxlintrc.json, .oxfmtrc.json, and the lint-staged block in package.json are gone.
  • Switch package scripts to vp dev / vp build / vp test / vp check, swap husky's pre-commit to vp staged, and point VS Code's oxc extension at vite.config.ts.
  • Convert all biome-ignore directives to oxlint-disable, fix the lint findings oxlint surfaced (constant-binary-expression, unsafe optional chaining, unused param, useNavigate stability), regenerate one snapshot affected by oxfmt's JSX whitespace, and apply oxfmt formatting across the codebase.

Test plan

  • pnpm check (vp lint + vp fmt: clean across 339 lint files / 373 fmt files)
  • pnpm tsc --noEmit
  • pnpm test (1031/1031 passing)
  • pnpm build

@github-actions github-actions Bot added chore Miscellaneous tasks dependency Dependency updates labels May 9, 2026
@setchy
Copy link
Copy Markdown
Member

setchy commented May 9, 2026

No vite+?

@afonsojramos afonsojramos changed the title chore: migrate from biome to oxlint and oxfmt chore: migrate to vite-plus unified toolchain May 9, 2026
Comment thread package.json
"vite-plugin-checker": "0.13.0",
"vite-plugin-electron": "0.29.1",
"vite-plugin-electron-renderer": "0.14.7",
"vite-plus": "0.1.20",
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.

Does vite-plus mean we should drop vite and vitest as direct devdeps?

Copy link
Copy Markdown
Member Author

@afonsojramos afonsojramos May 9, 2026

Choose a reason for hiding this comment

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

In principle yes — vite-plus aliases vite (@voidzero-dev/vite-plus-core) and vitest (@voidzero-dev/vite-plus-test) and the docs recommend dropping the standalone deps after rewriting imports to vite-plus / vite-plus/test.

I tried it and the rewrite forces tsconfig moduleResolution to switch from "Node" to "Bundler" so TS can resolve the subpath exports. Bundler resolution then exposes pre-existing latent issues that Node resolution masked:

  • src/renderer/types.ts imports from @primer/react/dist/Button/types (deep import not in @primer/react's exports map)
  • src/renderer/utils/ui/theme.ts imports from @primer/react/dist/ThemeProvider (same)
  • @testing-library/jest-dom matchers (toBeInTheDocument, toHaveTextContent) stop being picked up via vitest/globals types and need to be wired through vite-plus/test/globals or via setupFiles types

Each is fixable but the diff balloons well beyond the toolchain swap. I reverted those changes and would rather chase the cleanup in a follow-up.

Copy link
Copy Markdown
Member Author

@afonsojramos afonsojramos May 9, 2026

Choose a reason for hiding this comment

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

Took another pass. Two of the three issues are fixable cheaply, but dropping vite or vitest themselves still hits ecosystem walls:

Fixed in cfcfa5a (regardless of devdep cleanup):
- src/renderer/types.ts and utils/ui/theme.ts now inline VariantType and ColorModeWithAuto so we no longer reach into @primer/react/dist/*

Ended up reverting the above. Does not feel like it is worth it at the moment.

Conclusion, could not drop vite from devdeps: vite-plugin-electron does require('vite') at the project root. With vite removed, pnpm only places vite-plus-core's vite alias inside vite-plus-core itself, so the plugin's resolve fails. Re-adding vite restores the build.

Could not drop vitest from devdeps either: vitest's matchers are augmented via @testing-library/jest-dom/vitest, which does declare module 'vitest'. Once vitest is gone the global expect is typed as @voidzero-dev/vite-plus-test's Assertion (declared inside dist/chunks via a relative module spec that isn't reachable from outside the package's exports map). I tried augmenting via the package, the dist subpath, and tsconfig paths; none of them merge with the inner declaration. Keeping vitest as a devdep keeps the existing augmentation working.

Comment thread vite.config.ts
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 9, 2026

@setchy setchy self-requested a review May 10, 2026 13:28
@setchy setchy merged commit 9f08f0f into main May 10, 2026
18 checks passed
@setchy setchy deleted the migrate-to-oxlint-oxfmt branch May 10, 2026 13:28
@github-actions github-actions Bot added this to the Release 7.0.0 milestone May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Miscellaneous tasks dependency Dependency updates

Development

Successfully merging this pull request may close these issues.

2 participants