import-js / eslint-plugin-import

ESLint plugin with rules that help validate proper imports.
MIT License
5.47k stars 1.56k forks source link

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

Open peterjuras opened 1 week ago

peterjuras commented 1 week ago

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

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.

ljharb commented 1 week ago

What happens if you import * as z instead?