Skip to content

error when using pnp in strict mode due to undeclared dependencies  #497

@adrian-gierakowski

Description

@adrian-gierakowski

for example:

Failed to load module 'typescript-eslint-language-service' from /home/adrian/code/test-project/node_modules: Error: typescript-eslint-language-service tried to access @typescript-eslint/scope-manager, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

This affects users of yarn 3 (berry) and https://pnpm.io when using pnp.

Here's a patch which I had to put in my .yarnrc.yml to make silence the errors, which shows the deps accessed by this module in an unsound manner:

packageExtensions:
  typescript-eslint-language-service@*:
    dependencies:
      "@eslint/eslintrc": ^1.3.3
      "@typescript-eslint/scope-manager": "*"
      "@typescript-eslint/types": "*"
      "@typescript-eslint/typescript-estree": "5.41.0"
      "@typescript-eslint/visitor-keys": "*"
      globby: ^11.1.0
      is-glob: ^4.0.3

Note that I had to pin @typescript-eslint/typescript-estree to 5.41.0 since 5.42.0 introduced a breaking change which breaks typescript-eslint-language-service

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions