fix(eslint-plugin-query): fix no-void-query-fn false positive on enums for TS 6#10460
fix(eslint-plugin-query): fix no-void-query-fn false positive on enums for TS 6#10460park-jemin wants to merge 1 commit intoTanStack:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughFixed a TypeScript 6 compatibility issue in the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
13bc0a6 to
26d8141
Compare
🎯 Changes
Resolves: #10461
The
no-void-query-fnrule incorrectly reports a violation when returning a TypeScript enum member viaqueryFn. This only occurs when using TypeScript 6.0+On investigating, looks like we're implicitly relying on these values for
TypeFlagswhich should be internal to TS.The underlying values for
TypeFlagswere reordered in this change: microsoft/TypeScript#63084. This ends up actually testing forUniqueESSymbol | EnumLiteralinstead ofVoid | Undefinedas intended.Fix
Went ahead and replaced this flag check with
checker.typeToString(), which should be a stable public API that works identically across all supported TypeScript versions since checker was introduced:✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit
Bug Fixes
no-void-query-fnESLint rule to correctly handle TypeScript enum return types, preventing false positives when query functions return enum values.