eslint-plugin-no-relative-import-paths icon indicating copy to clipboard operation
eslint-plugin-no-relative-import-paths copied to clipboard

Feature Request: fix based on tsconfig aliases

Open Flyrell opened this issue 2 years ago • 5 comments

Hi @MelvinVermeer and thanks for the useful plugin!

The problem: We use ESLint's auto-fixing in IDEs to run after each save. Unfortunately, we've got multiple aliases setup in tsconfig.json and realised that the plugin doesn't work with them, so it's quite difficult to set up a single rootDir for the whole project and/or other monorepos.

Possible solutions:

  1. We could add a config property which would specify the path to tsconfig file from where we can get the aliases which will be used as the rootDir for the auto-fix.
  2. We could maybe check the eslint parser used for the file, if the parser is set to @eslint-typescript/parser, we can probably extract the tsconfig from there somehow and use aliases from there to set rootDir for the auto-fix.

Not sure if any of these solutions are possible. My question is: have you tried doing something similar? Would you be ok if we were to create a pull request for the feature like that? Thanks for the response.

Flyrell avatar Dec 20 '22 12:12 Flyrell

any updates ?

any updates ?

CryUshio avatar Apr 10 '24 02:04 CryUshio

@MelvinVermeer do you need some help here? Thank you!

rafa-suarez-itx avatar May 10 '24 14:05 rafa-suarez-itx

I am open for PRs, option 2 feels most future proof

MelvinVermeer avatar Jun 26 '24 12:06 MelvinVermeer