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

Properly elide TS imports even when referenced by shadowing variables #342

Merged
merged 1 commit into from Nov 19, 2018

Conversation

alangpierce
Copy link
Owner

Fixes #298

TypeScript is required to remove imports where all bindings are never referenced
in a value position, but previously it could have false positives when there are
shadowed variables with the same name. Now, we do the intelligent scope-based
shadowed global detection like we do with import replacement and properly elide
when necessary.

Fixes #298

TypeScript is required to remove imports where all bindings are never referenced
in a value position, but previously it could have false positives when there are
shadowed variables with the same name. Now, we do the intelligent scope-based
shadowed global detection like we do with import replacement and properly elide
when necessary.
@codecov-io
Copy link

Codecov Report

Merging #342 into master will decrease coverage by 0.06%.
The diff coverage is 82.22%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #342      +/-   ##
==========================================
- Coverage   77.47%   77.41%   -0.07%     
==========================================
  Files          41       42       +1     
  Lines        5305     5529     +224     
  Branches     1289     1302      +13     
==========================================
+ Hits         4110     4280     +170     
- Misses        827      878      +51     
- Partials      368      371       +3
Impacted Files Coverage Δ
src/util/getNonTypeIdentifiers.ts 100% <ø> (+25%) ⬆️
src/index.ts 89.36% <100%> (+4.51%) ⬆️
src/util/getTSImportedNames.ts 80.48% <80.48%> (ø)
src/util/formatTokens.ts 70.58% <0%> (-10.06%) ⬇️
src/parser/plugins/flow.ts 58.46% <0%> (-2.35%) ⬇️
src/parser/plugins/jsx/index.ts 89.11% <0%> (-2.07%) ⬇️
src/parser/tokenizer/readWord.ts 70.35% <0%> (-1.47%) ⬇️
src/util/getClassInfo.ts 85.12% <0%> (-1.21%) ⬇️
src/parser/traverser/statement.ts 80.14% <0%> (-0.84%) ⬇️
src/parser/traverser/lval.ts 95.94% <0%> (-0.78%) ⬇️
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41476b0...ef138e1. Read the comment docs.

@alangpierce alangpierce merged commit 57323b6 into master Nov 19, 2018
@alangpierce alangpierce deleted the respect-shadowing-in-ts-import-elision branch November 19, 2018 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants