-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
fix(eslint-plugin): avoid imports from typescript #9759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
π¦ Changeset detectedLatest commit: d9ad4a7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughReplaces direct Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as ESLint CLI
participant ESL as ESLint
participant Rule as no-void-query-fn rule
participant PS as ParserServicesWithTypeInformation
participant TC as TypeChecker (from PS)
Dev->>ESL: Run lint
ESL->>Rule: Evaluate rule for function node
Rule->>PS: getParserServices() / request Program & services
PS-->>Rule: Program, parser services, and typeChecker
Rule->>TC: getTypeAtLocation(returnNode)
TC-->>Rule: Type
Note over Rule: Use local TypeFlags (Void/Undefined) to check awaited type
Rule-->>ESL: Report violation if illegal void/undefined return
ESL-->>Dev: Lint results
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~20 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touchesβ Failed checks (2 warnings)
β Passed checks (3 passed)
β¨ Finishing touches
π§ͺ Generate unit tests (beta)
π Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro π Files selected for processing (1)
β° Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
π Additional comments (2)
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 |
|
View your CI Pipeline Execution β for commit d9ad4a7
βοΈ Nx Cloud last updated this comment at |
|
Sizes for commit d9ad4a7:
|
Codecov Reportβ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #9759 +/- ##
===========================================
+ Coverage 45.54% 83.36% +37.81%
===========================================
Files 196 19 -177
Lines 8328 559 -7769
Branches 1903 204 -1699
===========================================
- Hits 3793 466 -3327
+ Misses 4093 71 -4022
+ Partials 442 22 -420 π New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
π§Ή Nitpick comments (1)
packages/eslint-plugin-query/src/rules/no-void-query-fn/no-void-query-fn.rule.ts (1)
81-91: LGTM!The refactored
isIllegalReturnfunction correctly uses the localTypeFlagsconstant and maintains the same logic as before.Optional: The ternary on line 90 can be simplified:
- return awaited.flags & (TypeFlags.Void | TypeFlags.Undefined) ? true : false + return (awaited.flags & (TypeFlags.Void | TypeFlags.Undefined)) !== 0
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π Files selected for processing (2)
.changeset/shy-wasps-pull.md(1 hunks)packages/eslint-plugin-query/src/rules/no-void-query-fn/no-void-query-fn.rule.ts(3 hunks)
β° Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Preview
- GitHub Check: Test
π Additional comments (3)
.changeset/shy-wasps-pull.md (1)
1-5: LGTM!The changeset correctly documents this as a patch-level fix. The description accurately captures the essence of the change.
packages/eslint-plugin-query/src/rules/no-void-query-fn/no-void-query-fn.rule.ts (2)
5-5: LGTM!The type-only import of
ParserServicesWithTypeInformationis correct and eliminates the need for direct TypeScript imports.
77-79: LGTM!The type aliases correctly derive types from
ParserServicesWithTypeInformationwithout importing TypeScript directly. This approach is actually more type-safe because it guarantees compatibility with the parser services' actual return types.
π― Changes
fixes #9097
While a proper solution would be to split rules that requires type check, it's a bit too early to do it. for now, let's keep it simple.
β Checklist
pnpm run test:pr.π Release Impact
Summary by CodeRabbit