Skip to content

[Bug?]: ESLint extension doesn't work with yarn pnp - Error: Missing "./lib/api.js" export in "eslint" package #3578

Closed
@NixBiks

Description

@NixBiks

Self-service

  • I'd be willing to implement a fix

Describe the bug

I'm using the ESLint extension in VSCode. Unfortunately it doesn't work with Plug'n'Play - according to the docs it should work if I understand correctly?

I've been looking at issues both here and in the ESLint extension repro but I haven't found anyone with this exact error it seems. I'm not sure if the issue belongs here or in the ESLint extension repro, let me know.

To reproduce

Make sure you have arcanis.vscode-zipfs and dbaeumer.vscode-eslint extensions installed in VS Code.

Run the following commands and just select defaults in the config initialization wizard

mkdir eslint-test
cd eslint-test
yarn set version berry
yarn init
yarn add -D eslint
yarn dlx @yarnpkg/sdks vscode
yarn eslint --init

Now verify that eslint will highlight an error in .eslintrc.js when running the following command (as expected)

yarn eslint .

Open eslintrc.js in VS Code and verify that the ESLint extension doesn't work. You can select the Output tab and select ESLint in the dropdown and see the following error

[Error - 2:16:22 PM] Error: Missing "./lib/api.js" export in "eslint" package
Require stack:
- /home/nixd/Projects/eslint-test/.pnp.cjs
    at bail (/home/nixd/Projects/eslint-test/.pnp.cjs:10700:8)
    at resolve (/home/nixd/Projects/eslint-test/.pnp.cjs:10776:10)
    at applyNodeExportsResolution (/home/nixd/Projects/eslint-test/.pnp.cjs:11027:28)
    at resolveUnqualifiedExport (/home/nixd/Projects/eslint-test/.pnp.cjs:11540:35)
    at resolveRequest (/home/nixd/Projects/eslint-test/.pnp.cjs:11606:99)
    at Object.resolveRequest (/home/nixd/Projects/eslint-test/.pnp.cjs:11681:26)
    at Function.external_module_.Module._resolveFilename (/home/nixd/Projects/eslint-test/.pnp.cjs:10533:34)
    at Function.external_module_.Module._load (/home/nixd/Projects/eslint-test/.pnp.cjs:10355:48)
    at Module.require (internal/modules/cjs/loader.js:1006:19)
    at require (internal/modules/cjs/helpers.js:88:18)
[Error - 2:20:20 PM] Error: Missing "./lib/api.js" export in "eslint" package

Environment

System:
    OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
  Binaries:
    Node: 15.14.0 - /tmp/xfs-affdb263/node
    Yarn: 3.0.2 - /tmp/xfs-affdb263/yarn
    npm: 7.24.1 - ~/.nvm/versions/node/v15.14.0/bin/npm

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions