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): persisted parse and module none #1516

Merged
merged 4 commits into from Feb 3, 2020
Merged

fix(typescript-estree): persisted parse and module none #1516

merged 4 commits into from Feb 3, 2020

Conversation

armano2
Copy link
Member

@armano2 armano2 commented Jan 25, 2020

This PR fixes issue when persisted parse is called with module option set to "none",

fixes #1502

@armano2 armano2 added the bug Something isn't working label Jan 25, 2020
@armano2 armano2 self-assigned this Jan 25, 2020
@typescript-eslint

This comment has been minimized.

@armano2

This comment has been minimized.

Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just assumed we always needed to set the parent pointers.
The thing I hate is that this method has side-effects, and we can't just call a method to set parent pointers.

cc @uniqueiniquity for "when we need to call it"

@armano2
Copy link
Member Author

armano2 commented Jan 25, 2020

Typescript actually calls this function to "fix" parent nodes.

https://github.com/microsoft/TypeScript/blob/9ba45fcaace07510ef259d4cda2bc5ec523cf6d1/src/compiler/parser.ts#L887-L917

normally parent references are set during binding. However, for clients that only need a syntax tree, and no semantic features, then the binding process is an unnecessary overhead. This functions allows us to set all the parents, without all the expense of binding.

@armano2
Copy link
Member Author

armano2 commented Jan 25, 2020

i'm tempted to remove calls to parent node from converter as we are already traversing nodes,
that should allow me to remove this code and remove it from other places

currently in all other parsing modes we are setting up setParentNodes property as true to get this fixed just for this,

Update:
few missing comments about parent nodes are added

@armano2

This comment has been minimized.

@armano2 armano2 added the package: typescript-estree Issues related to @typescript-eslint/typescript-estree label Jan 25, 2020
@armano2 armano2 marked this pull request as ready for review January 25, 2020 19:38
@bradzacher

This comment has been minimized.

@bradzacher bradzacher closed this Jan 26, 2020
@armano2 armano2 deleted the module-none branch January 30, 2020 19:27
@armano2 armano2 restored the module-none branch January 30, 2020 20:05
@armano2 armano2 reopened this Jan 30, 2020
@codecov
Copy link

codecov bot commented Jan 30, 2020

Codecov Report

Merging #1516 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1516      +/-   ##
==========================================
+ Coverage   95.42%   95.42%   +<.01%     
==========================================
  Files         140      140              
  Lines        6400     6401       +1     
  Branches     1832     1832              
==========================================
+ Hits         6107     6108       +1     
  Misses        108      108              
  Partials      185      185
Impacted Files Coverage Δ
...estree/src/create-program/createIsolatedProgram.ts 75% <ø> (ø) ⬆️
...-estree/src/create-program/createDefaultProgram.ts 76.19% <100%> (ø) ⬆️
...pt-estree/src/create-program/createWatchProgram.ts 92.39% <100%> (+0.04%) ⬆️

Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for fixing this

@bradzacher bradzacher merged commit 7c70323 into typescript-eslint:master Feb 3, 2020
@armano2 armano2 deleted the module-none branch February 3, 2020 17:35
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: typescript-estree Issues related to @typescript-eslint/typescript-estree
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parsing errors when tsconfig.json's compilerOption's module is set to none
2 participants