tsconfck icon indicating copy to clipboard operation
tsconfck copied to clipboard

[Feature Request] Add a few API for `eslint-import-resolver-typescript` and `eslint-plugin-import-x` to migrate to `tsconfck`

Open SukkaW opened this issue 6 months ago • 3 comments

Describe the feature

I recently became the co-maintainer of the eslint-import-resolver-typescript and the eslint-plugin-import-x projects, and I am working on replacing get-tsconfig w/ tsconfck. I have faced a few difficulties in implementing that because of the lack of the following features:

  • Synchronous API
  • Paths matcher / resolver

A Usecase

ESLint rules are synchronous, so we need a synchronous API to get the tsconfig file.

We also need a resolver that implements a module resolver interface that implements the TypeScript resolving algorithm (https://github.com/microsoft/TypeScript/blob/3ccbe804f850f40d228d3c875be952d94d39aa1d/src/compiler/moduleNameResolver.ts#L2465):

  • https://github.com/dividab/tsconfig-paths/blob/b4eb77bd1a49096f0fa1076e65a8182819b1dc2c/src/match-path-sync.ts#L27
  • https://github.com/privatenumber/get-tsconfig/blob/9e78ec52d450d58743439358dd88e2066109743f/src/paths-matcher/index.ts#L41

Alternatives

I could use libraries like synckit to force convert async API to sync, but it is less ideal.

As for the matcher/resolver, I could copy codes from vite-tsconfig-paths, which IMHO is also not ideal.

Additional context

SukkaW avatar Jul 27 '24 18:07 SukkaW