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
Context
This rule was previously proposed here Rel1cx/eslint-react#803. In the eslint-react's context only includes "react" and "react-dom" packages, which are less sensitive to tree-shaking needs. We propose migrating this rule to a more generalized implementation under import-x to serve broader use cases.
Rationale
While modern bundlers support tree-shaking for both import styles, many projects still rely on import * as mod from "source" to enforce tree-shaking or just for consistent code style. This rule remains necessary for such codebases.
Proposed Rule
Implement a import-x/prefer-namespace-import rule with a patterns configuration to match scoped/prefixed packages (e.g., @scope/*, prefix-*) and auto-fix them to namespace imports.
Context
This rule was previously proposed here Rel1cx/eslint-react#803. In the
eslint-react
's context only includes"react"
and"react-dom"
packages, which are less sensitive to tree-shaking needs. We propose migrating this rule to a more generalized implementation underimport-x
to serve broader use cases.Rationale
While modern bundlers support tree-shaking for both import styles, many projects still rely on
import * as mod from "source"
to enforce tree-shaking or just for consistent code style. This rule remains necessary for such codebases.Proposed Rule
Implement a
import-x/prefer-namespace-import
rule with apatterns
configuration to match scoped/prefixed packages (e.g.,@scope/*
,prefix-*
) and auto-fix them to namespace imports.Configuration Example
Auto-Fix Example
The text was updated successfully, but these errors were encountered: