Open DaAitch opened 4 months ago
Thanks for the bug report.
I wonder how it's possible the **/build
pattern matching files outside the pattern influences the results? Any chance a small explanation or even reproduction could be set up?
That might be a reason to either improve Knip's docs and/or implementation: perhaps by extending or doing something similar to the source mapping (dist/index.js
→ src/index.ts
) that was recently introduced.
@webpro here it is: https://github.com/DaAitch/knip-issue-678
I simulated an absolute path, by checking in some folders.
The git-ignore rule builds/
in <PROJECT_ROOT>/Users/knipuser/cicd/builds/project42/.gitignore
is translated to a glob-ignore for **/builds/**
.
Thanks, that helped a lot.
I think I found the issue, it seems to originate here in fast-glob: https://github.com/mrmlnc/fast-glob/issues/441
Need to figure out whether it can/will be fixed downstream, or work around it in Knip.
@webpro Okay interesting. Here is a red knip unit test https://github.com/DaAitch/knip/commit/5989d4a12c8d4c0a61b5b849bf6a474745d60e5c to reproduce
Thanks, I'd prefer fixes and test coverage in the downstream lib, let's await that first: https://github.com/mrmlnc/fast-glob/pull/445
Knip (5.19.0) may behave differently on different environments, depending on
During the block https://github.com/webpro-nl/knip/blob/7c9b6455d302193961816229c9d30ce0525a794f/packages/knip/src/util/globby.ts#L136 git ignore rules are translated to glob ignore rules. Rules are prefixed by
**
which leads to the problem, that git ignore rules now may match outside the project.Example: