Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: move @typescript-eslint/types to dependencies #150

Merged
merged 3 commits into from
Jun 29, 2024
Merged

fix: move @typescript-eslint/types to dependencies #150

merged 3 commits into from
Jun 29, 2024

Conversation

lucacavallaro
Copy link
Contributor

@lucacavallaro lucacavallaro commented May 24, 2024

Description

Moved @typescript-eslint/types to dependencies, updating package.json and pnpm-lock.yaml.

Additional context

@typescript-eslint/types is a ghost dependency (also known as a phantom dependency).

The module utils/is-member-optional.ts imports @typescript-eslint/types as a runtime dependency (for using the AST_NODE_TYPES object), but @typescript-eslint/types is listed in devDependencies instead of dependencies.

Since it is not listed as a runtime dependency, eslint-plugin-perfectionist cannot be used in projects that are configured to catch ghost dependencies.

Running eslint@8 with eslint-plugin-perfectionist on a project with Yarn 4.x and Plug'n'Play generates this output:

Oops! Something went wrong! :(

ESLint: 8.57.0

Error: eslint-plugin-perfectionist tried to access @typescript-eslint/types, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: @typescript-eslint/types (via "@typescript-eslint/types/package.json")
Required by: eslint-plugin-perfectionist@virtual:99c56cc8117c503591d658d1cea7c8cc5813820c2c63ad47eb3cbca9e1b41cecc7efe882470f9e2957aa34fe6f7b1bffd3a76df365d7738ac820bf20c18397e3#npm:2.10.0 (via /Users/luca/Code/pagopa/io-fims/.yarn/__virtual__/eslint-plugin-perfectionist-virtual-6e5ba2d15a/4/.yarn/berry/cache/eslint-plugin-perfectionist-npm-2.10.0-0fc9601853-10c0.zip/node_modules/eslint-plugin-perfectionist/dist/utils/is-member-optional.mjs)

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.
  • Read contribution guidelines.

@scagood
Copy link

scagood commented Jun 19, 2024

I have also stumbled upon this, using yarn + pnpm mode.

I temporarily resolved this using my `.yarnrc.yml`
packageExtensions:
  eslint-plugin-perfectionist@*:
    dependencies:
      "@typescript-eslint/types": "^7"

image


I think the semver range should actually be inside dependencies:

    "@typescript-eslint/types": "^6.13.0 || ^7.0.0",

@azat-io
Copy link
Owner

azat-io commented Jun 29, 2024

Could you rebase you PR?

@azat-io azat-io changed the base branch from main to next June 29, 2024 13:37
@azat-io azat-io merged commit d2e4953 into azat-io:next Jun 29, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants