import-js / eslint-import-resolver-typescript

This plugin adds `TypeScript` support to `eslint-plugin-import`
https://www.npmjs.com/package/eslint-import-resolver-typescript
ISC License
709 stars 62 forks source link

Support for TS 5.5 ${configDir} syntax #299

Open ondrejvelisek opened 1 month ago

ondrejvelisek commented 1 month ago

Hi,

I'm just setting up a new monorepo project based on TS 5.5. It seems eslint-import-resolver-typescript does not support its new syntax.

// This tsconfig.json works

{
    "compilerOptions": {
        "baseUrl": "./src",
        "paths": {
            "#/*": ["./*"]
        }
    },
    "include": ["src/**/*"]
}

// This tsconfig.json does not work

{
    "compilerOptions": {
        "baseUrl": "${configDir}/src",
        "paths": {
            "#/*": ["./*"]
        }
    },
    "include": ["src/**/*"]
}

Specifically in

// MyComponent.tsx

import { AttributeFilter } from "#/components/AttributeFilter";
...

Throws:

Unable to resolve path to module '#/components/AttributeFilter'. eslint (import/no-unresolved)

Using version "eslint-import-resolver-typescript": "^3.6.1".

It also seems this package does not support paths without baseUrl (introduced in TS 4.1)

Is it possible truth? Do you plan to add? May I help somehow?

Thanks!

SukkaW commented 1 month ago

See also https://github.com/privatenumber/get-tsconfig/issues/81

eslint-import-resolver-typescript's baseUrl and paths support is powered by get-tsconfig. I will bump the version of get-tsconfig ASAP once it is implemented and released.