Skip to content

eslint-plugin-import#9568

Closed
bhollis wants to merge 2 commits intomasterfrom
eslint-import
Closed

eslint-plugin-import#9568
bhollis wants to merge 2 commits intomasterfrom
eslint-import

Conversation

@bhollis
Copy link
Contributor

@bhollis bhollis commented Jun 13, 2023

This sets up eslint-plugin-import. Most of its rules are redundant with normal build errors, but this adds a few interesting ones. I've fixed all except the no-cycle errors, of which we have 123. We can maybe chip away at them here?

@bhollis bhollis requested review from nev-r and robojumper June 13, 2023 05:30
@robojumper
Copy link
Member

Hm, some of these imports import only types, so they're not actually a real dependency for bundling / module loading. The workaround seems to be enabling @typescript-eslint/consistent-type-imports and turning all of these into import type statements...

@robojumper
Copy link
Member

See eslint-import...robojumper:DIM:eslint-import for import type. Apparently const enums, even with the const enum optimization, are still detected as a dependency for module importing, which seems incorrect to me and makes some of these more annoying than they need to be.

@bhollis
Copy link
Contributor Author

bhollis commented Jun 13, 2023

Gotcha. I figured we'd want to turn on the type imports at some point, but they really don't offer much of any value outside of this.

@robojumper
Copy link
Member

robojumper commented Jun 14, 2023

Looked some more at the const enum thing. TypeScript is vaguely in favor of allowing import type { SomeConstEnum } microsoft/TypeScript#42991 but haven't accepted the feature yet. It seems https://github.com/import-js/eslint-import-resolver-typescript is able to provide more accurate import info without import type? But I guess it doesn't solve the const enum thing... From import-js/eslint-plugin-import#2267

@bhollis
Copy link
Contributor Author

bhollis commented Jun 14, 2023

At the end of the day this is what's stopped me from using this plugin in the past - it has to recreate all the knowledge that both TypeScript and Webpack have in order to make sense of things.

@bhollis bhollis mentioned this pull request Jun 14, 2023
@bhollis bhollis closed this Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants