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

Problem with Putout when using Yarn v3 PNP #399

Closed
EvgenyOrekhov opened this issue Dec 15, 2021 · 10 comments
Closed

Problem with Putout when using Yarn v3 PNP #399

EvgenyOrekhov opened this issue Dec 15, 2021 · 10 comments

Comments

@EvgenyOrekhov
Copy link
Owner

Steps to reproduce:

npx create-next-app@latest --ts
cd next-ts
yarn add --dev eslint-config-hardcore
# Add hardcore configs to .eslintrc.json
rm -rf node_modules package-lock.json yarn.lock
yarn set version berry
yarn
yarn lint

Expected behavior: should run ESLint successfully

Actual behavior: Error: Error while loading rule 'putout/putout': Plugin "putout-plugin-apply-shorthand-properties" could not be found!

Moved from #385

@EvgenyOrekhov
Copy link
Owner Author

Created coderaiser/putout#93.

@coderaiser
Copy link

coderaiser commented Dec 15, 2021

@spa5k, @EvgenyOrekhov try to set loose mode:

yarnPath: ".yarn/releases/yarn-berry.cjs"
+pnpMode: "loose"

You will see a lot warnings like this:

(node:81022) [MODULE_NOT_FOUND] Error: eslint-config-next tried to access @eslint/eslintrc, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
(node:81022) [MODULE_NOT_FOUND] Error: @putout/engine-loader tried to access @putout/plugin-apply-is-array, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
(node:81022) [MODULE_NOT_FOUND] Error: @putout/engine-loader tried to access @putout/plugin-apply-destructuring, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
(node:81022) [MODULE_NOT_FOUND] Error: @putout/engine-loader tried to access @putout/plugin-apply-optional-chaining, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
(node:81022) [MODULE_NOT_FOUND] Error: @putout/engine-loader tried to access @putout/plugin-apply-numeric-separators, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
(node:81022) [MODULE_NOT_FOUND] Error: @putout/engine-loader tried to access @putout/plugin-apply-if-condition, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
(node:81022) [MODULE_NOT_FOUND] Error: @putout/engine-loader tried to access @putout/plugin-extract-object-properties, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

But things will work :)

image

UPDATE: should work without loose-mode and without warnings after @putout/engine-loader v4.10.0 rolled out :)!
@spa5k is it works for you?

@coderaiser coderaiser mentioned this issue Dec 15, 2021
1 task
@EvgenyOrekhov
Copy link
Owner Author

@coderaiser I tried creating a fresh Next.js project and installing eslint-config-hardcore (as described here), and got the same error :(

Error: Error while loading rule 'putout/putout': Plugin "putout-plugin-apply-shorthand-properties" could not be found!

@EvgenyOrekhov
Copy link
Owner Author

@coderaiser I tried adding pnpMode: "loose", got a bunch of "MODULE_NOT_FOUND" warnings, but it worked!
Can we make putout-plugin-apply-shorthand-properties work without using loose mode?

@coderaiser
Copy link

@EvgenyOrekhov everything should work without pnpMode as well since putout v22.8.0.

npx create-next-app@latest --ts gives me next errors:

Installing devDependencies:
- eslint
- eslint-config-next

npm ERR! code ETARGET
npm ERR! notarget No matching version found for object.values@^1.1.5.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

@coderaiser
Copy link

It worked, but now I see that it works with apply-shorthand-properties works good with putout, when .putout.jsonupdated, butESLintdoesn't see it at all, when I updateextendswithhardcore`.

@coderaiser
Copy link

coderaiser commented Dec 16, 2021

No! It works good, take a look:

image

coderaiser@localcmd:~/putout-yarn3$ cat .eslintrc.json
{
    "extends": [
        "next/core-web-vitals",
         "hardcore"
    ]
}

I added eslint to scripts, and run yarn eslint .

@coderaiser
Copy link

Looks like bundle not created for me anymore. As I see yarn berry is a very raw and unstable product, I don't know if it worse to waste time on it...

@EvgenyOrekhov
Copy link
Owner Author

@coderaiser I agree, it's not worth it. We should wait until Yarn v3 becomes stable.

@spa5k We've done what we could. Apparently Yarn v3 is just raw and buggy.

Workaround: use npm.

@spa5k
Copy link

spa5k commented Dec 16, 2021

Thanks for the hardwork. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants