Skip to content

import/extensions: ignore imports starting with # #3188

@dobesv

Description

@dobesv

Feature Request

It would be nice if it was easy to exclude '#' based imports from the "import/extensions" rule, similar to how it is easy to exclude imports from other packages for this rule.

Background

When an import starts with '#' it is resolved by looking for a matching entry in "imports". These import rules are very similar to the rules applied when you are importing from another package, especially one that specifies "exports" to translate import paths.

As such, it is normal that these kinds of imports may not require a file extension even if relative imports do.

Workaround

You can define an override for imports starting with #, e.g.

'import/extensions': [
          'error',
          'ignorePackages',
          {
            pathGroupOverrides: [
              {
                pattern: '#**',
                action: 'ignore',
              },
            ],
          },
        ],

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions