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

import/no-named-as-default-member rule became less useful in 2.30.0

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

Description

In 2.30.0 the following code gives a lot of warnings and suggests to import `string`, `number`, etc. instead of using the properties from the default import z.

![image](https://github.com/user-attachments/assets/e0c574ae-9ad1-4cfb-a68e-e62281321423)

In this case, I think it is clearer to continue prefixing the code with z and not using imported generic words like "string", "number" etc.

I'm not sure why the rule needed to be changed like this. The zod library is likely not the only case where such prefixing makes sense.

Would you be open to give an option to disable this behavior and only create warnings/errors for actual import statements?

I disabled the rule for now.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the warnings described for import/no-named-as-default-member with the Zod example and inspect the rule's existing tests or entry point. Define coverage for an option that suppresses warnings on default-import member usage while retaining warnings for actual import statements; done means the requested behavior is covered by regression tests.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.