You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
This Yarn Berry plugin checks for unused resolutions in yourpackage.json files after runningyarn install. It will error if any resolutions are defined but not actually used by Yarn.
After installing the plugin, runyarn install as usual. The plugin will automatically check for unused resolutions and report any issues.
Example Output
If you have unused resolutions, you'll see output like this:
Found 2 unused resolution(s): - "unused-package": "1.0.0" - "loose-envify/unused@^2.0.0": "4.0.0"These resolutions are defined in package.json but not used by Yarn.Consider removing them to keep your package.json clean.
Configuration
How it Works
The plugin hooks into Yarn'sreduceDependency lifecycle event to reproduce the same logic that Yarn uses to resolve dependencies.It adds a flag on the resolutions that are used to alias a dependency.
Then, it hooks into Yarn'safterAllInstalled lifecycle event to check for resolutions that are defined but not used.
Common Use Cases
Dependency Pinning: When you pin a dependency version but later remove the dependency
Security Fixes: When you add a resolution for a security fix but the vulnerable dependency is removed
Version Conflicts: When you resolve version conflicts that are later resolved differently
Cleanup: General cleanup of unused resolutions to keep package.json files maintainable
Publishing
To publish a new version of the plugin:
Bump the version inpackage.json
Update the installation URL in this README
Create a new release on GitHub with the same name as the new version