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

Format repo, add new rules #7226

Merged
merged 6 commits into from
Sep 9, 2024
Merged

Format repo, add new rules #7226

merged 6 commits into from
Sep 9, 2024

Conversation

luu-alex
Copy link
Contributor

Description

  • changed .eslintrc.js - on push, test files ignore '@typescript-eslint/no-unsafe-call' and import/no-unresolved
    for all ts files - ignore default-param-last rule.
    This will allow us to git push without running into errors that are not a problem for the library.
  • before commits, changed files will be formatted proeprly
  • formatted all files.

Please include a summary of the changes and be sure to follow our Contribution Guidelines.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run lint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I ran npm run test:coverage and my test cases cover all the lines and branches of the added code.
  • I ran npm run build and tested dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.
  • I have linked Issue(s) with this PR in "Linked Issues" menu.

Copy link

github-actions bot commented Aug 28, 2024

Bundle Stats

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
10 639.62 kB 0%
Changeset
File Δ Size
../web3-rpc-providers/lib/commonjs/web3_provider_quicknode.js 📈 +80 B (+1.47%) 5.33 kB → 5.41 kB
../web3-validator/lib/commonjs/validation/bytes.js 📈 +24 B (+0.86%) 2.73 kB → 2.76 kB
../web3-validator/lib/commonjs/validator.js 📈 +36 B (+0.49%) 7.11 kB → 7.15 kB
../web3-eth-contract/lib/commonjs/contract.js 📈 +163 B (+0.38%) 41.59 kB → 41.75 kB
../web3-core/lib/commonjs/utils.js 📈 +8 B (+0.27%) 2.85 kB → 2.85 kB
../web3-eth/lib/commonjs/utils/send_tx_helper.js 📈 +20 B (+0.22%) 9.01 kB → 9.03 kB
../web3-eth-personal/lib/commonjs/personal.js 📈 +19 B (+0.15%) 11.99 kB → 12.01 kB
../web3-eth/lib/commonjs/rpc_method_wrappers.js 📈 +46 B (+0.11%) 41.64 kB → 41.69 kB
../web3-eth-abi/lib/commonjs/coders/base/numbersLimits.js 📈 +1 B (+0.06%) 1.51 kB → 1.51 kB
../web3-core/lib/commonjs/web3_context.js 📈 +1 B (+0.01%) 13.44 kB → 13.44 kB
../web3-eth-ens/lib/commonjs/ens.js 📉 -2 B (-0.02%) 11.4 kB → 11.4 kB
../web3-eth-contract/lib/commonjs/contract-deployer-method-class.js 📉 -2 B (-0.03%) 6.91 kB → 6.9 kB
../web3-eth/lib/commonjs/utils/detect_transaction_type.js 📉 -2 B (-0.04%) 4.96 kB → 4.96 kB
../web3-rpc-providers/lib/commonjs/errors.js 📉 -1 B (-0.06%) 1.77 kB → 1.77 kB
src/web3_eip6963.ts 📉 -2 B (-0.06%) 3.09 kB → 3.08 kB
../web3-utils/lib/commonjs/formatter.js 📉 -24 B (-0.17%) 14.03 kB → 14.01 kB
../web3-rpc-providers/lib/commonjs/types.js 📉 -4 B (-0.22%) 1.76 kB → 1.75 kB
../web3-providers-http/lib/commonjs/index.js 📉 -14 B (-0.31%) 4.44 kB → 4.43 kB
../web3-eth-ens/lib/commonjs/resolver.js 📉 -68 B (-1.03%) 6.42 kB → 6.36 kB
../web3-eth-accounts/lib/commonjs/common/eips/2537.js 📉 -62 B (-1.20%) 5.06 kB → 5 kB
../web3-eth-accounts/lib/commonjs/common/hardforks/shanghai.js 📉 -9 B (-1.94%) 464 B → 455 B
../web3-eth-accounts/lib/commonjs/common/hardforks/london.js 📉 -9 B (-2.27%) 397 B → 388 B
../web3-eth-accounts/lib/commonjs/common/hardforks/mergeForkIdTransition.js 📉 -9 B (-2.59%) 348 B → 339 B
../web3-eth-accounts/lib/commonjs/common/hardforks/berlin.js 📉 -9 B (-2.62%) 344 B → 335 B
../web3-eth-accounts/lib/commonjs/common/hardforks/merge.js 📉 -16 B (-3.23%) 496 B → 480 B
../web3-eth-accounts/lib/commonjs/common/hardforks/spuriousDragon.js 📉 -23 B (-3.31%) 695 B → 672 B
../web3-eth-accounts/lib/commonjs/common/hardforks/grayGlacier.js 📉 -17 B (-3.63%) 468 B → 451 B
../web3-eth-accounts/lib/commonjs/common/eips/3529.js 📉 -32 B (-3.66%) 874 B → 842 B
../web3-eth-accounts/lib/commonjs/common/hardforks/istanbul.js 📉 -109 B (-3.68%) 2.89 kB → 2.79 kB
../web3-eth-accounts/lib/commonjs/common/chains/goerli.js 📉 -103 B (-3.69%) 2.72 kB → 2.62 kB
../web3-eth-accounts/lib/commonjs/common/hardforks/muirGlacier.js 📉 -19 B (-3.72%) 511 B → 492 B
../web3-eth-accounts/lib/commonjs/common/hardforks/arrowGlacier.js 📉 -17 B (-3.76%) 452 B → 435 B
../web3-eth-accounts/lib/commonjs/common/hardforks/constantinople.js 📉 -83 B (-3.78%) 2.15 kB → 2.06 kB
../web3-eth-accounts/lib/commonjs/common/hardforks/homestead.js 📉 -19 B (-3.83%) 496 B → 477 B
../web3-eth-accounts/lib/commonjs/common/hardforks/byzantium.js 📉 -68 B (-3.85%) 1.73 kB → 1.66 kB
../web3-eth-accounts/lib/commonjs/common/chains/sepolia.js 📉 -107 B (-3.86%) 2.71 kB → 2.6 kB
../web3-eth-accounts/lib/commonjs/common/chains/mainnet.js 📉 -118 B (-3.87%) 2.98 kB → 2.86 kB
../web3-eth-accounts/lib/commonjs/common/eips/3860.js 📉 -29 B (-3.92%) 739 B → 710 B
../web3-eth-accounts/lib/commonjs/common/eips/2930.js 📉 -28 B (-3.97%) 705 B → 677 B
../web3-eth-accounts/lib/commonjs/common/eips/2929.js 📉 -106 B (-3.98%) 2.6 kB → 2.5 kB
../web3-eth-accounts/lib/commonjs/common/eips/5133.js 📉 -23 B (-4.00%) 575 B → 552 B
../web3-eth-accounts/lib/commonjs/common/eips/4345.js 📉 -23 B (-4.12%) 558 B → 535 B
../web3-eth-accounts/lib/commonjs/common/eips/3554.js 📉 -23 B (-4.14%) 555 B → 532 B
../web3-eth-accounts/lib/commonjs/common/hardforks/petersburg.js 📉 -49 B (-4.15%) 1.15 kB → 1.11 kB
../web3-eth-accounts/lib/commonjs/common/hardforks/tangerineWhistle.js 📉 -54 B (-4.22%) 1.25 kB → 1.2 kB
../web3-eth-accounts/lib/commonjs/common/eips/1559.js 📉 -35 B (-4.29%) 816 B → 781 B
../web3-eth-accounts/lib/commonjs/common/eips/2565.js 📉 -23 B (-4.30%) 535 B → 512 B
../web3-eth-accounts/lib/commonjs/common/eips/2718.js 📉 -17 B (-4.42%) 385 B → 368 B
../web3-eth-accounts/lib/commonjs/common/eips/3541.js 📉 -19 B (-4.45%) 427 B → 408 B
../web3-eth-accounts/lib/commonjs/common/hardforks/chainstart.js 📉 -541 B (-4.46%) 11.86 kB → 11.33 kB
../web3-eth-accounts/lib/commonjs/common/hardforks/dao.js 📉 -15 B (-4.49%) 334 B → 319 B
../web3-eth-accounts/lib/commonjs/common/eips/2315.js 📉 -33 B (-4.56%) 724 B → 691 B
../web3-eth-accounts/lib/commonjs/common/eips/3607.js 📉 -21 B (-4.63%) 454 B → 433 B
../web3-eth-accounts/lib/commonjs/common/eips/3198.js 📉 -23 B (-4.65%) 495 B → 472 B
../web3-eth-accounts/lib/commonjs/common/eips/4399.js 📉 -21 B (-4.75%) 442 B → 421 B
../web3-eth-accounts/lib/commonjs/common/eips/3855.js 📉 -25 B (-4.78%) 523 B → 498 B
../web3-eth-accounts/lib/commonjs/common/eips/1153.js 📉 -30 B (-4.78%) 627 B → 597 B
../web3-eth-accounts/lib/commonjs/common/eips/3675.js 📉 -21 B (-4.84%) 434 B → 413 B
../web3-eth-accounts/lib/commonjs/common/eips/3540.js 📉 -21 B (-4.88%) 430 B → 409 B
../web3-eth-accounts/lib/commonjs/common/eips/3670.js 📉 -21 B (-4.94%) 425 B → 404 B
../web3-eth-accounts/lib/commonjs/common/eips/3651.js 📉 -21 B (-5.04%) 417 B → 396 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
web3.min.js 620.22 kB 0%
../lib/commonjs/index.d.ts 8.69 kB 0%
../lib/commonjs/accounts.d.ts 3.89 kB 0%
../lib/commonjs/types.d.ts 2.67 kB 0%
../lib/commonjs/web3.d.ts 1.38 kB 0%
../lib/commonjs/web3_eip6963.d.ts 1.28 kB 0%
../lib/commonjs/abi.d.ts 999 B 0%
../lib/commonjs/eth.exports.d.ts 280 B 0%
../lib/commonjs/providers.exports.d.ts 183 B 0%
../lib/commonjs/version.d.ts 60 B 0%

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: 98c1491 Previous: 27155ea Ratio
processingTx 21556 ops/sec (±6.56%) 21492 ops/sec (±7.89%) 1.00
processingContractDeploy 39727 ops/sec (±8.37%) 40035 ops/sec (±5.14%) 1.01
processingContractMethodSend 15392 ops/sec (±8.53%) 15323 ops/sec (±10.31%) 1.00
processingContractMethodCall 26536 ops/sec (±8.79%) 28246 ops/sec (±6.49%) 1.06
abiEncode 42705 ops/sec (±6.84%) 43024 ops/sec (±7.13%) 1.01
abiDecode 29542 ops/sec (±7.26%) 29932 ops/sec (±7.74%) 1.01
sign 1546 ops/sec (±0.96%) 1509 ops/sec (±3.19%) 0.98
verify 364 ops/sec (±0.52%) 367 ops/sec (±0.55%) 1.01

