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

Option to use absolute paths in error messages #2023

Closed
globalhuman opened this issue Sep 21, 2022 · 2 comments
Closed

Option to use absolute paths in error messages #2023

globalhuman opened this issue Sep 21, 2022 · 2 comments

Comments

@globalhuman
Copy link

Describe the feature you'd like to request

Currently turbo repo error outputs when building display relative paths to the the file containing the error, relative to the package, not the mono repo root. See below for an example:

@mine/test-service:build: src/services/index.ts:114:42 - error TS2345: Argument of type 'number' is not assignable to parameter of type 'MyType'.
@mine/test-service:build: 
@mine/test-service:build: 114     .myMethod(arg1, numberArg2)

This causes issues when using a mono repo inside IDEs such as vscode which run a regex over the output to match the errors to the files in the IDE. The current behaviour when using a tsc regex expression is a malformed file as it's not able to deduce it's absolute path. See example here https://code.visualstudio.com/docs/editor/tasks.

Describe the solution you'd like

An option to enable absolute paths would be desirable and an example of the output could be like the following:

@mine/test-service:build: /root/home/user/project/monorepo/package/src/services/index.ts:114:42 - error TS2345: Argument of type 'number' is not assignable to parameter of type 'MyType'.
@mine/test-service:build: 
@mine/test-service:build: 114     .myMethod(arg1, numberArg2)

Note the inclusion of the full path /root/home/user/project/monorepo/test-service/src/services/index.ts:114:42 instead of the relative path src/services/index.ts:114:42.

Describe alternatives you've considered

Ideally this would be solved upstream in tsc as per the existing ticket here microsoft/TypeScript#36221

I'm not familiar with the inner-working of turborepo but assembly an absolute path as it traverses the packages seems possible.

@arietrouw
Copy link

arietrouw commented Oct 12, 2022

Super Thumbs up! I have a large mono repo using yarn3 and if there is an error in src/index.ts, clicking on it in vsCode just gives me a list of all the src/index.ts files in all the packages or takes me to the src/index.ts if that exists in the root package.
Neither of these are great and being able to click from a list of compile errors to the files where the errors occur improves development velocity substantially.

In a perfect world, tsc check the composite field in the tsconfig and if it is there, build a relative path back to the root (tsconfig without a composite field).

@gsoltis
Copy link
Contributor

gsoltis commented Oct 12, 2022

I don't think this is something that turbo can address, as this error is coming from tsc. We do have the path to the package when running the task, but we don't know what parts of the output are supposed to be filesystem paths.

@gsoltis gsoltis closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2022
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

No branches or pull requests

3 participants