Skip to content

Deactivate n/no-extraneous-import rule in favor of knip #414

@voxpelli

Description

@voxpelli

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-import rule 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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions