-
Notifications
You must be signed in to change notification settings - Fork 16
feat(examples-plugins): add knip to example plugin #570
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
Conversation
# Conflicts: # packages/plugin-lighthouse/src/lib/utils.unit.test.ts
|
The Unused development dependencies audit is full of false positives, I'm afraid 😞 It doesn't seem to detect usage other than
|
True! found out prettier was excluded in the config
True. figured out perf folder is configured wrong |
This was the case since we excluded the example projects, I changed that in the base config and this is now properly reported
This is something missing on the knip side, it will only look at the extends but not the plugins array. I will make a follow up on their side to update it. In the meantime, added to the ignore array
This is a false positive, it shouldn't require a npm lib since it's a built in of vitest. I will make a pr to add it to the built in reporters on the knip side so this shouldn't occur anymore. In the meantime, I added it to the ignore dependencies array
This should have been picked up by knip, since it will look at the project json configs to detect the scripts and thrid party requirements, I will follow up with an issue on their side |
|
Related PRs : |
# Conflicts: # package-lock.json # package.json
# Conflicts: # code-pushup.config.ts # package-lock.json
# Conflicts: # knip.config.ts # package-lock.json # package.json
This PR is just here to showcase
knipimplementation and screenshots.This PR includes:
capitalandsingularThis PR does not include:
See the portal here: https://staging.code-pushup.dev/portal/code-pushup/cli-utils/commit/985ac7155f1f8cb8ad1b482a984740ad3d2d5e75/dashboard
Changes for a followup PR:
duplicated exportsshould list last reference instead of firstunused dependenciesshould link to line where package sit'sunlisted dependencies,unused development dependenciescould list only one referencing file (otherwise we see multiple times the same issue title with a difference source but installing it ones fixes the issues)Used configuration
run
nx run-collect --onlyPlugins knipto test it locally.Example Audit Interpretation
Legend:
Unused files (1)
Can be fixed by using it in e.g. e2e tests
Unused dependencies (1)
Can be fixed by uninstalling
cli-table3Run
npm remove cli-table3to remove dependencyUnused devDependencies (8)
This package is not used anywhere in the code either directly on in "scripts" or configuration files.
You can fix it by running
npm remove tsxSame goes for the follwing dependencies
should have been picked up by the nx helper WDYT @beaussan
the following packages are (most probably) a cascade of this issue
false as it is used in
commitlint.config.jsfalse as a peer dependency of commit. (cascade of
commitlint-plugin-tense)Run
npm ls conventional-changelog-angularto list check dependent packages.├─┬ @commitlint/cli@17.8.1 │ └─┬ @commitlint/lint@17.8.1 │ └─┬ @commitlint/parse@17.8.1 │ └── conventional-changelog-angular@6.0.0 └─┬ commitlint-plugin-tense@1.0.2 └─┬ @commitlint/lint@19.1.0 └─┬ @commitlint/parse@19.0.3 └── conventional-changelog-angular@7.0.0Unlisted dependencies (38)
This is a peer dependency of
@nx/eslint-plugin, but and not directly installed.If you uninstall
@nx/eslint-pluginyou don't havejsonc-eslint-parseranymore available.Run
npm ls jsonc-eslint-parserto list the root package:To fix it run
npm i jsonc-eslint-parser --save-devsame is valid for all following issues of
jsonc-eslint-parserThis is used in
tools/eslint-to-code-pushup.mjs, but and not listed inpackage.json. The code works because other packages like@nx/devkithaveminimatchas peer dependency. If you would remove all related packages like@nx/devkit,tools/eslint-to-code-pushup.mjswould stop working.Run
npm ls minimatchto list the root package:To fix it run
npm i minimatch --save-devsame is valid for issues of
tslibThis is used as dummy reference in a test like this.
It can be fixed by adding the package name to the
knip.config.ts✅ @commitlint/types commitlint.config.js
Is used in like this:
const { RuleConfigSeverity } = require('@commitlint/types');.To fix it run
npm i @commitlint/types --save-dev❓ basic e2e/cli-e2e/vite.config.e2e.ts
This shows no dependents when running
npm ls basicThis could be fixed by installing
basicmanually overnpm i basic -Dbut seems odd as there are no deps listed.Same goes for all other issues related to
basicbasic packages/cli/vite.config.integration.ts
basic packages/cli/vite.config.unit.ts
basic packages/core/vite.config.integration.ts
basic packages/core/vite.config.unit.ts
basic packages/models/vite.config.integration.ts
basic packages/models/vite.config.unit.ts
basic packages/nx-plugin/vite.config.integration.ts
basic packages/nx-plugin/vite.config.unit.ts
basic packages/plugin-coverage/vite.config.integration.ts
basic packages/plugin-coverage/vite.config.unit.ts
basic packages/plugin-eslint/vite.config.integration.ts
basic packages/plugin-eslint/vite.config.unit.ts
basic packages/plugin-js-packages/vite.config.integration.ts
basic packages/plugin-js-packages/vite.config.unit.ts
basic packages/plugin-lighthouse/vite.config.integration.ts
basic packages/plugin-lighthouse/vite.config.unit.ts
basic packages/utils/vite.config.integration.ts
basic packages/utils/vite.config.unit.ts
basic testing/test-utils/vite.config.unit.ts
Unused exports (23)
can be fixed by removing the export form
duplicateRefsInCategoryMetricsErrorMsgcan be fixed by exporting
hinindex.tscan be fixed by exporting
groupMetaSchemainindex.tsSimilar fix can be applied for the following issues.
Unused exported types (12)
can be fixed by exporting
hinindex.tsSame is applicable for the following issues
can be fixed by exporting
GroupMetainindex.tscan be fixed by removing the export form
CliUiBasethis type is not used.
It can be fixed by using it to ensure the option names.
is unused can be fixed by exporting it. (lands in feat(cli): add history command #273)
is unused can be fixed by exporting it. (lands in feat(plugin-lighthouse): add lighthouse runner #549)
can be fixed by exporting
Yarnv2AuditAdvisoryinindex.tsSame applies for the following exported types
Duplicate exports (2)
the audit can be fixed by only exporting the same instance 1 time. Note: also applies for the following autit.
Snippet to test fixes:
npm remove cli-table3 conventional-changelog-angular eslint-plugin-jsx-a11y tsx && npm i -D jsonc-eslint-parser lighthouse-logger debug chrome-launcher minimatchScreenshots of the implementation in different views
Related:
webpro-nl/knip#551