This comment was automatically generated by workflow using github-action-benchmark.

Copy link
Contributor

@jdevcs jdevcs left a comment

Choose a reason for hiding this comment

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

This code formatting in a large size will significantly improve readability and ease maintenance by creating a consistent style. However, a major drawback is the loss of historical context, when a substantial number of lines are altered for formatting, it obscures the history of actual functional changes, making it challenging to understand the evolution of the codebase. Additionally, tools like git blame may become hard to use, as they will highlight formatting changes instead of the original authorship of the logic, complicating the ability to trace who made specific contributions to the code.

@luu-alex
Copy link
Contributor Author

luu-alex commented Sep 3, 2024

@jdevcs The tradeoffs you highlighted are valuable to note. I believe eventaully we will need to format this library and once we do we can have a working order of code formatting going forward, as the rules I created will always format the library to standard. I think the to look back on the actual git blame we can take a look at the previous git commits within github.
If you do not believe this is the time to format the library, we should have a consideration of when this should happen as I believe we will find real value having a consistent library for formatting.

Copy link
Contributor

@jdevcs jdevcs left a comment

Choose a reason for hiding this comment

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

As we discussed in team call, pls make sure there is no code change in this PR except for config of (pre commit hook for formatting), thanks

@jdevcs
Copy link
Contributor

jdevcs commented Sep 9, 2024

@luu-alex merge this PR for avoiding merge conflicts, as its massively touching each file.

@luu-alex luu-alex merged commit b86d8ca into 4.x Sep 9, 2024
33 of 36 checks passed
@luu-alex luu-alex deleted the format-files branch September 9, 2024 15:16
Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 90.38462% with 15 lines in your changes missing coverage. Please review.

Project coverage is 94.44%. Comparing base (27155ea) to head (98c1491).
Report is 1 commits behind head on 4.x.

Additional details and impacted files
@@            Coverage Diff             @@
##              4.x    #7226      +/-   ##
==========================================
- Coverage   94.48%   94.44%   -0.05%     
==========================================
  Files         216      216              
  Lines        8439     8454      +15     
  Branches     2318     2335      +17     
==========================================
+ Hits         7974     7984      +10     
- Misses        465      470       +5     
Flag Coverage Δ
UnitTests 94.44% <90.38%> (-0.05%) ⬇️

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

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

Successfully merging this pull request may close these issues.

3 participants