Skip to content

chore(oxlint.config): enable 'vitest/prefer-expect-type-of' and replace 'typeof' checks with 'toBeTypeOf' - #602

Merged
sukvvon merged 1 commit into
mainfrom
chore/oxlint-vitest-prefer-expect-type-of
Dec 4, 2026
Merged

sukvvon merged 1 commit into
mainfrom
chore/oxlint-vitest-prefer-expect-type-of

Conversation

@sukvvon

@sukvvon sukvvon commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

🎯 Changes

  • Enable vitest/prefer-expect-type-of in the vitest test file override of oxlint.config.ts.
  • Replace expect(typeof x).toBe('...') with expect(x).toBeTypeOf('...') in virtual-console.test.ts, devtools-rspack/src/{index,plugin}.test.ts, svelte/{panel,plugin}.test.ts and event-bus/src/utils/json.test.ts, keeping the runtime assertions.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Updated type assertions across the test suite to use Vitest’s type matcher.
    • Enabled a lint rule requiring this matcher in tests.

@sukvvon sukvvon self-assigned this Dec 4, 2026
@changeset-bot

changeset-bot Bot commented Dec 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e08b81d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nx-cloud

nx-cloud Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit e08b81d

Command Status Duration Result
nx affected --targets=test:oxlint,test:sherif,t... ✅ Succeeded 2m 27s View ↗
nx run-many --target=test:e2e --parallel=1 --pr... ✅ Succeeded 1m 1s View ↗
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 30s View ↗

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-12-04 07:34:13 UTC

@pkg-pr-new

pkg-pr-new Bot commented Dec 4, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-devtools

npm i https://pkg.pr.new/@tanstack/angular-devtools@602

@tanstack/devtools

npm i https://pkg.pr.new/@tanstack/devtools@602

@tanstack/devtools-a11y

npm i https://pkg.pr.new/@tanstack/devtools-a11y@602

@tanstack/devtools-bundler-core

npm i https://pkg.pr.new/@tanstack/devtools-bundler-core@602

@tanstack/devtools-client

npm i https://pkg.pr.new/@tanstack/devtools-client@602

@tanstack/devtools-rspack

npm i https://pkg.pr.new/@tanstack/devtools-rspack@602

@tanstack/devtools-ui

npm i https://pkg.pr.new/@tanstack/devtools-ui@602

@tanstack/devtools-utils

npm i https://pkg.pr.new/@tanstack/devtools-utils@602

@tanstack/devtools-vite

npm i https://pkg.pr.new/@tanstack/devtools-vite@602

@tanstack/devtools-webmcp

npm i https://pkg.pr.new/@tanstack/devtools-webmcp@602

@tanstack/devtools-event-bus

npm i https://pkg.pr.new/@tanstack/devtools-event-bus@602

@tanstack/devtools-event-client

npm i https://pkg.pr.new/@tanstack/devtools-event-client@602

@tanstack/preact-devtools

npm i https://pkg.pr.new/@tanstack/preact-devtools@602

@tanstack/react-devtools

npm i https://pkg.pr.new/@tanstack/react-devtools@602

@tanstack/solid-devtools

npm i https://pkg.pr.new/@tanstack/solid-devtools@602

@tanstack/svelte-devtools

npm i https://pkg.pr.new/@tanstack/svelte-devtools@602

@tanstack/vue-devtools

npm i https://pkg.pr.new/@tanstack/vue-devtools@602

commit: e08b81d

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The test-file lint override now enforces vitest/prefer-expect-type-of. Selected tests replace typeof equality assertions with Vitest’s toBeTypeOf matcher.

Changes: Vitest type assertions

Layer / File(s) Summary
Enable and apply Vitest type assertions
oxlint.config.ts, packages/devtools-bundler-core/src/virtual-console.test.ts, packages/devtools-rspack/src/*.test.ts, packages/devtools-utils/src/svelte/*.test.ts, packages/event-bus/src/utils/json.test.ts
The test-file override enables vitest/prefer-expect-type-of as an error. Selected tests use toBeTypeOf to check string, function, and bigint types.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

  • TanStack/devtools#587: Adds the Vitest plugin and configures the test-file override where this change enables an additional Vitest rule.

Suggested reviewers: alemtuzlak

Merge Risk: Minimal · up to e08b8

This is a lint-configuration and test-assertion update with no production behavior change. It is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: enabling the vitest/prefer-expect-type-of lint rule and replacing typeof checks with toBeTypeOf. The raw summary and objectives both describe this same change. The tit…
Description check Passed The description follows the template. It states the changes: the oxlint rule enablement and the listed test files whose typeof assertions were replaced with toBeTypeOf. It keeps the checklist sections…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: enabling the vitest/prefer-expect-type-of lint rule and replacing typeof checks with toBeTypeOf. The raw summary and objectives both describe this same change. The title is long (105 characters) and uses a scope-prefixed chore format, but it is accurate and specific.

Full details: Description check

Explanation

The description follows the template. It states the changes: the oxlint rule enablement and the listed test files whose typeof assertions were replaced with toBeTypeOf. It keeps the checklist sections and marks the contributing guide, local test run, and AI-code understanding items as checked. Release impact is marked as docs/CI/dev-only with no changeset. The description is complete and specific, and it matches the objectives.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7d770b7 and e08b81d.

Files selected for processing: 7

  • oxlint.config.ts
  • packages/devtools-bundler-core/src/virtual-console.test.ts
  • packages/devtools-rspack/src/index.test.ts
  • packages/devtools-rspack/src/plugin.test.ts
  • packages/devtools-utils/src/svelte/panel.test.ts
  • packages/devtools-utils/src/svelte/plugin.test.ts
  • packages/event-bus/src/utils/json.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@sukvvon
sukvvon merged commit 254bbb3 into main Dec 4, 2026
11 checks passed
@sukvvon
sukvvon deleted the chore/oxlint-vitest-prefer-expect-type-of branch December 4, 2026 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant