-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix(react-query): eslint-plugin-query now working with vanilla js #8322
base: main
Are you sure you want to change the base?
Conversation
packages/eslint-plugin-query/src/utils/detect-react-query-imports.ts
Outdated
Show resolved
Hide resolved
☁️ Nx Cloud ReportCI is running/has finished running commands for commit b23e44b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
there’s a lint error because typescript thinks the check is unnecessary:
you must likely disable the linter for this line |
This should make it pass the eslint-plugin test
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8322 +/- ##
===========================================
+ Coverage 45.96% 88.15% +42.18%
===========================================
Files 200 15 -185
Lines 7508 498 -7010
Branches 1715 186 -1529
===========================================
- Hits 3451 439 -3012
+ Misses 3680 45 -3635
+ Partials 377 14 -363
|
To fix the issue with detecting imports in both TypeScript and JavaScript files, I modify the
ImportDeclaration
handler to handle cases whereimportKind
might be undefined.The key change is adding
node.importKind === undefined
to the condition. This ensures the import detection works for both TypeScript (whereimportKind
is explicitly 'value') and JavaScript (whereimportKind
is undefined).This modification should resolve the lint plugin's compatibility issue with vanilla JavaScript apps by allowing import detection regardless of the
importKind
value.closes #8257