Skip to content

Bug: [import/no-unresolved] Error when importing typescript-eslint in a pnpm setup #10525

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

Closed
4 tasks done
lnuvy opened this issue Dec 19, 2024 · 3 comments
Closed
4 tasks done
Labels
bug Something isn't working external This issue is with another package, not typescript-eslint itself locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@lnuvy
Copy link

lnuvy commented Dec 19, 2024

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://github.com/lnuvy/eslint9-eslint-typescript-8.18.1

Repro Code

import tseslint from "typescript-eslint";

ESLint Config

import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint"; // An error occurs on this line

export default tseslint.config(
  ...

tsconfig

{
  "compilerOptions": {
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "target": "es5",
    "module": "NodeNext",
    "moduleResolution": "nodenext",
    "baseUrl": "."
  }
}

Expected Result

expected the import line to work without errors

Actual Result

Unable to resolve path to module 'typescript-eslint'.eslintimport/no-unresolved

Additional Info

Hello!
this is an issue I discovered while setting up ESLint 9 in a monorepo.
I found a potentially related issue (#10508), but there is a key difference: the error does not occur in the import statement for that case. I apologize if this turns out to be a duplicate that I overlooked.

I'm sharing a reproducible repository and images.

스크린샷 2024-12-20 오전 2 18 06 스크린샷 2024-12-20 오전 2 48 58

First image's project uses the Yarn package manager, while the images showing the error are from a project using the pnpm package manager.

Even after trying various versions of TypeScript, ESLint, and typescript-eslint, the error consistently occurs only in pnpm projects.

Functionally, everything works as expected, so using something like // eslint-disable-next-line import/no-unresolved is an option. but, I think this is not a fundamental solution, which is why I am reporting this issue.

Thank you :)

@lnuvy lnuvy added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Dec 19, 2024
@kirkwaiblinger
Copy link
Member

Hi @lnuvy !

I don't think this is something we can do anything with, at least not in its current incarnation... Granted that you say the code works at runtime, this seems like just an issue with eslint-plugin-import. Have you filed an issue there?

@kirkwaiblinger kirkwaiblinger closed this as not planned Won't fix, can't repro, duplicate, stale Dec 19, 2024
@kirkwaiblinger kirkwaiblinger added external This issue is with another package, not typescript-eslint itself awaiting response Issues waiting for a reply from the OP or another party labels Dec 19, 2024
@bradzacher
Copy link
Member

yup -- nothing to do with our project here!
we don't own eslint-plugin-import or any of their infra.
if their plugin cannot resolve our package under pnpm then likely you've misconfigured their plugin or their plugin is missing support.

Please reach out to them for help!

@bradzacher bradzacher removed awaiting response Issues waiting for a reply from the OP or another party triage Waiting for team members to take a look labels Dec 20, 2024
@lnuvy
Copy link
Author

lnuvy commented Dec 20, 2024

@kirkwaiblinger @bradzacher
Thank you for comments!

Since the issue occurred in the import line, I hadn't considered that it might be caused by another plugin. 😢

I'll check the eslint-plugin-import community for more information.

@lnuvy lnuvy closed this as completed Dec 20, 2024
@github-actions github-actions bot added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Dec 28, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working external This issue is with another package, not typescript-eslint itself locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

3 participants