-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Extraneous dependencies with Yarn v3 #93
Comments
It looks like an issue of |
OK, so there is a thing called yarnPath: ".yarn/releases/yarn-berry.cjs"
+pnpMode: "loose" But after that a new error appear:
The thing is Yarn Plug'n'play is nice feature, but it's not ready for using in real world yet (especially So I'm glad to help, and will try to do steps required from my side, but there is a lot things that needs to be done from other maintainers of popular packages and node.js itself, because |
I understood, it's possible to avoid a lot of warnings if This is the only way -rwxr-xr-x 1 coderaiser staff 1.2M Dec 15 18:59 .pnp.cjs* About formatters, |
Landed ability to benefit from If 🐊 Or I think we can come back to this in the future, when |
Landed support of yarn PnP in 🐊 |
I found out a little more details from yarn documentation: And did some modifications.
@spa5k @EvgenyOrekhov is this way of running works for you? |
coderaiser@localcmd:~/putout-yarn3$ yarn lint
./pages/1.tsx
1:22 Error: Replace `'xx'` with `"xx"` prettier/prettier
1:22 Error: Strings must use doublequote. quotes
3:1 Error: exported declaration 'setSession' not used within other modules import/no-unused-modules
3:1 Error: Prefer default export. import/prefer-default-export
3:14 Error: Expected a function declaration. func-style
4:1 Error: Replace `····` with `··` prettier/prettier
5:1 Error: Replace `····` with `··` prettier/prettier
5:5 Error: Shorthand properties should be used (apply-shorthand-properties) putout/putout 🔥🔥🔥🔥🔥🔥🔥
7:1 Error: Delete `⏎` prettier/prettier
info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
coderaiser@localcmd:~/putout-yarn3$ ls -lha node_modules/ 🔥🔥🔥🔥🔥🔥🔥
total 0
drwxr-xr-x 3 coderaiser staff 96B Dec 16 20:19 ./
drwxr-xr-x 21 coderaiser staff 672B Dec 17 16:20 ../
drwxr-xr-x 3 coderaiser staff 96B Dec 16 20:19 .cache/
coderaiser@localcmd:~/putout-yarn3$ vi .m
coderaiser@localcmd:~/putout-yarn3$ ls -lha
total 3480
drwxr-xr-x 21 coderaiser staff 672B Dec 17 16:20 ./
drwxr-xr-x+ 210 coderaiser staff 6.6K Dec 17 16:19 ../
-rw-r--r-- 1 coderaiser staff 54B Dec 17 15:44 .eslintrc.json
drwxr-xr-x 12 coderaiser staff 384B Dec 17 15:32 .git/
-rw-r--r-- 1 coderaiser staff 495B Dec 16 15:55 .gitignore
drwxr-xr-x 3 coderaiser staff 96B Dec 16 15:59 .next/
-rwxr-xr-x 1 coderaiser staff 1.3M Dec 17 16:20 .pnp.cjs* 🔥🔥🔥🔥🔥🔥🔥
-rw-r--r-- 1 coderaiser staff 7.8K Dec 16 16:09 .pnp.loader.mjs
-rw-r--r-- 1 coderaiser staff 43B Dec 16 16:09 .putout.json
drwxr-xr-x 6 coderaiser staff 192B Dec 17 15:11 .yarn/
-rw-r--r-- 1 coderaiser staff 58B Dec 16 19:42 .yarnrc.yml
-rw-r--r-- 1 coderaiser staff 1.5K Dec 16 15:55 README.md
-rw-r--r-- 1 coderaiser staff 201B Dec 16 15:55 next-env.d.ts
-rw-r--r-- 1 coderaiser staff 87B Dec 16 15:55 next.config.js
drwxr-xr-x 3 coderaiser staff 96B Dec 16 20:19 node_modules/
-rw-r--r-- 1 coderaiser staff 668B Dec 17 15:59 package.json
drwxr-xr-x 6 coderaiser staff 192B Dec 17 15:59 pages/
drwxr-xr-x 4 coderaiser staff 128B Dec 16 15:55 public/
drwxr-xr-x 4 coderaiser staff 128B Dec 16 15:55 styles/
-rw-r--r-- 1 coderaiser staff 509B Dec 16 15:55 tsconfig.json
-rw-r--r-- 1 coderaiser staff 406K Dec 17 16:20 yarn.lock
coderaiser@localcmd:~/putout-yarn3$ cat package.json
{
"name": "next-putout",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "PUTOUT_YARN_PNP=eslint-config-hardcore next lint", 🔥🔥🔥🔥🔥🔥🔥
"putout": "putout"
},
"dependencies": {
"eslint-config-hardcore": "^23.6.1",
"eslint-plugin-prettier": "^4.0.0",
"next": "12.0.7",
"prettier": "^2.5.1",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"@types/node": "16.11.13",
"@types/react": "17.0.37",
"eslint": "8.4.1",
"eslint-config-next": "12.0.7",
"putout": "^22.8.0",
"typescript": "4.5.4"
},
"packageManager": "yarn@3.1.1"
}
coderaiser@localcmd:~/putout-yarn3$ cat .yarnrc.yml
yarnPath: .yarn/releases/yarn-3.1.1.cjs
nodeLinker: "pnp" 🔥🔥🔥🔥🔥🔥🔥
coderaiser@localcmd:~/putout-yarn3$ cat .eslintrc.json
{
"extends": ["next/core-web-vitals", "hardcore"] 🔥🔥🔥🔥🔥🔥🔥
} |
We need to create a couple version of require for plugins, formatters and processors: - declared in 🐊Putout package.json; - declared in module that want to extend 🐊Putout; https://yarnpkg.com/advanced/rulebook#modules-shouldnt-hardcode-node_modules-paths-to-access-other-modules
@coderaiser I tried following your example (I added
I created a reproducible case here: https://github.com/EvgenyOrekhov/putout-yarn3/tree/PUTOUT_YARN_PNP Steps to reproduce: git clone git@github.com:EvgenyOrekhov/putout-yarn3.git
cd putout-yarn3
git checkout PUTOUT_YARN_PNP
yarn lint |
@EvgenyOrekhov, |
@coderaiser Hmm I have putout declared in eslint-config-hardcore's dependencies: I expected that it should work without using |
Looks that |
Try adding this - https://www.npmjs.com/package/@rushstack/eslint-patch It is useful in cases of yarn and monorepos. |
The future is peeking up over the horizon, yarnpkg/berry#3843 was fixed yesterday. The fix is available in
... according to yarnpkg/berry#4895 See yarnpkg/berry#3591 for v4 breaking changes. I've seen two mentions of people stumbling over Edit: Update: the fix that adds support for the |
@mrienstra Yarn PnP is supported for a long time. Is it works for you? |
@coderaiser, just spreading the news about yarnpkg/berry#3843. This comment:
.. states that standalone usage of 🐊Putout is limited to <= v22 due to yarnpkg/berry#3843, wanted to share that this will likely no longer be the case when Yarn v4 is used. |
That’s no longer the case, 🐊Putout uses lower version of chalk, and yarn PnP is supported. |
When I try to use Putout with Yarn v3, I get the following error:
Steps to reproduce:
git clone git@github.com:EvgenyOrekhov/putout-yarn3.git
cd putout-yarn3
yarn
yarn putout .
Looks similar to #92.
The text was updated successfully, but these errors were encountered: