-
Notifications
You must be signed in to change notification settings - Fork 25
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: tsconfig paths are not expanded correctly for tsconfigs and libs not placed at workspace root (#499) #500
Conversation
Hello @joelMuehlena, Thanks for your help with relative imports. They're working great with Could you please add support for Thanks again |
Hi @xc2, |
@jbedard this should be everything. Maybe you can have a look at it, when you have the time? |
gazelle/js/typescript/tsconfig.go
Outdated
@@ -99,6 +118,8 @@ func parseTsConfigJSON(cm *TsConfigMap, root, configDir string, tsconfigContent | |||
var BaseUrl string | |||
if c.CompilerOptions.BaseUrl != nil { | |||
BaseUrl = path.Clean(*c.CompilerOptions.BaseUrl) | |||
} else if baseConfig != nil && baseConfig.BaseUrl != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does one of your tests fail without this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but it handles the case, if a config was extended with a baseUrl and the local one not having one the extended one will be used. It's quite difficult to test this case without "a real file", because the parsing function loads the extension of a file directly. So we can remove this but then the case with a baseDir inherited from an extension file will not be covered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should I handle this? Just leave it as is?
A bunch of minor comments but overall looks great! Could merge as-is but if you have time to address or reply to the comments that would be great 👍 |
Yep no problem, I'll take a look on the review this week when I have some time. |
Thank you, it works as expected! |
9f8aa4e
to
d3abd3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks @joelMuehlena
d3abd3f
to
19558e3
Compare
Synced from #500 by joelMuehlena: fix: tsconfig paths are not expanded correctly for tsconfigs and libs not placed at workspace root (#499) --- Fix #499 ### Test plan - Covered by existing test cases - New test cases added ### General This fix ensures, that if an expanded import path like specified in the corresponding tsconfig.json (of a file which for example lays in the following space <root>/projects/p1) is not absolute e.g. `@org/liba/* -> ./*: @org/liba/test` will be expanded to `projects/p1/test`. Otherwise gazelle has issues resolving the correct imports. Closes #500 --------- Co-authored-by: Joel Mühlena <[email protected]> GitOrigin-RevId: 57f6b0b18df932cc543d334b4eac1118e70674cf
Thanks, we brought the PR into our monorepo and exporting again in #502 |
Synced from #500 by joelMuehlena: fix: tsconfig paths are not expanded correctly for tsconfigs and libs not placed at workspace root (#499) --- Fix #499 ### Test plan - Covered by existing test cases - New test cases added ### General This fix ensures, that if an expanded import path like specified in the corresponding tsconfig.json (of a file which for example lays in the following space <root>/projects/p1) is not absolute e.g. `@org/liba/* -> ./*: @org/liba/test` will be expanded to `projects/p1/test`. Otherwise gazelle has issues resolving the correct imports. Closes #500 --------- Co-authored-by: Joel Mühlena <[email protected]> GitOrigin-RevId: 57f6b0b18df932cc543d334b4eac1118e70674cf
Synced from #500 by joelMuehlena: fix: tsconfig paths are not expanded correctly for tsconfigs and libs not placed at workspace root (#499) --- Fix #499 ### Test plan - Covered by existing test cases - New test cases added ### General This fix ensures, that if an expanded import path like specified in the corresponding tsconfig.json (of a file which for example lays in the following space <root>/projects/p1) is not absolute e.g. `@org/liba/* -> ./*: @org/liba/test` will be expanded to `projects/p1/test`. Otherwise gazelle has issues resolving the correct imports. Closes #500 --------- Co-authored-by: Joel Mühlena <[email protected]> GitOrigin-RevId: 57f6b0b18df932cc543d334b4eac1118e70674cf
Synced from #500 by joelMuehlena: fix: tsconfig paths are not expanded correctly for tsconfigs and libs not placed at workspace root (#499) --- Fix #499 ### Test plan - Covered by existing test cases - New test cases added ### General This fix ensures, that if an expanded import path like specified in the corresponding tsconfig.json (of a file which for example lays in the following space <root>/projects/p1) is not absolute e.g. `@org/liba/* -> ./*: @org/liba/test` will be expanded to `projects/p1/test`. Otherwise gazelle has issues resolving the correct imports. Closes #500 --------- Co-authored-by: Joel Mühlena <[email protected]> GitOrigin-RevId: 57f6b0b18df932cc543d334b4eac1118e70674cf
Fix #499
Test plan
General
This fix ensures, that if an expanded import path like specified in the corresponding tsconfig.json (of a file which for example lays in the following space /projects/p1) is not absolute e.g.
@org/liba/* -> ./*: @org/liba/test
will be expanded toprojects/p1/test
. Otherwise gazelle has issues resolving the correct imports.