import-js / import-js/eslint-plugin-import

add ignore patterns setting for `import/extensions`

Open
#2,353 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

When using modern front-end bundlers like [vite](https://vitejs.dev/), it is becoming more common to enable "virtual" files that may not actually exist in the file system.

For example, [this plugin](https://github.com/antfu/unplugin-icons) provides access to many open source icon libraries by importing files with a syntax like
```
import Arrow from '~icons/octicon/arrow-up-24';
```

I can fix the `import/no-unresolved` rule by creating an ignore pattern, however I don't see how I can fix this `import/extensions` rule because the settings only allow making changes for a specific extension, and these files are not found. Nor would I even want to know or care about what the extension is, I just want to say that those imports shouldn't require an extension.

Probably the best solution would be to provide the same kind of "ignore" setting that `import/no-unresolved` has available?

Contributor guide

Open the contributing guide

Research direction

Start by reading the import/extensions rule and its settings alongside the import/no-unresolved rule's ignore setting. The work is done when virtual imports such as ~icons/octicon/arrow-up-24 can be exempted from extension requirements without specifying an extension.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.