eslint-plugin-import icon indicating copy to clipboard operation
eslint-plugin-import copied to clipboard

`default`, `export`, and `namespace` rules should be disabled in the `typescript` config.

Open Jercik opened this issue 3 years ago • 3 comments

If I understand correctly, TypeScript already highlights the same issues as import/default, import/export and import/namespace rules. If that's true, then these rules should be disabled in the typescript config similarly to import/named here: https://github.com/import-js/eslint-plugin-import/blob/68cea3e6b6fe5fd61e5cf2e2c7c0be9e8dc597cb/config/typescript.js#L25-L30

Please correct me if I'm wrong in my assumption. Otherwise, I can create a PR with the changes.

Jercik avatar Jan 03 '22 15:01 Jercik

That’s incorrect. I believe TS doesn’t check CJS files, or files without types.

ljharb avatar Jan 03 '22 15:01 ljharb

Would it be within the scope of this project to maintain an extendable config for projects that are TS only, with rules like this disabled? Something like plugin:import/typescript-only, alongside the current plugin:import/typescript.

liamfd-titan avatar Mar 27 '22 14:03 liamfd-titan

No projects are TS only, because all published code is CJS or ESM.

ljharb avatar Mar 27 '22 14:03 ljharb

I came here for this same reason. import/export is NOT redundant with TypeScript, but import/default, import/named, import/namespace, and import/no-unresolved all are. Additionally, import/default doesn't seem to trigger when I expect it to (but TS always does in those places). Instead of excluding all these rules, I replaced plugin:import/recommended and plugin:import/typescript with plugin:import/warnings in my config and manually added import/export to my rules, since that was the only useful one in my project.

tylerlaprade avatar Jul 06 '23 14:07 tylerlaprade