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

support for exports #9

Closed
benmccann opened this issue Jun 30, 2023 · 11 comments
Closed

support for exports #9

benmccann opened this issue Jun 30, 2023 · 11 comments
Labels
enhancement New feature or request

Comments

@benmccann
Copy link

A major issue with eslint-plugin-import is that it doesn't support exports: import-js#1810

I was wondering if you might consider using resolve.exports or enhanced-resolve rather than the outdated resolve package in this library to address that

@JounQin
Copy link
Member

JounQin commented Jun 30, 2023

If you're using TypeScript, you can use eslint-import-resolver-typescript, for plain js, it doesn't support it for now, but I think your suggestion is valuable, I'll try to add this feature this weekend.

@JounQin JounQin added the enhancement New feature or request label Jun 30, 2023
@JounQin
Copy link
Member

JounQin commented Jul 1, 2023

@benmccann Another thought, did you just try eslint-import-resolver-exports? So that less change could be made in this fork.

@benmccann
Copy link
Author

It's rather complicated to setup. It requires another package as well, so you have to setup at least three libraries for something that seems like it should really just work out of the box.

I understand wanting to keep the diff to upstream small as well though. I do think it would affect adoption a lot though to use eslint-import-resolver-exports. It would be really nice if the migration instructions were simply to switch eslint-plugin-import to eslint-plugin-i vs something more complicated.

@Anatolych97
Copy link

Anatolych97 commented Jul 4, 2023

@benmccann Did you try this one?

resolvers

@benmccann
Copy link
Author

That's exactly what we were just talking about in the last comment

@13OnTheCode
Copy link

By the way, the latest version of VSCode currently does not support exports, so you still cannot completely get rid of the main field. I also want to fully embrace ESM, but unfortunately, we were born in the worst era for it.

@JounQin JounQin pinned this issue Oct 20, 2023
@silverwind
Copy link

By the way, the latest version of VSCode currently does not support exports, so you still cannot completely get rid of the main field

You can get rid of main when a index.js is present which satisfies the linter. Not ideal but works.

@JounQin
Copy link
Member

JounQin commented Dec 18, 2023

I think this is outscoped, you should use eslint-import-resolver-exports or eslint-import-resolver-typescript instead.

@JounQin JounQin closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2023
@benmccann
Copy link
Author

I personally have just stopped using eslint-plugin-imports altogether as it provides no value that isn't already provided by Typescript. Unfortunately many others still use it and then end up bugging me that my libraries are not working with their outdated plugin. Unfortunately, I can't ask everyone to use one of the resolver plugins because they're far too cumbersome to setup. C'est la vie!

@ljharb
Copy link

ljharb commented Dec 18, 2023

That's definitely not accurate - there's a ton of things it does that TS can't - but it's unfortunate that's been your experience.

@JounQin
Copy link
Member

JounQin commented Dec 18, 2023

eslint-import-resolver-typescript works without typescript itself, that's why we're using get-tsconfig instead of relying on typescript because it's heavily for non typings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants