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

Make linting less badder #3794

Merged
merged 18 commits into from
Nov 13, 2024
Merged

Make linting less badder #3794

merged 18 commits into from
Nov 13, 2024

Conversation

acolytec3
Copy link
Contributor

@acolytec3 acolytec3 commented Nov 12, 2024

This reimagines our lint process and hopefully makes it at least 2-3x faster

  • Replace prettier with biome (almost exactly conforms to prettier standards but rust so therefore faster...maybe) for formatting and remove this from the eslint config
  • Disables a few eslint rules that duplicate existing typescript functionality
    • no-undef (Typescript will catch any use of real undefined stuff. This was just flagging for us referencing NodeJS in devp2p
    • import/named/import/namespace/import/default are all turned off - typescript-eslint explicitly suggests disabling these
  • Moves all package specific config overrides into the main eslint configuration file
  • Only run eslint from the root of the monorepo. This is the biggest win as our previous way of running the linter per package was causing dramatic slowdowns since it was basically starting up the linter and parsing the file tree for each package
  • Removes all prettier and tsconfig.lint.json package specific config files as these are no longer needed
  • Update the precommit and prepush git hooks to use the new linting setup
    This is an alternative to Make linting greater again #3792 where we replace prettier with biome just for formatting and then run the linter from the directory root rather than from each package (which means we only start the linter up once instead 13 times). Together, these have reduced the time to lint the monorepo by 2.5x on my slow-mo Intel i9 processor from 2022.

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 4 lines in your changes missing coverage. Please review.

Project coverage is 75.83%. Comparing base (287f960) to head (f434ac3).
Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 73.74% <ø> (ø)
blockchain 83.25% <ø> (ø)
client 74.00% <ø> (ø)
common 89.89% <ø> (ø)
devp2p 71.95% <40.00%> (ø)
evm 64.94% <100.00%> (+0.04%) ⬆️
genesis 100.00% <ø> (ø)
mpt 52.09% <ø> (ø)
rlp 95.11% <ø> (ø)
statemanager 68.81% <ø> (ø)
tx 76.52% <100.00%> (-0.18%) ⬇️
util 72.73% <ø> (ø)
vm 57.35% <100.00%> (ø)
wallet 79.67% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@acolytec3 acolytec3 changed the title Run linter from root Make linting less badder Nov 12, 2024
Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@acolytec3 acolytec3 merged commit 564020a into master Nov 13, 2024
41 checks passed
@acolytec3 acolytec3 deleted the make-eslint-fasterer branch November 13, 2024 17:34
Copy link
Member

@jochem-brouwer jochem-brouwer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 questions. It also seems the style we have in the configs is now changed, since a lot of files got committed which seem to have lint changes?

@@ -2,9 +2,9 @@
REMOTE=$(git rev-parse --symbolic-full-name --abbrev-ref @{u})

if [ -z "$REMOTE" ]; then
FILESCHANGED=". --ext .js,.jsx,.ts,.tsx"
FILESCHANGED=". --ext .js,.ts"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now ignore tsx here, is this intended? Also for jsx below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we don't use tsx and jsx in our code base. Unless we start writing front-end web apps, we never will, so no point in checking for them.

rules: {
'@typescript-eslint/no-use-before-define': 'off',
'no-invalid-this': 'off',
'no-restricted-syntax': 'off',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do these specific packages have these exceptions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I carried these over from the previous package-specific lint configs. We can go through them and see if they can be removed.

@acolytec3
Copy link
Contributor Author

2 questions. It also seems the style we have in the configs is now changed, since a lot of files got committed which seem to have lint changes?

I think there was maybe one subtle difference between prettier and biome and that accounts for most of the file changes. It was just a little bit of formatting difference (e.g. adding a new line between closing brackets and opening of a new line sort of thing).

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

Successfully merging this pull request may close these issues.

3 participants