-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
fix: fix eslint for import/no-extraneous-dependencies #5752
Conversation
7fd995f
to
5bb6cb3
Compare
5bb6cb3
to
e506cf4
Compare
Performance Report✔️ no performance regression detected Full benchmark results
|
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.
LGTM 🚀
Just leaving at note for meta searches. There were 4 strict null checks that were explicitly converted to if (x !== null)
or vice versa for positive case.
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.
Looks good to me, just few remarks.
We should try to fix all those relative imports, they are easy to find now searching for import/no-relative-packages
and reusable test utils can be moved to @lodestar/test-utils.
@@ -152,7 +156,6 @@ module.exports = { | |||
semi: "off", | |||
}, | |||
settings: { | |||
"import/internal-regex": "^@chainsafe/", |
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.
why was this removed? should add some context in the PR
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.
First it was contextually not correct. Secondly it was making the mono-repo packages as external.
import {BeaconConfig} from "@lodestar/config"; | ||
import {LoggerNode} from "@lodestar/logger/node"; | ||
import type {LoggerNode} from "@lodestar/logger/node"; |
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.
@lodestar/logger is a dependency of beacon-node, what is the reason for adding explicit type only import?
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.
On 2nd thought, maybe it makes sense. The only reason the beacon-node packages requires @lodestar/logger as dependency is because the workers need to initialize their own instance using getNodeLogger
. I don't think this can be solved though as it will not be possible to inject the logger to the worker process.
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.
For type only import, it was changed before I realized that worker are requiring getNodeLogger
.
@@ -1,5 +1,6 @@ | |||
import {itBench} from "@dapplion/benchmark"; | |||
import {PointFormat} from "@chainsafe/bls/types"; | |||
// eslint-disable-next-line import/no-relative-packages | |||
import {generatePerfTestCachedStatePhase0, numValidators} from "../../../../../../state-transition/test/perf/util.js"; |
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.
I feel like we should get rid of those cross-package relative imports. Those functions could be moved to @lodestar/test-utils and then imported from there.
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 we can do that and @lodestar/test-utils
will be helpful in this context.
🎉 This PR is included in v1.10.0 🎉 |
Motivation
All the packages should have valid dependencies.
Description
import/no-extraneous-dependencies
which was not effective for mono-repo packages.Steps to test or reproduce
Run all tests
NOTE: Would be better to review by commit.