Skip to content

test(*): migrate 'test' to 'it' and enforce 'vitest/consistent-test-it' rule#10528

Merged
sukvvon merged 3 commits intomainfrom
test/migrate-test-to-it-and-enforce-consistent-rule
Apr 20, 2026
Merged

test(*): migrate 'test' to 'it' and enforce 'vitest/consistent-test-it' rule#10528
sukvvon merged 3 commits intomainfrom
test/migrate-test-to-it-and-enforce-consistent-rule

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Apr 20, 2026

🎯 Changes

Enforces a single test keyword convention across the repo by adding vitest/consistent-test-it rule and migrating all test() calls to it().

Current state

Test files were split between it() and test() with no lint rule enforcing consistency:

  • it: ~1,729 calls (66%)
  • test: ~875 calls (34%)

Per adapter:

  • it majority: react-query, preact-query, solid-query, vue-query, svelte-query, query-devtools
  • test majority: angular-query-experimental, query-core, persist-client packages

What this PR does

  1. Adds 'vitest/consistent-test-it': ['error', { fn: 'it', withinDescribe: 'it' }] to eslint.config.js (same config zustand/jotai use).
  2. Runs eslint --fix across all test files — 77 files auto-migrated, 884 insertions / 884 deletions.
  3. Manually updates the testIf helper in vueQueryPlugin.test.ts to reference it instead of test.

Why it?

  • it is already the majority (66%) in this repo, so migrating to it is the lower-cost direction.
  • Aligns with the BDD-style describe/it phrasing that most of our test files already follow.

Verification

All 7 major adapters pass locally:

  • @tanstack/query-core: 511 passed
  • @tanstack/react-query: 535 passed, 1 skipped
  • @tanstack/preact-query: 500 passed
  • @tanstack/solid-query: 309 passed
  • @tanstack/vue-query: 289 passed, 6 skipped
  • @tanstack/svelte-query: 163 passed
  • @tanstack/angular-query-experimental: 207 passed

Lint: 0 consistent-test-it violations. Prettier: clean.

Follow-up (not in this PR)

svelte-query and svelte-query-persist-client have test:eslint scoped to ./src only, so their tests/ directories aren't lint-covered. Will fix in a separate PR.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 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

Release Notes

  • Tests

    • Standardized test suite configuration across the project to enforce consistent test function usage.
  • Chores

    • Updated ESLint rules to maintain consistent coding patterns in test files.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

📝 Walkthrough

Walkthrough

This pull request adds a new ESLint rule vitest/consistent-test-it to enforce consistent use of it within test files, then systematically updates all test files across the monorepo to replace test(...) calls with it(...) calls to comply with this rule.

Changes

