-
-
Notifications
You must be signed in to change notification settings - Fork 228
Allow to exclude pattern #352
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
Comments
Or actually, this could work too:
The implication being that the latest pattern overrides the production flag. |
Negated patterns should work (also the odd But I think the underlying issue here is that the test files should be covered by a plugin, but something goes off here. Or Knip does not yet have a plugin for the test runner you're using. What repo is this? |
It is private, so cannot help much with that.
Does not appear to be the case. Here is the configuration I am using at the moment: {
"$schema": "https://unpkg.com/knip@2/schema.json",
"entry": [
"src/utilities/*.ts!",
"!src/utilities/*.test.ts!",
"src/utilities/*.test.ts",
"src/index.ts!"
],
"project": [
"src/**/*!",
"!src/**/*.test.ts!",
"src/**/*.test.ts"
]
} and here is the error: at 14:18:45 ❯ knip
Unused devDependencies (1)
chance package.json
gaia/packages/utilities on main [$✘»!+] on ☁️ gajus@contra.com
at 14:18:49 ❯ rg chance
package.json
17: "chance": "^1.1.11",
src/utilities/buildUsernameFromName.test.ts
3:import chance from 'chance';
7: const firstName = chance().first();
8: const lastName = chance().last();
17: const firstName = chance().first();
18: const lastName = chance().last();
at 14:18:51 ❯ ll src/utilities/*.test.ts
-rw-r--r-- 1 gajus staff 722 Nov 27 14:07 src/utilities/buildUsernameFromName.test.ts
-rw-r--r-- 1 gajus staff 1196 Nov 27 14:07 src/utilities/fromGlobalId.test.ts
-rw-r--r-- 1 gajus staff 605 Nov 27 14:07 src/utilities/isTruthy.test.ts
-rw-r--r-- 1 gajus staff 212 Nov 27 14:07 src/utilities/toGlobalId.test.ts It says Here is an output with
|
It looks like the issue is here:
It added |
🚀 This issue has been resolved in v3.1.0. See Release 3.1.0 for release notes. |
Negated production patterns should no longer be included in default mode. Still, I think the real issue here is why you need to add the |
Suppose this config:
The problems is that I also have
.test.ts
files undersrc
, e.g.src/routines/jobPostings/potentialMatches/findContractorIndexMatchesForJobPosting.test.ts
I am not entirely sure what's the proper way to mark
src/**/*!
as project files, but exclude.test.ts
from it.I suppose negation could be achieved with a syntax such as:
!
at the beginning and end looks a bit odd though.The text was updated successfully, but these errors were encountered: