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): ts returning wrong file with project references #1575

Merged
merged 2 commits into from Feb 7, 2020

Conversation

bradzacher
Copy link
Member

Fixes #1573

@bradzacher bradzacher added the bug Something isn't working label Feb 6, 2020
@typescript-eslint

This comment has been minimized.

@armano2
Copy link
Member

armano2 commented Feb 6, 2020

this is actually not issue as order of references is important and has to be respected by typescript

see https://www.typescriptlang.org/docs/handbook/project-references.html


in case when projects are using references user has to provide paths to all tsconfigs in correct order.
i think we should just add this to documentation/readme

@bradzacher
Copy link
Member Author

I don't see why we'd force users to do that:

  • it's error prone, and can be really hard to reason about if you've got a complex project setup.
  • if you use globs to setup your projects (like we do) then there's no way to specify ordering, so can't use that feature in that case.
  • if you have cycles in your project references, then you wouldn't be able to order them correctly.

The problem is that if you trigger this "bug", then you don't get an error message or anything - you might not even know because you might get no lint messages if the .d.ts has no lint reports. Which is a really bad experience for users.

Similarly you might also get weird lint messages, esp if you have stylistic rules on (like indent, or member delimiter spacing), and the line numbers etc won't match up to your source file.

Also you may not always trigger the bug, which can be really frustrating for an end user.
Eg:

  • See linked issue - if one project is nested inside the other, then it triggers the error, if they're side by side (as in a packages folder), then it triggers this error.
  • If you haven't built the project, then there's no .d.ts file for TS to alias to, so the lint will work properly.
  • If you do not directly import the specific files, then it will not trigger the bug, so simply adding an import statement can trigger this error.

All of this amounts to what could be a frustrating experience.

@codecov
Copy link

codecov bot commented Feb 7, 2020

Codecov Report

Merging #1575 into master will decrease coverage by 0.01%.
The diff coverage is 85.71%.

@@            Coverage Diff             @@
##           master    #1575      +/-   ##
==========================================
- Coverage   95.56%   95.55%   -0.02%     
==========================================
  Files         142      142              
  Lines        6519     6526       +7     
  Branches     1855     1859       +4     
==========================================
+ Hits         6230     6236       +6     
  Misses        105      105              
- Partials      184      185       +1
Impacted Files Coverage Δ
...-estree/src/create-program/createProjectProgram.ts 92.85% <85.71%> (-1.43%) ⬇️

Copy link
Member

@armano2 armano2 left a comment

Choose a reason for hiding this comment

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

ok, you convinced me

@bradzacher bradzacher merged commit 4c12dac into master Feb 7, 2020
@bradzacher bradzacher deleted the 1573-fix branch February 7, 2020 01:23
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using references makes eslint lint compiled files instead of original typescript files
2 participants