Skip to content
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(typescript-estree): correct ChainExpression interaction with parentheses and non-nulls #2380

Merged
merged 1 commit into from Aug 10, 2020

Conversation

bradzacher
Copy link
Member

I did some alignment testing against babel and found they handled some things differently. I decided their way was better, so updating the representation to match.

Previously:

  • we emitted a different AST for pre-3.9 and post-3.9
  • we treated TSNonNullExpression as a breakage in the chain, meaning that the ChainExpression would not move up through them.

Now:

  • we emit the same AST regardless of TS version
  • we treat TSNonNullExpression as a ChainElement, so the ChainExpression always moves past them in the tree

@bradzacher bradzacher added the bug Something isn't working label Aug 10, 2020
@bradzacher bradzacher added this to the 4.0.0 milestone Aug 10, 2020
@typescript-eslint
Copy link
Contributor

Thanks for the PR, @bradzacher!

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. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@codecov
Copy link

codecov bot commented Aug 10, 2020

Codecov Report

Merging #2380 into v4 will decrease coverage by 0.15%.
The diff coverage is 56.09%.

@@            Coverage Diff             @@
##               v4    #2380      +/-   ##
==========================================
- Coverage   92.96%   92.81%   -0.16%     
==========================================
  Files         286      286              
  Lines        9046     9048       +2     
  Branches     2514     2509       -5     
==========================================
- Hits         8410     8398      -12     
- Misses        305      320      +15     
+ Partials      331      330       -1     
Flag Coverage Δ
#unittest 92.81% <56.09%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...pt-estree/src/ts-estree/estree-to-ts-node-types.ts 100.00% <ø> (ø)
...n/src/rules/no-non-null-asserted-optional-chain.ts 41.93% <21.73%> (-50.93%) ⬇️
...s/eslint-plugin/src/rules/prefer-optional-chain.ts 94.23% <100.00%> (+0.05%) ⬆️
packages/typescript-estree/src/convert.ts 98.37% <100.00%> (+0.01%) ⬆️
packages/typescript-estree/src/node-utils.ts 97.68% <100.00%> (+0.98%) ⬆️

@bradzacher bradzacher merged commit cf29440 into v4 Aug 10, 2020
@bradzacher bradzacher deleted the v4-fix-optional-chain branch August 10, 2020 01:47
bradzacher added a commit that referenced this pull request Aug 10, 2020
bradzacher added a commit that referenced this pull request Aug 19, 2020
bradzacher added a commit that referenced this pull request Aug 29, 2020
bradzacher added a commit that referenced this pull request Aug 29, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant