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

Rule `import/extensions` does not support dots in file names

Open
#3,211 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

I have this rule set-up

	{
		files: ['src/frontend/src/**/*'],
		rules: {
			'import/extensions': [
				'error',
				{
					js: 'never'
				}
			]
		}
	},

But it wrongly raises these errors:

/Users/antonio.ventilii/projects/be-oisy-wallet/src/frontend/src/tests/utils/user-networks.test-utils.ts
  1:36  error  Unexpected use of file extension "env" for "$env/networks/networks.env"        import/extensions
  2:61  error  Unexpected use of file extension "store" for "$lib/stores/user-profile.store"  import/extensions
  4:33  error  Unexpected use of file extension "utils" for "$lib/utils/user-networks.utils"  import/extensions
  5:51  error  Unexpected use of file extension "mock" for "$tests/mocks/user-profile.mock"   import/extensions

Am I doing something wrong in the configs?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the import/extensions errors with the configuration and dotted filenames shown in the issue, then trace the rule's handling of multi-part names. Add regression coverage for imports such as "$lib/stores/user-profile.store" and verify that valid dotted names no longer produce false extension errors.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.