Closed shawnmcknight closed 4 months ago
:rocket: This issue has been resolved in v5.24.2. See Release 5.24.2 for release notes.
Using Knip in a commercial project? Please consider becoming a sponsor.
Thanks @shawnmcknight! Plugins don't perfectly always use toEntryPattern
properly everywhere yet, but at least the ones you've shown are fixed now.
@webpro Thanks for taking care of this. The originally reported issue is now fixed, but there has been a regression elsewhere. I can log a separate issue and try to create a reproduction if it helps -- just let me know.
In our jest.config.js
for setupFiles
and setupFilesAfterEnv
, there are some references to a module from an internal workspace:
const jestConfig = {
...
setupFiles: ['@storis/app_common.test/setup.ts'],
setupFilesAfterEnv: ['@storis/app_common.test/setupAfterEnv.ts'],
...
};
module.exports = jestConfig;
The @storis/app_common.test
package is a reference to another workspace in the monorepo and is declared in package.json
as a dev dependency. With this latest update, that dependency is being reported as an unused dev dependency:
Prior to this latest change that was not being reported as an unused dependency. If you need more information let me know and I'll try to work up a reproduction. Thanks!
Another fix is in the latest & greatest.
Another fix is in the latest & greatest.
That was really fast! Just tried it out and everything looking good! Thanks! 👍
I've created a reproduction for this issue at https://github.com/shawnmcknight/knip-jest-entry-exports.
Jest allows for configuration properties
globalSetup
,globalTeardown
,setupFiles
, andsetupFilesAfterEnv
(possibly others, but these are the ones I am aware of and use). The jest plugin for knip will properly detect these files referenced in the jest config as being used except when--include-entry-exports
is enabled. In my reproduction I've added a module for each of these configurable jest properties and referenced them in the jest config:When running knip with
--include-entry-exports
off, knip reports no errors in the reproduction. However, if--include-entry-exports
is enabled then knip is reporting:My interpretation of the includeEntryExports documentation is that plugins shouldn't behave differently for entry files:
Please let me know if I can provide anything else to assist with this.