-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
chore: update knip config #40
chore: update knip config #40
Conversation
Using this config, knip pass in #33 with flag |
Marking this as blocked on resolving discussion in webpro-nl/knip#62 - in case it ends up impacting us here. |
Just saying, in the meantime you could add the specific files as |
ecf03e4
to
2364f6c
Compare
Codecov Report
@@ Coverage Diff @@
## main #40 +/- ##
=======================================
Coverage 19.74% 19.74%
=======================================
Files 15 15
Lines 395 395
Branches 161 161
=======================================
Hits 78 78
Misses 299 299
Partials 18 18 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Just made this change. I also made it so that knip is called in the ci both with and without |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes only in that I'd like to see how to make lint:knip:production
fail, the code LGTM!
If you make a new file (
|
"$schema": "https://unpkg.com/knip@next/schema.json", | ||
"entry": ["src/**/index.ts!"], | ||
"project": ["src/**/*.ts!", "!src/test/**/*.ts!", "!src/**/*.test.ts!"] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@webpro It doesn't seem to currently be possible to use a single config file for our use case.
Essentially, we want this config, but with the comment addressed.
{
"$schema": "https://unpkg.com/knip@next/schema.json",
"entry": ["src/**/index.ts!", "src/**/*.test.ts"],
"project": [
"src/**/*.ts!",
"!src/test/**/*.ts!", // <-- We want these "not" globs to only apply in production mode.
"!src/**/*.test.ts!" // <-- Using a separate production specific config seems to be the only way to currently achieve this.
]
}
When using config that runs logic (e.g. knip.ts
), it would be great if we could access a isProduction
variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late reply, but somehow today this popped up in the back of my mind. Any chance you could give it a shot with the latest Knip v1? I think you don't need any configuration anymore for either dev or production mode :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah scratch that, it's almost true, you would still need to add **/index.ts
as entry files (as that is fixed only in v2).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 thanks!
Whenever you're happy to merge, let's do it!
PR Checklist
status: accepting prs
Overview
When not in production mode, entry files should include test files.
When in production mode, project files should not include test files.