eslint-import-resolver-typescript icon indicating copy to clipboard operation
eslint-import-resolver-typescript copied to clipboard

Support for reading bundler's config

Open 9romise opened this issue 7 months ago • 5 comments

All major bundlers have a resolve configuration, for example:

  • https://vite.dev/config/shared-options.html#resolve-alias
  • https://webpack.js.org/configuration/resolve/#resolve
  • https://rspack.dev/config/resolve

We can read users' config file and get the normalized resolve config to align ESLint's module resolution with the bundler’s behavior.

Some features implemented in eslint-import-resolver-oxc:

  • auto-detect bundler configs
  • export a function to transform the config

If anyone has more ideas, please feel free to discuss, and I'd be happy to port this feature to this repository.

9romise avatar Apr 27 '25 08:04 9romise

cc @SukkaW @Shinigami92

JounQin avatar Apr 27 '25 09:04 JounQin

IMHO, we do have eslint-import-resolver-vite, eslint-import-resolver-webpack. I don't see any typescript specific feature that we should implemented in this resolver anyway.

SukkaW avatar Apr 27 '25 13:04 SukkaW

IMHO, we do have eslint-import-resolver-vite, eslint-import-resolver-webpack. I don't see any typescript specific feature that we should implemented in this resolver anyway.

Those resolvers doesn't support .ts configs AFAIK.


Edit: jiti is already integrated into ESLint, so this should not be considered. (Although I don't like jiti personally due to babel is bundled in it)


eslint-import-resolver-webpack is very outdated.

Maybe we should support them in eslint-plugin-import-x instead, but in this resolver, it could also benefit eslint-plugin-import users.

JounQin avatar Apr 27 '25 16:04 JounQin

Those resolvers doesn't support .ts configs AFAIK.

TBH, it is their job to publish type declarations, not a reason for us to reinvent their wheels.

And we do have a compact util for adding legacy resolvers to eslint-plugin-import-x, we are already benefiting those users.

SukkaW avatar May 11 '25 13:05 SukkaW

TBH, it is their job to publish type declarations, not a reason for us to reinvent their wheels.

@SukkaW I'm talking about vite.config.ts/webpack.config.ts for example, not related to declaration files at all.

More discussion at https://github.com/9romise/eslint-import-resolver-oxc/issues/83

JounQin avatar May 11 '25 13:05 JounQin