-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(eslint-plugin): [no-unnecessary-condition] false positive on optional private field #9602
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(eslint-plugin): [no-unnecessary-condition] false positive on optional private field #9602
Conversation
…onal private field Closes typescript-eslint#9564
Thanks for the PR, @StyleShit! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit ef7539f. 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 1 targetSent with 💌 from NxCloud. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9602 +/- ##
=======================================
Coverage 88.45% 88.45%
=======================================
Files 422 422
Lines 14694 14695 +1
Branches 4299 4298 -1
=======================================
+ Hits 12997 12998 +1
Misses 1372 1372
Partials 325 325
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -211,15 +211,20 @@ export default createRule<Options, MessageId>({ | |||
} | |||
const property = node.property; | |||
|
|||
if (property.type === AST_NODE_TYPES.Identifier) { |
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.
This condition is unnecessary because the property type is Identifier | PrivateIdentifier
,
and now we catch both of them
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.
Looks good to me! Nice 🙂
PR Checklist
Overview
This PR accounts for private identifiers when checking if a member expression is nullable
Not sure if/which additional test cases I should add here, so I'm open for suggestions 😄