Skip to content

test(preact-query): apply 'prefer-template', 'no-else-return', 'object-shorthand', 'radix', and 'require-await' eslint rules#10346

Merged
sukvvon merged 2 commits intomainfrom
test/preact-query-fix-eslint-warnings
Mar 28, 2026
Merged

test(preact-query): apply 'prefer-template', 'no-else-return', 'object-shorthand', 'radix', and 'require-await' eslint rules#10346
sukvvon merged 2 commits intomainfrom
test/preact-query-fix-eslint-warnings

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented Mar 28, 2026

🎯 Changes

Apply eslint-config-preact rules to test files to resolve ESLint warnings:

  • prefer-template: replace string concatenation with template literals
  • no-else-return: remove unnecessary else after return
  • object-shorthand: use shorthand property syntax
  • radix: add explicit radix parameter to parseInt calls
  • @typescript-eslint/require-await: remove unnecessary async keyword from queryFn without await
  • Remove unused eslint-disable directive

✅ 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 is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Updated test utilities across multiple test suites to use template literals instead of string concatenation for improved code consistency and readability.
    • Enhanced test specifications with explicit parameter values and simplified conditional logic for better test maintainability.

…t-shorthand', 'radix', and 'require-await' eslint rules
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7314b1a1-d0ce-44e9-8c24-77ea75c3a60f

📥 Commits

Reviewing files that changed from the base of the PR and between 0e939ac and 468d906.

📒 Files selected for processing (6)
  • packages/preact-query/src/__tests__/useMutationState.test.tsx
  • packages/preact-query/src/__tests__/usePrefetchInfiniteQuery.test.tsx
  • packages/preact-query/src/__tests__/useQueries.test.tsx
  • packages/preact-query/src/__tests__/useQuery.test.tsx
  • packages/preact-query/src/__tests__/useSuspenseQueries.test.tsx
  • packages/preact-query/src/__tests__/useSuspenseQuery.test.tsx
💤 Files with no reviewable changes (1)
  • packages/preact-query/src/tests/useSuspenseQuery.test.tsx

📝 Walkthrough

Walkthrough

Test files across the preact-query package are modernized to use template literals instead of string concatenation in query functions and assertions. Minor adjustments include explicit radix parameters in parseInt calls and simplified conditional logic. All changes remain confined to test files with no impact on public APIs.

Changes

Cohort / File(s) Summary
String Formatting Modernization
packages/preact-query/src/__tests__/useMutationState.test.tsx, packages/preact-query/src/__tests__/usePrefetchInfiniteQuery.test.tsx, packages/preact-query/src/__tests__/useSuspenseQueries.test.tsx, packages/preact-query/src/__tests__/useSuspenseQuery.test.tsx
Updated string construction in test query functions from concatenation to template literals (e.g., 'data' + input`data${input}`). Removed unnecessary eslint-disable directive in one test.
Query Function & Assertion Refactoring
packages/preact-query/src/__tests__/useQueries.test.tsx
Converted string concatenation to template literals across multiple test cases; added explicit radix parameter (10) to parseInt() calls throughout test selectors.
Query Function & Assertion Refactoring
packages/preact-query/src/__tests__/useQuery.test.tsx
Replaced string concatenation with template literals in multiple queryFn return values; simplified conditional logic by removing redundant else branches; adjusted one queryFn from async to synchronous while preserving return values; updated error assertion shorthand syntax.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Whiskers twitch with template cheer,
Backticks dancing, oh so dear!
Concatenation's gone away,
Strings interpolate with flair today—
Tests now shimmer, bright and clean! ✨

🚥 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 accurately summarizes the main objective: applying multiple ESLint rules to test files in the preact-query package.
Description check ✅ Passed The description fully covers the changes made, includes detailed explanations of each ESLint rule applied, and completes all required checklist items with proper release impact designation.

✏️ 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/preact-query-fix-eslint-warnings

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

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 28, 2026

View your CI Pipeline Execution ↗ for commit 468d906

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

☁️ Nx Cloud last updated this comment at 2026-03-28 12:55:29 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 28, 2026

🚀 Changeset Version Preview

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 28, 2026

More templates

@tanstack/angular-query-experimental

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

@tanstack/eslint-plugin-query

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

@tanstack/preact-query

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

@tanstack/preact-query-devtools

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

@tanstack/preact-query-persist-client

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

@tanstack/query-async-storage-persister

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

@tanstack/query-broadcast-client-experimental

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

@tanstack/query-core

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

@tanstack/query-devtools

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

@tanstack/query-persist-client-core

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

@tanstack/query-sync-storage-persister

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

@tanstack/react-query

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

@tanstack/react-query-devtools

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

@tanstack/react-query-next-experimental

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

@tanstack/react-query-persist-client

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

@tanstack/solid-query

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

@tanstack/solid-query-devtools

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

@tanstack/solid-query-persist-client

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

@tanstack/svelte-query

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

@tanstack/svelte-query-devtools

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

@tanstack/svelte-query-persist-client

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

@tanstack/vue-query

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

@tanstack/vue-query-devtools

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

commit: 468d906

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 28, 2026

size-limit report 📦

Path Size
react full 11.98 KB (0%)
react minimal 9.01 KB (0%)

@sukvvon sukvvon merged commit a62f695 into main Mar 28, 2026
8 checks passed
@sukvvon sukvvon deleted the test/preact-query-fix-eslint-warnings branch March 28, 2026 13:16
@sukvvon sukvvon self-assigned this Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant