Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: ensure augmentWorkspace honors tsConfig rootDir#933

Merged
webpro merged 1 commit into
webpro-nl:mainfrom
rmunch:remy-workspace-src-dir
Feb 5, 2025
Merged

fix: ensure augmentWorkspace honors tsConfig rootDir#933
webpro merged 1 commit into
webpro-nl:mainfrom
rmunch:remy-workspace-src-dir

Conversation

@rmunch
Copy link
Copy Markdown
Contributor

@rmunch rmunch commented Feb 5, 2025

I think this fixes logic that has a bug due to incorrect parenthesis in a ternary. When a rootDir is specified in tsconfig.json that has a value of something other than "src", the rootDir config is not honored. In my case, I do have a src dir, but it's unrelated to my TypeScript source which is located elsewhere (where my rootDir poins to). Knip ends up forcing the workspace srcDir value to "src" due to this bug combined with the presence of a src directory.

I attempted to add a test, but I'm not so familiar with the codebase and could not seem to exercise the right code paths 😞, but can give it another try if needed.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 5, 2025

Open in Stackblitz

npm i https://pkg.pr.new/knip@933

commit: 81c0a85

@webpro webpro merged commit 2afffe0 into webpro-nl:main Feb 5, 2025
@webpro
Copy link
Copy Markdown
Member

webpro commented Feb 5, 2025

Thanks @rmunch! Simply by looking at the logic/syntax I'm pretty sure you're right. The parentheses placement made no sense.

@webpro
Copy link
Copy Markdown
Member

webpro commented Feb 11, 2025

🚀 This pull request is included in v5.44.0. See Release 5.44.0 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

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

Successfully merging this pull request may close these issues.

2 participants