-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
chore: fix broken yarn lint script #6172
Conversation
c1d2fb8
to
bb57c5b
Compare
@@ -10,16 +10,16 @@ MATCH=("warning") | |||
# There are few yarn warnings we can't find a fix for. Excluding those. | |||
# TODO: Keep checking occasionally if the warnings are fixed upstream. | |||
EXCLUDE=("Pattern \[\".*\"\] is trying to unpack in the same destination") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could not find a solution to fix this warning, so why have to disable it from lint script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unmet peer dependency warnings seem to be resolved but there are further warnings. I quickly looked at how to resolve those warnings before, I linked to some issues here but does not seem like there are quick solutions for it.
[4/5] Linking dependencies...
warning Workspaces can only be enabled in private projects.
warning Workspaces can only be enabled in private projects.
Lint run did not properly catch the warnings, see job run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to workspace warning, I am seeing it on Mac for long time. It's a known issue and non-fixable in yarn 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workspace warning only happens since #6074 and the lint script is not catching that currently. I haven't seen any yarn warnings since we added the script until now.
CI run before PR got merged (no warnings), see job run
1m 20s
Run scripts/assert_no_yarn_warnings.sh
yarn install v[1](https://github.com/ChainSafe/lodestar/actions/runs/7137600806/job/19437903275#step:5:1).22.21 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... [4/5] Linking dependencies... [5/5] Building fresh packages... Done in [8](https://github.com/ChainSafe/lodestar/actions/runs/7137600806/job/19437903275#step:5:9)0.00s.
No warnings in yarn install --check-files
CI run on this branch, see job run
Run scripts/assert_no_yarn_warnings.sh
yarn install v1.22.21 [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... warning Pattern ["buffer@^6.0.3"] is trying to unpack in the same destination "/home/runner/.cache/yarn/v6/npm-buffer-polyfill-6.0.3-2ace5[7](https://github.com/ChainSafe/lodestar/actions/runs/7142943938/job/19453461545?pr=6172#step:5:8)[8](https://github.com/ChainSafe/lodestar/actions/runs/7142943938/job/19453461545?pr=6172#step:5:9)45[9](https://github.com/ChainSafe/lodestar/actions/runs/7142943938/job/19453461545?pr=6172#step:5:10)cc8fbe2a70aaa8f52ee63b6a74c6c6-integrity/node_modules/buffer-polyfill" as pattern ["buffer-polyfill@npm:buffer@^6.0.3"]. This could result in non-deterministic behavior, skipping. [4/5] Linking dependencies... warning Workspaces can only be enabled in private projects. warning Workspaces can only be enabled in private projects. [5/5] Building fresh packages... Done in 84.89s.
Running 'grep -qi -e 'warning' | grep -qi -v -e 'Pattern \[".*"\] is trying to unpack in the same destination''
No warnings in yarn install --check-files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After further investigation, it turns out both warnings are related to https://github.com/davidmyersdev/vite-plugin-node-polyfills, which we use here
import {nodePolyfills} from "vite-plugin-node-polyfills"; |
The warning warning Pattern ["buffer@^6.0.3"] is trying to unpack in the same destination "/home/nico/.cache/yarn/v6/npm-buffer-polyfill-6.0.3-2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6-integrity/node_modules/buffer-polyfill" as pattern ["buffer-polyfill@npm:buffer@^6.0.3"]. This could result in non-deterministic behavior, skipping.
happens because of
https://github.com/davidmyersdev/vite-plugin-node-polyfills/blob/bfb529025d722a49cf98c395550fd46454d0de39/package.json#L73
And warning Workspaces can only be enabled in private projects.
happens due to
https://github.com/davidmyersdev/vite-plugin-node-polyfills/blob/bfb529025d722a49cf98c395550fd46454d0de39/package.json#L94-L96
I haven't looked further on why we need those polyfills but shouldn't our code work in the browser without them? What if we run the code without polyfills in production will it break?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have tried to remove vite-plugin-node-polyfills
package but so far unsuccessful to make the browser tests work (unstable...nflaig/fix-yarn-warnings). Tried few different things but none worked, what I didn't try yet is using https://github.com/niksy/node-stdlib-browser#vite directly, this way we can avoid the polyfill package.
Opened two issues on polyfills package, maybe they can resolve it on their end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to use the polyfills for the browsers as Nodejs modules are not available in browser environment.
We can try few other polyfill packages, but using browsified modules directly meant to have multiple dependencies a a lot of vite configuration to manage in our code.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## unstable #6172 +/- ##
=========================================
Coverage 80.02% 80.02%
=========================================
Files 19 19
Lines 1717 1717
Branches 155 155
=========================================
Hits 1374 1374
Misses 341 341
Partials 2 2 |
@@ -107,6 +107,7 @@ | |||
"resolutions": { | |||
"dns-over-http-resolver": "^2.1.1", | |||
"chai": "^4.3.10", | |||
"loupe": "^2.3.6" | |||
"loupe": "^2.3.6", | |||
"vite": "^5.0.7" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this related to the PR description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's related. Used this change to fix few unmet dependencies yarn warnings while fixing and testing the yarn lint script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scripts/assert_no_yarn_warnings.sh
is broken
@nazarhussain let's close this PR and instead try to get rid of the actual warnings, this way we avoid wasting time on the script and resolve the actual problem. I think we can keep the |
Closed in favor of #6232 |
Motivation
Lint the yarn warnings
Description
Lint yarn warnings.
Steps to test or reproduce
Run all scripts/tests.