Cohort / File(s) Summary
ESLint Configuration
eslint.config.js
Added new ESLint rule vitest/consistent-test-it configured with error severity to enforce consistent it usage in test files (*.spec.ts*, *.test.ts*, *.test-d.ts*).
Angular Query Experimental Tests
packages/angular-query-experimental/src/__tests__/*
Replaced test(...) with it(...) across 11 test files (infinite-query-options, inject-infinite-query, inject-is-fetching, inject-is-mutating, inject-is-restoring, inject-mutation, inject-mutation-state, inject-query, pending-tasks, provide-query-client, provide-tanstack-query, query-options, signal-proxy, with-devtools). Updated corresponding Vitest imports.
Angular Query Experimental Type Tests
packages/angular-query-experimental/src/__tests__/*.test-d.ts
Replaced test(...) with it(...) in type-definition test files for inject-infinite-query, inject-mutation, and inject-query.
Query Persist Client Tests
packages/angular-query-persist-client/src/__tests__/with-persist-query-client.test.ts, packages/query-persist-client-core/src/__tests__/*.test.ts, packages/query-sync-storage-persister/src/__tests__/storageIsFull.test.ts
Replaced test(...) and test.each(...) with it(...) and it.each(...) across persister and persistence-related test files.
ESLint Plugin Query Tests
packages/eslint-plugin-query/src/__tests__/*.test.ts
Updated Vitest API from test.each(...) to it.each(...) in sort-data-by-order and test-utils test files.
Preact Query Tests
packages/preact-query/src/__tests__/*.test.tsx, packages/preact-query/src/__tests__/*.test-d.tsx
Replaced test(...) with it(...) in HydrationBoundary, QueryClientProvider, infiniteQueryOptions, and useQuery test files. Removed ESLint suppression comment in HydrationBoundary.tsx.
Preact Query Utilities
packages/preact-query/src/utils.ts
Removed unused ESLint disable comment in error handling code.
Query Core Tests
packages/query-core/src/__tests__/*.test.tsx
Replaced test(...) with it(...) across 20+ test files covering environment, focus, hydration, infinite queries, mutations, observer patterns, and query management (environmentManager, focusManager, hydration, infiniteQueryBehavior, infiniteQueryObserver, mutationCache, mutationObserver, mutations, onlineManager, queriesObserver, query, queryCache, queryClient, queryObserver, streamedQuery).
Query Async Storage Persister Tests
packages/query-async-storage-persister/src/__tests__/asyncThrottle.test.ts
Replaced test(...) with it(...) for throttle timing behavior tests.
React Query Tests
packages/react-query/src/__tests__/*.test.tsx, packages/react-query/src/__tests__/*.test-d.tsx
Replaced test(...) with it(...) in HydrationBoundary, QueryClientProvider, infiniteQueryOptions, and useQuery test files.
Preact/React Query Persist Client Tests
packages/preact-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx, packages/react-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
Replaced test(...) with it(...) for persister restore and refetch behavior.
Solid Query Persist Client Tests
packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
Updated test declarations from test(...) to it(...).
Svelte Query Tests
packages/svelte-query/tests/**/*.svelte.test.ts, packages/svelte-query/tests/**/*.test-d.ts
Replaced test(...) with it(...) across QueryClientProvider, context, createMutation, infiniteQueryOptions, mutationOptions, queryOptions, useIsFetching, useIsMutating, and useMutationState test files.
Svelte Query Persist Client Tests
packages/svelte-query-persist-client/tests/PersistQueryClientProvider.svelte.test.ts
Updated Vitest test declarations from test(...) to it(...).
Vue Query Tests
packages/vue-query/src/__tests__/*.test.ts
Replaced test(...) with it(...) across all 18 Vue Query test files (mutationCache, queryCache, queryClient, useInfiniteQuery, useIsFetching, useIsMutating, useMutation, usePrefetchInfiniteQuery, usePrefetchQuery, useQueries, useQuery, useQueryClient, utils, vueQueryPlugin).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hop, test it now with gentle care,
From test to it, a refactor fair,
Consistent rules across the land,
Each spec file lends a helping hand,
Vitest cheers at the change so neat! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: migrating from 'test' to 'it' and enforcing consistency with a new ESLint rule.
Description check ✅ Passed The description comprehensively covers the changes, motivation, implementation approach, verification results, and impact—it follows the template structure with both required sections completed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/migrate-test-to-it-and-enforce-consistent-rule

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 20, 2026

View your CI Pipeline Execution ↗ for commit 2e012f1

Command Status Duration Result
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1s View ↗
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 1m 16s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-20 13:57:06 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 20, 2026

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@sukvvon sukvvon self-assigned this Apr 20, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 20, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10528

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10528

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10528

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10528

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10528

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10528

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10528

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10528

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10528

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10528

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10528

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10528

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10528

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10528

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10528

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10528

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10528

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10528

@tanstack/vue-query-devtools

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

commit: 2e012f1

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 20, 2026

size-limit report 📦

Path Size
react full 11.99 KB (0%)
react minimal 9.02 KB (0%)

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/angular-query-experimental/src/__tests__/inject-infinite-query.test.ts (1)

26-64: ⚠️ Potential issue | 🟠 Major

vitest/expect-expect may fail this test despite helper assertions

This case relies on expectSignals(...) only, so ESLint can flag it as “no assertions.” Please either add a direct expect(...) in this test or configure vitest/expect-expect to recognize expectSignals as an assertion function.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/angular-query-experimental/src/__tests__/inject-infinite-query.test.ts`
around lines 26 - 64, The test uses only the custom helper expectSignals(...) so
the vitest rule vitest/expect-expect may complain about missing direct
assertions; add a direct expect(...) assertion (for example checking query.data
or query.status or that query is defined) somewhere in the test (e.g., after the
initial wait and/or after fetchNextPage) so that the linter recognizes an
assertion, referencing the existing symbols query and expectSignals and keeping
the existing helper assertions intact.
🧹 Nitpick comments (1)
packages/query-core/src/__tests__/mutations.test.tsx (1)

1087-1087: Optional: fix grammar in test title for readability.

Line 1087 reads “where it are reported”; consider “where they are reported”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/query-core/src/__tests__/mutations.test.tsx` at line 1087, Update
the test title string in the it(...) call (the description starting "errors by
onError and consecutive onSettled callbacks are transferred to different
execution context where it are reported") to fix the grammar by replacing "it
are reported" with "they are reported" so the description reads "...where they
are reported".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@packages/preact-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx`:
- Line 14: The named imports from 'vitest' are out of order causing the linter
error; update the import list in the import statement that currently includes
afterEach, beforeEach, describe, expect, vi, it to a lint-sorted order (e.g.,
afterEach, beforeEach, describe, expect, it, vi) so that vi comes after it and
satisfies the sort-imports rule.

In `@packages/preact-query/src/__tests__/HydrationBoundary.test.tsx`:
- Line 6: The import specifiers from vitest are out of the configured
sort-imports order; reorder the named imports on the line importing from
'vitest' so they follow the project's sort order (e.g., ensure the sequence
matches afterEach, beforeEach, describe, expect, it, vi or whatever the linter
expects). Update the import statement that currently lists "afterEach,
beforeEach, describe, expect, vi, it" to the correct ordering containing the
same symbols (for example "afterEach, beforeEach, describe, expect, it, vi") so
the linter rule sort-imports is satisfied.

In `@packages/preact-query/src/__tests__/QueryClientProvider.test.tsx`:
- Line 3: The named imports from 'vitest' are not alphabetized (the `it` and
`vi` order is swapped); update the import statement that lists afterEach,
beforeEach, describe, expect, vi, it so the named imports are sorted
alphabetically (afterEach, beforeEach, describe, expect, it, vi) to satisfy the
`sort-imports` lint rule.

---

Outside diff comments:
In
`@packages/angular-query-experimental/src/__tests__/inject-infinite-query.test.ts`:
- Around line 26-64: The test uses only the custom helper expectSignals(...) so
the vitest rule vitest/expect-expect may complain about missing direct
assertions; add a direct expect(...) assertion (for example checking query.data
or query.status or that query is defined) somewhere in the test (e.g., after the
initial wait and/or after fetchNextPage) so that the linter recognizes an
assertion, referencing the existing symbols query and expectSignals and keeping
the existing helper assertions intact.

---

Nitpick comments:
In `@packages/query-core/src/__tests__/mutations.test.tsx`:
- Line 1087: Update the test title string in the it(...) call (the description
starting "errors by onError and consecutive onSettled callbacks are transferred
to different execution context where it are reported") to fix the grammar by
replacing "it are reported" with "they are reported" so the description reads
"...where they are reported".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5c910514-eab3-4d16-bd33-82493b6c9d1e

📥 Commits

Reviewing files that changed from the base of the PR and between 799952f and d1ea27b.

📒 Files selected for processing (77)
  • eslint.config.js
  • packages/angular-query-experimental/src/__tests__/infinite-query-options.test-d.ts
  • packages/angular-query-experimental/src/__tests__/inject-infinite-query.test-d.ts
  • packages/angular-query-experimental/src/__tests__/inject-infinite-query.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-is-fetching.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-is-mutating.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-is-restoring.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-mutation-state.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-mutation.test-d.ts
  • packages/angular-query-experimental/src/__tests__/inject-mutation.test.ts
  • packages/angular-query-experimental/src/__tests__/inject-query.test-d.ts
  • packages/angular-query-experimental/src/__tests__/inject-query.test.ts
  • packages/angular-query-experimental/src/__tests__/pending-tasks.test.ts
  • packages/angular-query-experimental/src/__tests__/provide-query-client.test.ts
  • packages/angular-query-experimental/src/__tests__/provide-tanstack-query.test.ts
  • packages/angular-query-experimental/src/__tests__/query-options.test-d.ts
  • packages/angular-query-experimental/src/__tests__/signal-proxy.test.ts
  • packages/angular-query-experimental/src/__tests__/with-devtools.test.ts
  • packages/angular-query-persist-client/src/__tests__/with-persist-query-client.test.ts
  • packages/eslint-plugin-query/src/__tests__/sort-data-by-order.utils.test.ts
  • packages/eslint-plugin-query/src/__tests__/test-utils.test.ts
  • packages/preact-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
  • packages/preact-query/src/HydrationBoundary.tsx
  • packages/preact-query/src/__tests__/HydrationBoundary.test.tsx
  • packages/preact-query/src/__tests__/QueryClientProvider.test.tsx
  • packages/preact-query/src/__tests__/infiniteQueryOptions.test-d.tsx
  • packages/preact-query/src/__tests__/useQuery.test.tsx
  • packages/preact-query/src/utils.ts
  • packages/query-async-storage-persister/src/__tests__/asyncThrottle.test.ts
  • packages/query-core/src/__tests__/environmentManager.test.tsx
  • packages/query-core/src/__tests__/focusManager.test.tsx
  • packages/query-core/src/__tests__/hydration.test.tsx
  • packages/query-core/src/__tests__/infiniteQueryBehavior.test.tsx
  • packages/query-core/src/__tests__/infiniteQueryObserver.test.tsx
  • packages/query-core/src/__tests__/mutationCache.test.tsx
  • packages/query-core/src/__tests__/mutationObserver.test.tsx
  • packages/query-core/src/__tests__/mutations.test.tsx
  • packages/query-core/src/__tests__/onlineManager.test.tsx
  • packages/query-core/src/__tests__/queriesObserver.test.tsx
  • packages/query-core/src/__tests__/query.test.tsx
  • packages/query-core/src/__tests__/queryCache.test.tsx
  • packages/query-core/src/__tests__/queryClient.test.tsx
  • packages/query-core/src/__tests__/queryObserver.test.tsx
  • packages/query-core/src/__tests__/streamedQuery.test.tsx
  • packages/query-persist-client-core/src/__tests__/createPersister.test.ts
  • packages/query-persist-client-core/src/__tests__/persist.test.ts
  • packages/query-sync-storage-persister/src/__tests__/storageIsFull.test.ts
  • packages/react-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
  • packages/react-query/src/__tests__/HydrationBoundary.test.tsx
  • packages/react-query/src/__tests__/QueryClientProvider.test.tsx
  • packages/react-query/src/__tests__/infiniteQueryOptions.test-d.tsx
  • packages/react-query/src/__tests__/useQuery.test.tsx
  • packages/solid-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx
  • packages/svelte-query-persist-client/tests/PersistQueryClientProvider.svelte.test.ts
  • packages/svelte-query/tests/QueryClientProvider/QueryClientProvider.svelte.test.ts
  • packages/svelte-query/tests/context/context.svelte.test.ts
  • packages/svelte-query/tests/createMutation/createMutation.svelte.test.ts
  • packages/svelte-query/tests/infiniteQueryOptions.test-d.ts
  • packages/svelte-query/tests/mutationOptions/mutationOptions.test-d.ts
  • packages/svelte-query/tests/queryOptions.test-d.ts
  • packages/svelte-query/tests/useIsFetching/useIsFetching.svelte.test.ts
  • packages/svelte-query/tests/useIsMutating/useIsMutating.svelte.test.ts
  • packages/svelte-query/tests/useMutationState/useMutationState.svelte.test.ts
  • packages/vue-query/src/__tests__/mutationCache.test.ts
  • packages/vue-query/src/__tests__/queryCache.test.ts
  • packages/vue-query/src/__tests__/queryClient.test.ts
  • packages/vue-query/src/__tests__/useInfiniteQuery.test.ts
  • packages/vue-query/src/__tests__/useIsFetching.test.ts
  • packages/vue-query/src/__tests__/useIsMutating.test.ts
  • packages/vue-query/src/__tests__/useMutation.test.ts
  • packages/vue-query/src/__tests__/usePrefetchInfiniteQuery.test.ts
  • packages/vue-query/src/__tests__/usePrefetchQuery.test.ts
  • packages/vue-query/src/__tests__/useQueries.test.ts
  • packages/vue-query/src/__tests__/useQuery.test.ts
  • packages/vue-query/src/__tests__/useQueryClient.test.ts
  • packages/vue-query/src/__tests__/utils.test.ts
  • packages/vue-query/src/__tests__/vueQueryPlugin.test.ts
💤 Files with no reviewable changes (1)
  • packages/preact-query/src/utils.ts

import type { UseQueryResult } from '../../../preact-query/src'
import { QueryClient, useQuery } from '../../../preact-query/src'
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
import { afterEach, beforeEach, describe, expect, vi, it } from 'vitest'
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.

⚠️ Potential issue | 🟡 Minor

Fix named import member order to satisfy lint.

Line 14 has vi before it, which violates the active sort-imports rule and can fail CI.

🔧 Proposed fix
-import { afterEach, beforeEach, describe, expect, vi, it } from 'vitest'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { afterEach, beforeEach, describe, expect, vi, it } from 'vitest'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
🧰 Tools
🪛 ESLint

[error] 14-14: Member 'it' of the import declaration should be sorted alphabetically.

(sort-imports)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/preact-query-persist-client/src/__tests__/PersistQueryClientProvider.test.tsx`
at line 14, The named imports from 'vitest' are out of order causing the linter
error; update the import list in the import statement that currently includes
afterEach, beforeEach, describe, expect, vi, it to a lint-sorted order (e.g.,
afterEach, beforeEach, describe, expect, it, vi) so that vi comes after it and
satisfies the sort-imports rule.

import { render } from '@testing-library/preact'
import { Suspense, startTransition } from 'preact/compat'
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
import { afterEach, beforeEach, describe, expect, vi, it } from 'vitest'
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.

⚠️ Potential issue | 🟡 Minor

Fix vitest import member order to satisfy sort-imports.

it and vi are out of configured order on this line.

Proposed fix
-import { afterEach, beforeEach, describe, expect, vi, it } from 'vitest'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { afterEach, beforeEach, describe, expect, vi, it } from 'vitest'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
🧰 Tools
🪛 ESLint

[error] 6-6: Member 'it' of the import declaration should be sorted alphabetically.

(sort-imports)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/preact-query/src/__tests__/HydrationBoundary.test.tsx` at line 6,
The import specifiers from vitest are out of the configured sort-imports order;
reorder the named imports on the line importing from 'vitest' so they follow the
project's sort order (e.g., ensure the sequence matches afterEach, beforeEach,
describe, expect, it, vi or whatever the linter expects). Update the import
statement that currently lists "afterEach, beforeEach, describe, expect, vi, it"
to the correct ordering containing the same symbols (for example "afterEach,
beforeEach, describe, expect, it, vi") so the linter rule sort-imports is
satisfied.

import { queryKey, sleep } from '@tanstack/query-test-utils'
import { render } from '@testing-library/preact'
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
import { afterEach, beforeEach, describe, expect, vi, it } from 'vitest'
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.

⚠️ Potential issue | 🟡 Minor

Fix import member order to satisfy sort-imports

it is out of the expected alphabetical order in the Vitest named import. Please reorder this import to clear the lint error.

🧰 Tools
🪛 ESLint

[error] 3-3: Member 'it' of the import declaration should be sorted alphabetically.

(sort-imports)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/preact-query/src/__tests__/QueryClientProvider.test.tsx` at line 3,
The named imports from 'vitest' are not alphabetized (the `it` and `vi` order is
swapped); update the import statement that lists afterEach, beforeEach,
describe, expect, vi, it so the named imports are sorted alphabetically
(afterEach, beforeEach, describe, expect, it, vi) to satisfy the `sort-imports`
lint rule.

@sukvvon sukvvon merged commit 6b6667e into main Apr 20, 2026
8 checks passed
@sukvvon sukvvon deleted the test/migrate-test-to-it-and-enforce-consistent-rule branch April 20, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment