eslint-config icon indicating copy to clipboard operation
eslint-config copied to clipboard

Dependency issues when used within folder with name being a superset of parent's folder

Open JoJk0 opened this issue 8 months ago • 0 comments

Describe the bug

When using @antfu/eslint-config in a project on Windows that has a folder name that is a superset of parent folder's name, lint command is throwing the following error:

> eslint . "--fix"


Oops! Something went wrong! :(

ESLint: 9.3.0

Error: Cannot find package 'C:\...\***\***.Client\node_modules\.pnpm\@[email protected]_@[email protected][email protected][email protected]__@vue+_r4q2j7aafpdnjhsogjebmzyegi\node_modules\eslint-plugin-eslint-comments\package.json' imported from C:\...\****\***.Client\node_modules\.pnpm\@[email protected]_@[email protected][email protected][email protected]__@vue+_r4q2j7aafpdnjhsogjebmzyegi\node_modules\@antfu\eslint-config\dist\index.js 
Did you mean to import [email protected][email protected]/node_modules/eslint-plugin-eslint-comments/index.js?
    at legacyMainResolve (node:internal/modules/esm/resolve:205:26)
    at packageResolve (node:internal/modules/esm/resolve:831:14)
    at moduleResolve (node:internal/modules/esm/resolve:901:20)
    at defaultResolve (node:internal/modules/esm/resolve:1121:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
    at link (node:internal/modules/esm/module_job:84:36)
 ELIFECYCLE  Command failed with exit code 2.

This happens as soon as @antfu/eslint-config is being imported inside eslint.config.js file

Reproduction

  1. On Windows. create My.Project folder 2. Create My.Project.Client folder inside My.Project folder 3. Clone vitesse starter template into My.Project.Client folder. 4. Install packages and run pnpm lint

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (4) x64 AMD EPYC 7763 64-Core Processor
    Memory: 3.15 GB / 15.95 GB
  Binaries:
    Node: 20.10.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.1.1 - C:\...\***\***.Client\node_modules\.bin\pnpm.CMD
  Browsers:
    Edge: Chromium (126.0.2592.68)
    Internet Explorer: 11.0.22621.3527

Used Package Manager

pnpm

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

Contributions

  • [ ] I am willing to submit a PR to fix this issue
  • [ ] I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

JoJk0 avatar Jun 26 '24 10:06 JoJk0