Skip to content

Not resolving tsconfig paths #2652

Closed
Closed
@SimonCockx

Description

@SimonCockx

I have two projects, project-a and project-b, one importing the other via a paths synonym defined in tsconfig.base.json. Although the TypeScript compiler knows how to resolve the import, this plugin is complaining that it cannot resolve the path.

I've read the documentation of both this plugin and the TypeScript resolver plugin, and I think I configured everything right, but with no luck. Is there something wrong with my setup?

Minimal repro:

Snippets:

tsconfig.base.ts

"compilerOptions": {
  "paths": {
    "@importbug/b": ["project-b/src/index.ts"]
  },
  ...
}

project-a/.eslintrc.json

{
  "plugins": [
    "@typescript-eslint",
    "import"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "project": ["project-a/tsconfig.json"],
    "sourceType": "module"
  },
  "settings": {
    "import/resolver": {
      "typescript": {
        "alwaysTryTypes": true,
        "project": "tsconfig.json",
        "extensions": [".ts"]
      }
    },
    "import/parsers": {
      "@typescript-eslint/parser": [
        ".ts", ".tsx"
      ]
    }
  },
  "extends": [
    "plugin:import/typescript", "plugin:import/recommended"
  ]
}

project-a/src/index.ts

import { b } from "@importbug/b";
                   ^^^^^^^^^^^
b;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions