Skip to content

JS/TS resolution: honor baseUrl declared in an extended tsconfig, and add a JSONC config test #2200

Description

@safishamsi

Follow-up to #2153 / #2176 (baseUrl/paths resolution). Two gaps from review:

  1. extends-inherited baseUrl is not honored. _load_tsconfig_base_url parses only the leaf config, so a tsconfig.json with "extends": "./tsconfig.base.json" where the base declares baseUrl resolves to None (common monorepo/NestJS shape). Mirror the extends-chain handling that _read_tsconfig_aliases already has (child declaration wins; resolve each baseUrl relative to the config that declares it; skip @-scoped npm configs; circular-guard).
  2. Also apply an isinstance(compilerOptions, dict) guard so a "compilerOptions": null config does not raise AttributeError (pre-existing in the alias loader too).
  3. Add a JSONC test: a jsconfig with // comments, /* */, and trailing commas with a baseUrl resolves (the code already strips JSONC via the _read_tsconfig_aliases() silently fails on tsconfig.json with comments — every JS/TS project hits this #700 helper, but there is no test).

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