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): ensure parents are defined #500

Merged

Conversation

uniqueiniquity
Copy link
Contributor

Fixes #498

When getting the updated program from the TS watch program, it doesn't automatically set parent pointers in the contained source files (which we then traverse as ASTs). By getting the type checker, it triggers a side effect to set those parent pointers.

@codecov
Copy link

codecov bot commented May 7, 2019

Codecov Report

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

@@            Coverage Diff             @@
##           master     #500      +/-   ##
==========================================
+ Coverage   95.76%   95.76%   +<.01%     
==========================================
  Files          78       78              
  Lines        3491     3493       +2     
  Branches      963      963              
==========================================
+ Hits         3343     3345       +2     
  Misses         53       53              
  Partials       95       95
Impacted Files Coverage Δ
packages/typescript-estree/src/tsconfig-parser.ts 88.57% <100%> (+0.33%) ⬆️

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.

relying on side effects seems like a bit of a hack...
But I trust you 😄

@uniqueiniquity
Copy link
Contributor Author

uniqueiniquity commented May 8, 2019

@bradzacher This is actually done frequently inside the TS language service... it's basically the canonical way of forcing parent pointers to be bound 🤢

@bradzacher
Copy link
Member

Haha a canonical hack is the best kind of hack!

@bradzacher bradzacher merged commit 665278f into typescript-eslint:master May 8, 2019
@uniqueiniquity uniqueiniquity deleted the setParentPointers branch May 8, 2019 15:31
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linting via ESLint API fails with 'Cannot read property of undefined' but only on subsequent invocations
2 participants