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): [prefer-optional-chain] fix ThisExpression
and PrivateIdentifier
errors
#6028
Merged
bradzacher
merged 25 commits into
typescript-eslint:main
from
omril1:fix/issue6024-fix-prefer-optional-chain-private-and-this-in-negated-or
Jan 31, 2023
Merged
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
71cb502
prevent thrown error from default case
5acc1af
try
a3b6eda
Revert "try"
a68b13a
More cases and format
7e2185e
Update packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts
omril1 1a30e94
Merge remote-tracking branch 'upstream/main' into fix/issue6024-fix-p…
21cfbd2
TSAsExpression,AwaitExpression,NewExpression
0ae6c45
Merge remote-tracking branch 'upstream/main' into fix/issue6024-fix-p…
ecfacff
Merge branch 'main' into fix/issue6024-fix-prefer-optional-chain-priv…
3ce9b0a
Merge branch 'main' into fix/issue6024-fix-prefer-optional-chain-priv…
c3c458e
CR: remove throws and simplify switch cases
9c15f28
Merge branch 'main' into fix/issue6024-fix-prefer-optional-chain-priv…
ab70949
support private identifiers
e58dab9
Merge remote-tracking branch 'upstream/main' into fix/issue6024-fix-p…
12effef
coverage
0afc516
over covered case
8efa51d
Clearly, we had some missing coverage 😄
57b86c1
this got uglier
99528f0
fix coverage
cbb5168
Merge branch 'main' into fix/issue6024-fix-prefer-optional-chain-priv…
b6d265c
Merge branch 'main' into fix/issue6024-fix-prefer-optional-chain-priv…
54d4664
Merge branch 'main' into fix/issue6024-fix-prefer-optional-chain-priv…
ac8b6a2
Merge remote-tracking branch 'upstream/main' into fix/issue6024-fix-p…
a2a6314
Merge branch 'main' into fix/issue6024-fix-prefer-optional-chain-priv…
37716b2
Merge branch 'main' into fix/issue6024-fix-prefer-optional-chain-priv…
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 should still report a complaint:
I suspect the issue is returning
''
instead of the actual node text above.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.
bump on this 😇
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.
The highlighted line has two different properties (
#a
and#b
) and the example seems to be covered by this, am I missing something?typescript-eslint/packages/eslint-plugin/tests/rules/prefer-optional-chain.test.ts
Lines 141 to 144 in 0afc516
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.
Ah sorry you're right, I missed that they're the same property. But this actually brings up that there's a bug in this PR for private identifiers: microsoft/TypeScript#42734 blocks them from being used.
https://deploy-preview-6028--typescript-eslint.netlify.app/play#ts=4.9.3&sourceType=module&code=MYGwhgzhAEBqCWB7cAXJA7aBvAUNaAxAA4BOiRApiSgJ7QC80ADANw57QoUQoAUAlNg75gidD2gQKIAGYNoAWTAoAFgDoSYdABNEAWwHQA-JxXwYALmgBXHRRnx0FbW2GTpMo2uJlK1Gmz4AL44IUA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Y6RAM0WloHsalfkwCG8WmQAWo5uii9o-aJHBgAviHVA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA
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.
So do I revert it for now? What do you suggest?
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.
Well, it shouldn't throw an error - that's definitely a bug. But it also shouldn't complain. The rule should effectively ignore this case for now.
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.
Kept the private properties in computed nodes