Knip (5.19.0) may behave differently on different environments, depending on
- gitignore rules
- the absolute path, where the project is checked out
During the block
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:
# .gitignore
# ignore all files in builds folders in the project
builds/
// bug in knip
// doesn't match any file, because absolute path matches a gitignore rule
fastGlob(['src/index.ts'], {
cwd: '/Users/xxx/builds/project',
ignore: ['**/builds/**', '**/builds'] // generated from git-ignore
})
// maybe-fix in knip
fastGlob(['src/index.ts'], {
cwd: '/Users/xxx/builds/project',
ignore: ['/Users/xxx/builds/project/**/builds/**', '/Users/xxx/builds/project/**/builds'] // fix
})
Knip (5.19.0) may behave differently on different environments, depending on
During the block
knip/packages/knip/src/util/globby.ts
Line 136 in 7c9b645
**which leads to the problem, that git ignore rules now may match outside the project.Example: