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
Add and configure knip #127
Conversation
Add knip [1] as a devDependency for vetting purposes and configure it with `knip.json`. knip is a vetting tool that "finds unused files, dependencies, and exports". Additionally, a new CI job is included to run vetting tools (just knip for now). -- 1. https://www.npmjs.com/package/knip
With the latest {
"entryFiles": ["lib/index.ts"],
"projectFiles": ["lib/**/*.ts"],
"ignoreBinaries": ["git", "shellcheck"],
"eslint": {
"sampleFiles": [
"lib/index.ts",
"package.json",
".markdownlint.yml",
"README.md"
]
}
} This There are still false positives, but the results are better imho. Most notably Thanks for your patience. If anything, your input has helped Knip's development a lot. |
One more thing... the {
"entryFiles": ["lib/index.ts!"],
"projectFiles": ["lib/**/*.ts!"],
"ignoreBinaries": ["git", "shellcheck"],
"eslint": {
"sampleFiles": [
"lib/index.ts",
"package.json",
".markdownlint.yml",
"README.md"
]
}
} This will give a single unused export ( /**
* @public
*/
export const rules = {
'no-top-level-variables': noTopLevelVariables,
'no-top-level-side-effect': noTopLevelSideEffect
}; |
- Update the version of knip defined in the manifest and lockfile. - Use the `--production` option, which was the default behaviour pre v1. - Update the knip config to use "production globs" (expirimental API).
Thanks for having a look @webpro - I think I'll stick with the |
Something got me inspired to get rid of those
Just saying, the {
"entryFiles": ["lib/index.ts!"],
"projectFiles": ["lib/**/*.ts!"],
"ignoreBinaries": ["shellcheck"]
} Given the above config and updating to the latest
After:
|
Nice progress @webpro - I tested out the latest release (
Besides that, I agree with you that
I can see where you're coming from, however From my understanding, I think not having it as a Having said that, I can see that 1) this could be hard to distinguish for |
That's odd, not experiencing that here. Running knip in either production mode or not with either version (
Nice catch. I found that
Agreed. If it was a peer dependency, Knip would be OK with it. This is a bit of an edge case though, and only applies to the eslint plugin. |
With the improvements following your previous comment I switched back to non-production analysis on this branch - so those numbers are for non-production use. I tested again with
It's up to you/the implementation details of course but I'd prefer the
I'm going to raise this upstream to see if that leads anywhere 🙂 |
138e47e
to
188b7ea
Compare
Update the dependency knip to the latest available version at the time of this commit
- Add newly-introduced support for `$schema` - Rename `entryFiles` and `projectFiles` in accordance with knip updates - Update `ignoreBinaries` list with currently used binaries - Add `ignoreDependencies` list with known false positives
Add yaml-eslint-parser [1] as an explicit devDependency and use it explicitly as a parser for YAML files in the ESLint configuration. -- 1. https://www.npmjs.com/package/yaml-eslint-parser
@webpro, quick update from my side:
|
Codecov Report
@@ Coverage Diff @@
## main #127 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 179 178 -1
Branches 35 35
=========================================
- Hits 179 178 -1
|
Thanks for the updates, Eric
I gave this another thought, and as you probably saw, went with what you prefer :) |
Relates to #124
Reverts #163, #177
Summary
Add knip as a
devDependency
for vetting purposes and configure it withknip.json
. knip is a vetting tool that "finds unused files, dependencies, and exports". Additionally, add a new CI job to run vetting tools.