Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Jercik opened this issue Jan 3, 2022 · 5 comments

Comments

@Jercik
Copy link

Jercik commented Jan 3, 2022

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:

rules: {
// analysis/correctness
// TypeScript compilation already ensures that named imports exist in the referenced module
'import/named': 'off',
},

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

@ljharb
Copy link
Member

ljharb commented Jan 3, 2022

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

@liamfd-titan
Copy link

liamfd-titan commented Mar 27, 2022

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.

@ljharb
Copy link
Member

ljharb commented Mar 27, 2022

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

@tylerlaprade
Copy link

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.

@soryy708
Copy link
Collaborator

Relates to:

While this one issue is older, the other one has more activity, so I'll mark this one duplicate, to consolidate discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants