-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
The n/no-extraneous-import rule does not work reliably in npm workspaces/monorepos, as it often produces false positives or negatives when dependencies are hoisted or shared between packages. This leads to unnecessary noise and confusion, especially in modern JavaScript/TypeScript projects that use workspaces for dependency management.
Additionally, the functionality of this rule is now largely superseded by knip, which provides a more robust and accurate analysis of unused dependencies and files, and is designed to work well with monorepos and npm workspaces.
Recommendation:
- Deactivate the
n/no-extraneous-importrule by default in this config, or at least document its limitations with workspaces. - Recommend users adopt knip for dependency analysis instead.
This would help reduce friction for users of npm workspaces and align with current best practices for dependency management.
Example context: see the workaround in the eslint.config.js of a workspace project, where the rule is explicitly disabled to avoid false positives.