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

deps: migrate to biomejs from eslint #7108

Merged
merged 35 commits into from
Oct 10, 2024
Merged

deps: migrate to biomejs from eslint #7108

merged 35 commits into from
Oct 10, 2024

Conversation

nazarhussain
Copy link
Contributor

Motivation

Improve the performance for development environment. Where no other tool compete linting for biomejs, whole project less than 1s vs 43s.

yarn lint
yarn run v1.22.22
$ biome check packages/*/src packages/*/test
Checked 1664 files in 249ms. No fixes applied.
✨  Done in 0.47s.
yarn lint
yarn run v1.22.22
$ eslint --report-unused-disable-directives --color --ext .ts packages/*/src packages/*/test
✨  Done in 43.63s.

Description

These are the reasons to consider Biomejs for better option.

  • Biomejs is modern and all-in-one solution while eslint is base layer with many extra libraries on top.
  • There is an gray overlap between prettier and eslint rules, where BiomeJS combined both operations in one solution.
  • The Biomejs rules are grouped and easy to understand.
    • Accessibility
    • Complexity
    • Correctness
    • Nursery
    • Performance
    • Security
    • Stype
    • Suspicious
  • The linting output is unambiguous and very detailed.

NOTE:

Noteable difference you may encounter is that in biomejs there is no file level ignore option with code comment. you have to do that in configurations. Reason is that such file level comments never get focused once added.

Steps to test or reproduce

  • Run all tests.

@nazarhussain nazarhussain requested a review from a team as a code owner September 25, 2024 13:59
@nazarhussain nazarhussain self-assigned this Sep 25, 2024
Copy link

codecov bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 37.87879% with 41 lines in your changes missing coverage. Please review.

Project coverage is 49.13%. Comparing base (0d1fd9c) to head (ddd66bb).
Report is 9 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #7108      +/-   ##
============================================
+ Coverage     49.04%   49.13%   +0.09%     
============================================
  Files           596      597       +1     
  Lines         39743    39707      -36     
  Branches       2065     2084      +19     
============================================
+ Hits          19493    19512      +19     
+ Misses        20209    20154      -55     
  Partials         41       41              

Copy link
Contributor

github-actions bot commented Sep 25, 2024

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: f318f23 Previous: 068fbae Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.2913 ms/op 2.1370 ms/op 1.07
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 55.253 us/op 49.291 us/op 1.12
BLS verify - blst 1.1401 ms/op 1.4424 ms/op 0.79
BLS verifyMultipleSignatures 3 - blst 1.6993 ms/op 1.2566 ms/op 1.35
BLS verifyMultipleSignatures 8 - blst 2.3521 ms/op 2.5203 ms/op 0.93
BLS verifyMultipleSignatures 32 - blst 5.8748 ms/op 6.9366 ms/op 0.85
BLS verifyMultipleSignatures 64 - blst 10.858 ms/op 11.122 ms/op 0.98
BLS verifyMultipleSignatures 128 - blst 18.479 ms/op 17.933 ms/op 1.03
BLS deserializing 10000 signatures 724.92 ms/op 697.34 ms/op 1.04
BLS deserializing 100000 signatures 7.2667 s/op 7.2298 s/op 1.01
BLS verifyMultipleSignatures - same message - 3 - blst 905.72 us/op 1.1015 ms/op 0.82
BLS verifyMultipleSignatures - same message - 8 - blst 1.2655 ms/op 1.1840 ms/op 1.07
BLS verifyMultipleSignatures - same message - 32 - blst 1.8912 ms/op 1.8230 ms/op 1.04
BLS verifyMultipleSignatures - same message - 64 - blst 2.7338 ms/op 2.8011 ms/op 0.98
BLS verifyMultipleSignatures - same message - 128 - blst 4.5824 ms/op 4.8989 ms/op 0.94
BLS aggregatePubkeys 32 - blst 20.457 us/op 22.005 us/op 0.93
BLS aggregatePubkeys 128 - blst 72.530 us/op 76.488 us/op 0.95
notSeenSlots=1 numMissedVotes=1 numBadVotes=10 78.067 ms/op 77.844 ms/op 1.00
notSeenSlots=1 numMissedVotes=0 numBadVotes=4 59.991 ms/op 58.941 ms/op 1.02
notSeenSlots=2 numMissedVotes=1 numBadVotes=10 40.632 ms/op 40.060 ms/op 1.01
getSlashingsAndExits - default max 109.64 us/op 143.51 us/op 0.76
getSlashingsAndExits - 2k 459.60 us/op 386.24 us/op 1.19
proposeBlockBody type=full, size=empty 6.2966 ms/op 7.7443 ms/op 0.81
isKnown best case - 1 super set check 405.00 ns/op 629.00 ns/op 0.64
isKnown normal case - 2 super set checks 419.00 ns/op 763.00 ns/op 0.55
isKnown worse case - 16 super set checks 357.00 ns/op 815.00 ns/op 0.44
InMemoryCheckpointStateCache - add get delete 3.7910 us/op 4.1970 us/op 0.90
updateUnfinalizedPubkeys - updating 10 pubkeys 1.5434 ms/op 1.5945 ms/op 0.97
updateUnfinalizedPubkeys - updating 100 pubkeys 4.2965 ms/op 5.4536 ms/op 0.79
updateUnfinalizedPubkeys - updating 1000 pubkeys 68.279 ms/op 65.419 ms/op 1.04
validate api signedAggregateAndProof - struct 1.7501 ms/op 1.9236 ms/op 0.91
validate gossip signedAggregateAndProof - struct 1.7549 ms/op 1.7809 ms/op 0.99
batch validate gossip attestation - vc 640000 - chunk 32 150.09 us/op 172.99 us/op 0.87
batch validate gossip attestation - vc 640000 - chunk 64 119.89 us/op 143.38 us/op 0.84
batch validate gossip attestation - vc 640000 - chunk 128 112.08 us/op 130.23 us/op 0.86
batch validate gossip attestation - vc 640000 - chunk 256 106.24 us/op 124.52 us/op 0.85
pickEth1Vote - no votes 1.1010 ms/op 1.2952 ms/op 0.85
pickEth1Vote - max votes 6.8653 ms/op 9.0634 ms/op 0.76
pickEth1Vote - Eth1Data hashTreeRoot value x2048 14.720 ms/op 17.786 ms/op 0.83
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 25.049 ms/op 27.007 ms/op 0.93
pickEth1Vote - Eth1Data fastSerialize value x2048 471.93 us/op 610.27 us/op 0.77
pickEth1Vote - Eth1Data fastSerialize tree x2048 3.4658 ms/op 4.3980 ms/op 0.79
bytes32 toHexString 443.00 ns/op 685.00 ns/op 0.65
bytes32 Buffer.toString(hex) 249.00 ns/op 302.00 ns/op 0.82
bytes32 Buffer.toString(hex) from Uint8Array 399.00 ns/op 523.00 ns/op 0.76
bytes32 Buffer.toString(hex) + 0x 251.00 ns/op 310.00 ns/op 0.81
Object access 1 prop 0.14200 ns/op 0.20800 ns/op 0.68
Map access 1 prop 0.13500 ns/op 0.15700 ns/op 0.86
Object get x1000 6.4380 ns/op 7.1070 ns/op 0.91
Map get x1000 6.4880 ns/op 7.6480 ns/op 0.85
Object set x1000 37.630 ns/op 48.064 ns/op 0.78
Map set x1000 27.070 ns/op 28.569 ns/op 0.95
Return object 10000 times 0.33080 ns/op 0.32130 ns/op 1.03
Throw Error 10000 times 3.7030 us/op 3.9245 us/op 0.94
toHex 169.47 ns/op 191.07 ns/op 0.89
Buffer.from 147.79 ns/op 171.29 ns/op 0.86
shared Buffer 95.254 ns/op 111.91 ns/op 0.85
fastMsgIdFn sha256 / 200 bytes 2.3950 us/op 2.5890 us/op 0.93
fastMsgIdFn h32 xxhash / 200 bytes 252.00 ns/op 311.00 ns/op 0.81
fastMsgIdFn h64 xxhash / 200 bytes 284.00 ns/op 303.00 ns/op 0.94
fastMsgIdFn sha256 / 1000 bytes 7.7050 us/op 8.3090 us/op 0.93
fastMsgIdFn h32 xxhash / 1000 bytes 387.00 ns/op 446.00 ns/op 0.87
fastMsgIdFn h64 xxhash / 1000 bytes 359.00 ns/op 387.00 ns/op 0.93
fastMsgIdFn sha256 / 10000 bytes 68.478 us/op 73.349 us/op 0.93
fastMsgIdFn h32 xxhash / 10000 bytes 1.9230 us/op 2.0520 us/op 0.94
fastMsgIdFn h64 xxhash / 10000 bytes 1.2950 us/op 1.3330 us/op 0.97
send data - 1000 256B messages 12.835 ms/op 15.425 ms/op 0.83
send data - 1000 512B messages 17.854 ms/op 20.121 ms/op 0.89
send data - 1000 1024B messages 27.024 ms/op 29.612 ms/op 0.91
send data - 1000 1200B messages 25.206 ms/op 27.503 ms/op 0.92
send data - 1000 2048B messages 33.239 ms/op 34.642 ms/op 0.96
send data - 1000 4096B messages 30.899 ms/op 32.127 ms/op 0.96
send data - 1000 16384B messages 73.956 ms/op 79.678 ms/op 0.93
send data - 1000 65536B messages 228.83 ms/op 236.58 ms/op 0.97
enrSubnets - fastDeserialize 64 bits 1.2610 us/op 1.3160 us/op 0.96
enrSubnets - ssz BitVector 64 bits 391.00 ns/op 452.00 ns/op 0.87
enrSubnets - fastDeserialize 4 bits 158.00 ns/op 186.00 ns/op 0.85
enrSubnets - ssz BitVector 4 bits 400.00 ns/op 464.00 ns/op 0.86
prioritizePeers score -10:0 att 32-0.1 sync 2-0 178.57 us/op 177.71 us/op 1.00
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 201.03 us/op 232.98 us/op 0.86
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 265.99 us/op 351.90 us/op 0.76
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 460.63 us/op 524.77 us/op 0.88
prioritizePeers score 0:0 att 64-1 sync 4-1 822.86 us/op 934.84 us/op 0.88
array of 16000 items push then shift 1.7602 us/op 1.7718 us/op 0.99
LinkedList of 16000 items push then shift 8.0770 ns/op 8.4690 ns/op 0.95
array of 16000 items push then pop 132.23 ns/op 143.39 ns/op 0.92
LinkedList of 16000 items push then pop 7.7000 ns/op 8.0260 ns/op 0.96
array of 24000 items push then shift 2.5425 us/op 2.6293 us/op 0.97
LinkedList of 24000 items push then shift 8.4980 ns/op 8.0790 ns/op 1.05
array of 24000 items push then pop 185.77 ns/op 186.62 ns/op 1.00
LinkedList of 24000 items push then pop 7.7100 ns/op 7.8020 ns/op 0.99
intersect bitArray bitLen 8 6.7850 ns/op 6.7130 ns/op 1.01
intersect array and set length 8 54.203 ns/op 56.580 ns/op 0.96
intersect bitArray bitLen 128 31.117 ns/op 31.262 ns/op 1.00
intersect array and set length 128 854.51 ns/op 891.02 ns/op 0.96
bitArray.getTrueBitIndexes() bitLen 128 2.5220 us/op 2.2070 us/op 1.14
bitArray.getTrueBitIndexes() bitLen 248 4.3650 us/op 4.2670 us/op 1.02
bitArray.getTrueBitIndexes() bitLen 512 9.2770 us/op 10.341 us/op 0.90
Buffer.concat 32 items 1.0030 us/op 1.0630 us/op 0.94
Uint8Array.set 32 items 1.4090 us/op 1.7670 us/op 0.80
Buffer.copy 1.6700 us/op 2.1580 us/op 0.77
Uint8Array.set - with subarray 2.7610 us/op 3.6500 us/op 0.76
Uint8Array.set - without subarray 1.6090 us/op 1.8400 us/op 0.87
getUint32 - dataview 280.00 ns/op 322.00 ns/op 0.87
getUint32 - manual 239.00 ns/op 279.00 ns/op 0.86
Set add up to 64 items then delete first 2.4070 us/op 3.0391 us/op 0.79
OrderedSet add up to 64 items then delete first 3.6215 us/op 4.6066 us/op 0.79
Set add up to 64 items then delete last 2.7216 us/op 3.2731 us/op 0.83
OrderedSet add up to 64 items then delete last 4.3266 us/op 5.2249 us/op 0.83
Set add up to 64 items then delete middle 2.9004 us/op 3.3645 us/op 0.86
OrderedSet add up to 64 items then delete middle 5.8776 us/op 7.0069 us/op 0.84
Set add up to 128 items then delete first 5.8584 us/op 7.2213 us/op 0.81
OrderedSet add up to 128 items then delete first 8.2572 us/op 12.323 us/op 0.67
Set add up to 128 items then delete last 5.7398 us/op 7.2096 us/op 0.80
OrderedSet add up to 128 items then delete last 8.9361 us/op 10.607 us/op 0.84
Set add up to 128 items then delete middle 5.9924 us/op 6.5897 us/op 0.91
OrderedSet add up to 128 items then delete middle 15.305 us/op 17.277 us/op 0.89
Set add up to 256 items then delete first 11.576 us/op 12.972 us/op 0.89
OrderedSet add up to 256 items then delete first 17.710 us/op 19.595 us/op 0.90
Set add up to 256 items then delete last 12.340 us/op 11.484 us/op 1.07
OrderedSet add up to 256 items then delete last 18.216 us/op 17.774 us/op 1.02
Set add up to 256 items then delete middle 11.782 us/op 12.202 us/op 0.97
OrderedSet add up to 256 items then delete middle 47.983 us/op 50.190 us/op 0.96
transfer serialized Status (84 B) 1.4360 us/op 1.4280 us/op 1.01
copy serialized Status (84 B) 1.2430 us/op 1.2920 us/op 0.96
transfer serialized SignedVoluntaryExit (112 B) 1.4810 us/op 1.5410 us/op 0.96
copy serialized SignedVoluntaryExit (112 B) 1.3090 us/op 1.3460 us/op 0.97
transfer serialized ProposerSlashing (416 B) 1.6730 us/op 1.7710 us/op 0.94
copy serialized ProposerSlashing (416 B) 1.6580 us/op 1.8660 us/op 0.89
transfer serialized Attestation (485 B) 1.8350 us/op 1.8200 us/op 1.01
copy serialized Attestation (485 B) 1.9960 us/op 1.8430 us/op 1.08
transfer serialized AttesterSlashing (33232 B) 1.8240 us/op 1.8310 us/op 1.00
copy serialized AttesterSlashing (33232 B) 5.8380 us/op 6.3230 us/op 0.92
transfer serialized Small SignedBeaconBlock (128000 B) 2.8070 us/op 2.5660 us/op 1.09
copy serialized Small SignedBeaconBlock (128000 B) 17.540 us/op 20.631 us/op 0.85
transfer serialized Avg SignedBeaconBlock (200000 B) 4.0270 us/op 2.9840 us/op 1.35
copy serialized Avg SignedBeaconBlock (200000 B) 33.652 us/op 33.559 us/op 1.00
transfer serialized BlobsSidecar (524380 B) 4.5850 us/op 3.3430 us/op 1.37
copy serialized BlobsSidecar (524380 B) 196.30 us/op 90.240 us/op 2.18
transfer serialized Big SignedBeaconBlock (1000000 B) 8.2980 us/op 3.3380 us/op 2.49
copy serialized Big SignedBeaconBlock (1000000 B) 314.84 us/op 174.70 us/op 1.80
pass gossip attestations to forkchoice per slot 3.2327 ms/op 3.0905 ms/op 1.05
forkChoice updateHead vc 100000 bc 64 eq 0 556.82 us/op 618.07 us/op 0.90
forkChoice updateHead vc 600000 bc 64 eq 0 4.6271 ms/op 3.8137 ms/op 1.21
forkChoice updateHead vc 1000000 bc 64 eq 0 6.1754 ms/op 5.8579 ms/op 1.05
forkChoice updateHead vc 600000 bc 320 eq 0 4.0183 ms/op 3.6566 ms/op 1.10
forkChoice updateHead vc 600000 bc 1200 eq 0 4.0106 ms/op 3.6498 ms/op 1.10
forkChoice updateHead vc 600000 bc 7200 eq 0 4.4407 ms/op 5.3050 ms/op 0.84
forkChoice updateHead vc 600000 bc 64 eq 1000 11.461 ms/op 12.482 ms/op 0.92
forkChoice updateHead vc 600000 bc 64 eq 10000 11.641 ms/op 12.271 ms/op 0.95
forkChoice updateHead vc 600000 bc 64 eq 300000 18.051 ms/op 23.995 ms/op 0.75
computeDeltas 500000 validators 300 proto nodes 3.9887 ms/op 4.2318 ms/op 0.94
computeDeltas 500000 validators 1200 proto nodes 4.1949 ms/op 4.4475 ms/op 0.94
computeDeltas 500000 validators 7200 proto nodes 4.5053 ms/op 4.6504 ms/op 0.97
computeDeltas 750000 validators 300 proto nodes 6.4630 ms/op 7.7081 ms/op 0.84
computeDeltas 750000 validators 1200 proto nodes 6.3341 ms/op 7.3604 ms/op 0.86
computeDeltas 750000 validators 7200 proto nodes 6.7963 ms/op 7.4995 ms/op 0.91
computeDeltas 1400000 validators 300 proto nodes 12.707 ms/op 12.589 ms/op 1.01
computeDeltas 1400000 validators 1200 proto nodes 11.916 ms/op 12.562 ms/op 0.95
computeDeltas 1400000 validators 7200 proto nodes 12.077 ms/op 12.818 ms/op 0.94
computeDeltas 2100000 validators 300 proto nodes 18.930 ms/op 19.283 ms/op 0.98
computeDeltas 2100000 validators 1200 proto nodes 18.081 ms/op 18.749 ms/op 0.96
computeDeltas 2100000 validators 7200 proto nodes 17.478 ms/op 17.583 ms/op 0.99
altair processAttestation - 250000 vs - 7PWei normalcase 2.5820 ms/op 1.8844 ms/op 1.37
altair processAttestation - 250000 vs - 7PWei worstcase 3.4223 ms/op 3.0727 ms/op 1.11
altair processAttestation - setStatus - 1/6 committees join 148.67 us/op 101.70 us/op 1.46
altair processAttestation - setStatus - 1/3 committees join 233.17 us/op 235.00 us/op 0.99
altair processAttestation - setStatus - 1/2 committees join 305.08 us/op 352.44 us/op 0.87
altair processAttestation - setStatus - 2/3 committees join 401.54 us/op 450.49 us/op 0.89
altair processAttestation - setStatus - 4/5 committees join 619.35 us/op 656.32 us/op 0.94
altair processAttestation - setStatus - 100% committees join 736.83 us/op 854.94 us/op 0.86
altair processBlock - 250000 vs - 7PWei normalcase 8.5185 ms/op 6.6742 ms/op 1.28
altair processBlock - 250000 vs - 7PWei normalcase hashState 30.712 ms/op 35.947 ms/op 0.85
altair processBlock - 250000 vs - 7PWei worstcase 41.549 ms/op 47.348 ms/op 0.88
altair processBlock - 250000 vs - 7PWei worstcase hashState 80.961 ms/op 108.19 ms/op 0.75
phase0 processBlock - 250000 vs - 7PWei normalcase 3.3391 ms/op 3.4151 ms/op 0.98
phase0 processBlock - 250000 vs - 7PWei worstcase 30.582 ms/op 36.032 ms/op 0.85
altair processEth1Data - 250000 vs - 7PWei normalcase 533.14 us/op 678.75 us/op 0.79
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 7.0280 us/op 10.451 us/op 0.67
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 48.938 us/op 50.228 us/op 0.97
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 11.143 us/op 17.566 us/op 0.63
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 8.5260 us/op 11.774 us/op 0.72
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 182.31 us/op 183.43 us/op 0.99
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 1.3747 ms/op 1.7031 ms/op 0.81
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 1.7253 ms/op 2.6780 ms/op 0.64
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 1.6894 ms/op 2.6434 ms/op 0.64
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 4.8531 ms/op 8.4853 ms/op 0.57
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 2.0610 ms/op 2.3037 ms/op 0.89
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 4.7654 ms/op 6.1309 ms/op 0.78
Tree 40 250000 create 354.22 ms/op 544.34 ms/op 0.65
Tree 40 250000 get(125000) 163.13 ns/op 249.06 ns/op 0.66
Tree 40 250000 set(125000) 930.60 ns/op 1.4101 us/op 0.66
Tree 40 250000 toArray() 23.376 ms/op 26.994 ms/op 0.87
Tree 40 250000 iterate all - toArray() + loop 23.756 ms/op 26.904 ms/op 0.88
Tree 40 250000 iterate all - get(i) 66.073 ms/op 79.074 ms/op 0.84
Array 250000 create 4.3336 ms/op 4.7643 ms/op 0.91
Array 250000 clone - spread 3.5650 ms/op 4.1554 ms/op 0.86
Array 250000 get(125000) 0.49800 ns/op 0.55000 ns/op 0.91
Array 250000 set(125000) 0.55300 ns/op 0.62900 ns/op 0.88
Array 250000 iterate all - loop 129.70 us/op 167.14 us/op 0.78
phase0 afterProcessEpoch - 250000 vs - 7PWei 123.52 ms/op 133.02 ms/op 0.93
Array.fill - length 1000000 4.3964 ms/op 8.9296 ms/op 0.49
Array push - length 1000000 24.353 ms/op 63.623 ms/op 0.38
Array.get 0.32157 ns/op 0.39023 ns/op 0.82
Uint8Array.get 0.49951 ns/op 0.63510 ns/op 0.79
phase0 beforeProcessEpoch - 250000 vs - 7PWei 27.145 ms/op 34.205 ms/op 0.79
altair processEpoch - mainnet_e81889 424.12 ms/op 536.93 ms/op 0.79
mainnet_e81889 - altair beforeProcessEpoch 22.612 ms/op 38.521 ms/op 0.59
mainnet_e81889 - altair processJustificationAndFinalization 24.162 us/op 33.230 us/op 0.73
mainnet_e81889 - altair processInactivityUpdates 8.7461 ms/op 11.125 ms/op 0.79
mainnet_e81889 - altair processRewardsAndPenalties 63.435 ms/op 62.127 ms/op 1.02
mainnet_e81889 - altair processRegistryUpdates 5.6910 us/op 5.0650 us/op 1.12
mainnet_e81889 - altair processSlashings 881.00 ns/op 1.1460 us/op 0.77
mainnet_e81889 - altair processEth1DataReset 605.00 ns/op 931.00 ns/op 0.65
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.7343 ms/op 3.0305 ms/op 0.90
mainnet_e81889 - altair processSlashingsReset 4.9510 us/op 8.6610 us/op 0.57
mainnet_e81889 - altair processRandaoMixesReset 7.0300 us/op 11.607 us/op 0.61
mainnet_e81889 - altair processHistoricalRootsUpdate 989.00 ns/op 1.7460 us/op 0.57
mainnet_e81889 - altair processParticipationFlagUpdates 4.8440 us/op 7.5050 us/op 0.65
mainnet_e81889 - altair processSyncCommitteeUpdates 859.00 ns/op 1.5010 us/op 0.57
mainnet_e81889 - altair afterProcessEpoch 117.44 ms/op 155.45 ms/op 0.76
capella processEpoch - mainnet_e217614 1.4324 s/op 2.2566 s/op 0.63
mainnet_e217614 - capella beforeProcessEpoch 91.767 ms/op 103.24 ms/op 0.89
mainnet_e217614 - capella processJustificationAndFinalization 23.529 us/op 39.977 us/op 0.59
mainnet_e217614 - capella processInactivityUpdates 23.115 ms/op 28.251 ms/op 0.82
mainnet_e217614 - capella processRewardsAndPenalties 282.59 ms/op 319.79 ms/op 0.88
mainnet_e217614 - capella processRegistryUpdates 20.971 us/op 20.583 us/op 1.02
mainnet_e217614 - capella processSlashings 899.00 ns/op 1.5940 us/op 0.56
mainnet_e217614 - capella processEth1DataReset 737.00 ns/op 1.0800 us/op 0.68
mainnet_e217614 - capella processEffectiveBalanceUpdates 18.807 ms/op 20.929 ms/op 0.90
mainnet_e217614 - capella processSlashingsReset 6.9080 us/op 7.6460 us/op 0.90
mainnet_e217614 - capella processRandaoMixesReset 7.6700 us/op 14.611 us/op 0.52
mainnet_e217614 - capella processHistoricalRootsUpdate 723.00 ns/op 2.7440 us/op 0.26
mainnet_e217614 - capella processParticipationFlagUpdates 3.0330 us/op 7.8320 us/op 0.39
mainnet_e217614 - capella afterProcessEpoch 271.87 ms/op 356.34 ms/op 0.76
phase0 processEpoch - mainnet_e58758 450.62 ms/op 535.50 ms/op 0.84
mainnet_e58758 - phase0 beforeProcessEpoch 103.99 ms/op 121.37 ms/op 0.86
mainnet_e58758 - phase0 processJustificationAndFinalization 25.217 us/op 36.523 us/op 0.69
mainnet_e58758 - phase0 processRewardsAndPenalties 35.647 ms/op 42.942 ms/op 0.83
mainnet_e58758 - phase0 processRegistryUpdates 10.394 us/op 15.604 us/op 0.67
mainnet_e58758 - phase0 processSlashings 536.00 ns/op 925.00 ns/op 0.58
mainnet_e58758 - phase0 processEth1DataReset 435.00 ns/op 1.0690 us/op 0.41
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.7869 ms/op 2.0448 ms/op 0.87
mainnet_e58758 - phase0 processSlashingsReset 3.8370 us/op 13.080 us/op 0.29
mainnet_e58758 - phase0 processRandaoMixesReset 7.0950 us/op 17.792 us/op 0.40
mainnet_e58758 - phase0 processHistoricalRootsUpdate 990.00 ns/op 1.5560 us/op 0.64
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.5810 us/op 8.0000 us/op 0.57
mainnet_e58758 - phase0 afterProcessEpoch 91.824 ms/op 122.09 ms/op 0.75
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.7326 ms/op 2.3308 ms/op 0.74
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 3.7030 ms/op 3.5034 ms/op 1.06
altair processInactivityUpdates - 250000 normalcase 23.251 ms/op 28.109 ms/op 0.83
altair processInactivityUpdates - 250000 worstcase 18.905 ms/op 26.714 ms/op 0.71
phase0 processRegistryUpdates - 250000 normalcase 9.1260 us/op 18.825 us/op 0.48
phase0 processRegistryUpdates - 250000 badcase_full_deposits 352.69 us/op 431.15 us/op 0.82
phase0 processRegistryUpdates - 250000 worstcase 0.5 135.62 ms/op 186.56 ms/op 0.73
altair processRewardsAndPenalties - 250000 normalcase 46.588 ms/op 56.661 ms/op 0.82
altair processRewardsAndPenalties - 250000 worstcase 47.401 ms/op 57.215 ms/op 0.83
phase0 getAttestationDeltas - 250000 normalcase 10.348 ms/op 12.956 ms/op 0.80
phase0 getAttestationDeltas - 250000 worstcase 8.2730 ms/op 9.6158 ms/op 0.86
phase0 processSlashings - 250000 worstcase 105.47 us/op 127.36 us/op 0.83
altair processSyncCommitteeUpdates - 250000 159.70 ms/op 185.89 ms/op 0.86
BeaconState.hashTreeRoot - No change 356.00 ns/op 423.00 ns/op 0.84
BeaconState.hashTreeRoot - 1 full validator 156.91 us/op 140.12 us/op 1.12
BeaconState.hashTreeRoot - 32 full validator 1.5026 ms/op 1.5895 ms/op 0.95
BeaconState.hashTreeRoot - 512 full validator 14.629 ms/op 18.574 ms/op 0.79
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 173.09 us/op 287.75 us/op 0.60
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 2.3258 ms/op 3.1773 ms/op 0.73
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 33.100 ms/op 37.254 ms/op 0.89
BeaconState.hashTreeRoot - 1 balances 94.013 us/op 155.09 us/op 0.61
BeaconState.hashTreeRoot - 32 balances 930.41 us/op 1.5585 ms/op 0.60
BeaconState.hashTreeRoot - 512 balances 11.240 ms/op 13.291 ms/op 0.85
BeaconState.hashTreeRoot - 250000 balances 229.65 ms/op 331.16 ms/op 0.69
aggregationBits - 2048 els - zipIndexesInBitList 28.169 us/op 47.475 us/op 0.59
byteArrayEquals 32 59.478 ns/op 75.946 ns/op 0.78
Buffer.compare 32 19.364 ns/op 24.263 ns/op 0.80
byteArrayEquals 1024 1.8139 us/op 2.4135 us/op 0.75
Buffer.compare 1024 28.518 ns/op 31.331 ns/op 0.91
byteArrayEquals 16384 28.643 us/op 35.043 us/op 0.82
Buffer.compare 16384 221.06 ns/op 262.56 ns/op 0.84
byteArrayEquals 123687377 215.19 ms/op 260.59 ms/op 0.83
Buffer.compare 123687377 12.453 ms/op 14.292 ms/op 0.87
byteArrayEquals 32 - diff last byte 64.737 ns/op 78.835 ns/op 0.82
Buffer.compare 32 - diff last byte 20.059 ns/op 29.238 ns/op 0.69
byteArrayEquals 1024 - diff last byte 1.8348 us/op 2.3001 us/op 0.80
Buffer.compare 1024 - diff last byte 31.972 ns/op 42.527 ns/op 0.75
byteArrayEquals 16384 - diff last byte 30.744 us/op 33.951 us/op 0.91
Buffer.compare 16384 - diff last byte 264.17 ns/op 332.30 ns/op 0.79
byteArrayEquals 123687377 - diff last byte 233.21 ms/op 261.19 ms/op 0.89
Buffer.compare 123687377 - diff last byte 12.744 ms/op 10.329 ms/op 1.23
byteArrayEquals 32 - random bytes 6.7760 ns/op 7.6630 ns/op 0.88
Buffer.compare 32 - random bytes 21.850 ns/op 22.203 ns/op 0.98
byteArrayEquals 1024 - random bytes 6.0190 ns/op 6.1140 ns/op 0.98
Buffer.compare 1024 - random bytes 20.532 ns/op 21.113 ns/op 0.97
byteArrayEquals 16384 - random bytes 6.0280 ns/op 7.0970 ns/op 0.85
Buffer.compare 16384 - random bytes 21.088 ns/op 21.497 ns/op 0.98
byteArrayEquals 123687377 - random bytes 7.5700 ns/op 8.4000 ns/op 0.90
Buffer.compare 123687377 - random bytes 21.640 ns/op 24.180 ns/op 0.89
regular array get 100000 times 48.473 us/op 59.113 us/op 0.82
wrappedArray get 100000 times 36.757 us/op 44.780 us/op 0.82
arrayWithProxy get 100000 times 14.578 ms/op 15.978 ms/op 0.91
ssz.Root.equals 48.468 ns/op 54.089 ns/op 0.90
byteArrayEquals 47.567 ns/op 54.947 ns/op 0.87
Buffer.compare 11.562 ns/op 12.978 ns/op 0.89
shuffle list - 16384 els 7.1059 ms/op 8.0369 ms/op 0.88
shuffle list - 250000 els 108.68 ms/op 121.33 ms/op 0.90
processSlot - 1 slots 19.451 us/op 17.062 us/op 1.14
processSlot - 32 slots 3.6351 ms/op 3.5118 ms/op 1.04
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 43.482 ms/op 43.407 ms/op 1.00
getCommitteeAssignments - req 1 vs - 250000 vc 2.2610 ms/op 2.6905 ms/op 0.84
getCommitteeAssignments - req 100 vs - 250000 vc 4.3638 ms/op 5.3951 ms/op 0.81
getCommitteeAssignments - req 1000 vs - 250000 vc 4.7759 ms/op 5.6410 ms/op 0.85
findModifiedValidators - 10000 modified validators 360.08 ms/op 417.68 ms/op 0.86
findModifiedValidators - 1000 modified validators 209.59 ms/op 277.09 ms/op 0.76
findModifiedValidators - 100 modified validators 177.00 ms/op 306.05 ms/op 0.58
findModifiedValidators - 10 modified validators 196.30 ms/op 243.98 ms/op 0.80
findModifiedValidators - 1 modified validators 158.25 ms/op 249.30 ms/op 0.63
findModifiedValidators - no difference 153.17 ms/op 232.73 ms/op 0.66
compare ViewDUs 3.2994 s/op 4.2862 s/op 0.77
compare each validator Uint8Array 1.6438 s/op 1.6307 s/op 1.01
compare ViewDU to Uint8Array 1.0924 s/op 1.6861 s/op 0.65
migrate state 1000000 validators, 24 modified, 0 new 951.88 ms/op 1.2479 s/op 0.76
migrate state 1000000 validators, 1700 modified, 1000 new 1.2224 s/op 1.7961 s/op 0.68
migrate state 1000000 validators, 3400 modified, 2000 new 1.4864 s/op 1.7993 s/op 0.83
migrate state 1500000 validators, 24 modified, 0 new 1.1415 s/op 1.1705 s/op 0.98
migrate state 1500000 validators, 1700 modified, 1000 new 1.4525 s/op 1.4496 s/op 1.00
migrate state 1500000 validators, 3400 modified, 2000 new 1.4599 s/op 1.6513 s/op 0.88
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 5.0500 ns/op 5.9200 ns/op 0.85
state getBlockRootAtSlot - 250000 vs - 7PWei 483.61 ns/op 676.79 ns/op 0.71
computeProposers - vc 250000 7.4694 ms/op 9.1278 ms/op 0.82
computeEpochShuffling - vc 250000 101.80 ms/op 117.77 ms/op 0.86
getNextSyncCommittee - vc 250000 126.57 ms/op 153.29 ms/op 0.83
computeSigningRoot for AttestationData 18.323 us/op 25.422 us/op 0.72
hash AttestationData serialized data then Buffer.toString(base64) 1.6656 us/op 1.9145 us/op 0.87
toHexString serialized data 946.03 ns/op 1.1226 us/op 0.84
Buffer.toString(base64) 193.41 ns/op 236.84 ns/op 0.82
nodejs block root to RootHex using toHex 180.90 ns/op 206.29 ns/op 0.88
nodejs block root to RootHex using toRootHex 101.53 ns/op 115.95 ns/op 0.88
browser block root to RootHex using the deprecated toHexString 246.54 ns/op 306.16 ns/op 0.81
browser block root to RootHex using toHex 183.79 ns/op 238.16 ns/op 0.77
browser block root to RootHex using toRootHex 172.76 ns/op 189.35 ns/op 0.91

by benchmarkbot/action

@wemeetagain
Copy link
Member

What is the feature parity with our existing linter rules?

@nflaig
Copy link
Member

nflaig commented Oct 1, 2024

What is the feature parity with our existing linter rules?

How can we determine that, I guess we would have to break every single eslint rule and see if the new rules catch the issue as well?

Do people run yarn lint locally or just rely on the extension to show errors pretty much instantly? I don't find myself running a full lint from CLI a lot

@nazarhussain
Copy link
Contributor Author

nazarhussain commented Oct 1, 2024

What is the feature parity with our existing linter rules?

For that we need to rely on community and our own testing. There is biome migrate which is designed to handle eslint and prettier migration. Most of rules migration was done automatically. Rest I went over each eslint rule one by one manually to match corresponding in biomejs.

A few of biome recommended rules are turned off to match to our styling e.g. noForEach. And my plan is to turned these on one by one specially in suspicious and correctness category.

You can also check https://biomejs.dev/linter/rules-sources/

@nazarhussain
Copy link
Contributor Author

Do people run yarn lint locally or just rely on the extension to show errors pretty much instantly? I don't find myself running a full lint from CLI a lot

Not sure about others, I heavily rely on the IDE feedback and while 3-4 projects open in the VSCode at the time, I often have to restart the Eslint server in our project, specially when inter-package dependencies are changed.

image

When I am about to finish some changes, I run full lint as well which is faster than waiting for the CI.

@nflaig
Copy link
Member

nflaig commented Oct 1, 2024

I often have to restart the Eslint server in our project, specially when inter-package dependencies are changed.

yeah this one is annoying, this mostly happens if I change branches

@nazarhussain
Copy link
Contributor Author

And how easy is it to have custom rules with biomejs like we have here

Currently we can't! But that's a topic to be covered soon. Biome plugin support #2463. The proposal for that is up here RFC: Biome Plugins Proposal #1762.

What community is doing right now is to have biomejs as standard and eslint only for custom rules to get both performance and customization.

Keeping that list in focus, I don't think we need any custom rules at the moment or near future. There are tons of beneficial rules which are enabled with recommended settings under the hood already.

@@ -225,7 +224,7 @@ export type Endpoints = {
>;
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
Copy link
Member

@nflaig nflaig Oct 8, 2024

Choose a reason for hiding this comment

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

would be good to add an explanation here (and in all other places), otherwise we set a bad precedence

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There should be, but as the earlier code comments didn't had that so we don't have it for now.

It's good that biome enforce to provide some explanation if you disable any rule. I would suggest to add those explanations later as someone touches the code. Each occurrence may have different reason and I can't do it globally for all files.

@@ -289,7 +288,6 @@ export function getTypeByEvent(config: ChainForkConfig): {[K in EventType]: Type
};
}

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
Copy link
Member

Choose a reason for hiding this comment

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

so return types don't need to be explicit anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently for that rule, biomejs didn't differentiate between functions and anonymous functions. So we get over a thousand errors in our codebase for anonymous functions. I hope they will extend this rule in upcoming release and will bring it to error level.

https://biomejs.dev/linter/rules/use-explicit-function-return-type

Copy link
Member

Choose a reason for hiding this comment

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

this one is sad, hoping this gets resolved quickly

@@ -198,8 +198,7 @@ export class HttpClient implements IHttpClient {
this.logger?.debug("Requesting fallback URL", {routeId, baseUrl: printableUrl, score: this.urlsScore[i]});
}

// eslint-disable-next-line @typescript-eslint/naming-convention
Copy link
Member

Choose a reason for hiding this comment

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

naming convention no longer covered?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is disabled for certain files to fix these later to have consistent naming convention across packages.

https://github.com/ChainSafe/lodestar/blob/nh%2Fbiomejs/biome.jsonc#L297-L298

Copy link
Member

Choose a reason for hiding this comment

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

Not ideal that we disable this for the whole file if there are just 1-2 lines affected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ultimately all disabled overrides will be removed, one by one, and will be much better to review those changes.

@@ -20,11 +19,8 @@ export type EmptyRequest = Record<never, never>;
export type EmptyResponseData = void;
export type EmptyMeta = void;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Copy link
Member

Choose a reason for hiding this comment

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

any is allowed now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this rule is disabled for all files in packages/api/src/utils/**/*.ts, as there are a lot of occurrences to disable per line.

Copy link
Member

Choose a reason for hiding this comment

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

we disabled it per line before, why should that change now?

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 didn't went through line by line manually for such rules, searched through and if there I found more occurrences of disabled rules in single file added those as override. Considering that all those overrides will be removed very soon.

@@ -44,7 +42,7 @@ function aggregate_verify(input: {pubkeys: string[]; messages: string[]; signatu
pubkeys.map((pk) => PublicKey.fromHex(pk)),
Signature.fromHex(signature)
);
} catch (e) {
Copy link
Member

Choose a reason for hiding this comment

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

it might be useful to have the error for debugging purposes, maybe we can rename _e to fix lint error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we need and use it, we can add it then.

Copy link
Member

Choose a reason for hiding this comment

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

if you have a running process and attach a debugger you can't just change it on the fly

Copy link
Contributor Author

@nazarhussain nazarhussain Oct 8, 2024

Choose a reason for hiding this comment

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

I usually don't debug a process on the fly, if I had to debug a specific code and specific code flow, will work on it.

But if everyone else feels the same we can keep add unused variables for exceptions. Doing it in a separate PR will much ideal to track for future that we explicitly added. it. @wemeetagain

Copy link
Member

Choose a reason for hiding this comment

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

I agree with @nflaig we should avoid code updates in this PR, please rename error with underscore on unused error variables.

@@ -3,7 +3,6 @@ import {describe, expect, it} from "vitest";
import {ForkName, SLOTS_PER_EPOCH} from "@lodestar/params";
import {ssz} from "@lodestar/types";
import {LodestarError} from "@lodestar/utils";
// eslint-disable-next-line import/no-relative-packages
Copy link
Member

Choose a reason for hiding this comment

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

we need ot be careful with those imports as it would break production code if done there, the lint rule seems important

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 added an issue to bring this behavior back. #7137

"linter": {
"rules": {
"suspicious": {
"noExplicitAny": "off"
Copy link
Member

Choose a reason for hiding this comment

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

can't this be applied on per line basis?

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 can disable by single line, but for these files we are overriding there are a lot of places where any is used.

Unfortunately the only way to disable by files is these overrides, we can't do it with code comments.

Copy link
Member

Choose a reason for hiding this comment

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

I see a lot of files in the diff where it's just a single line in a file where the eslint ignore is removed but no new ignore added, see #7108 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those files would have been added in this override list. As few files were using single line comments, but had a lot of occurrences of same disable rules.

Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

There seems to be quite a few short comings but seems like biomejs is gonna address them sooner or later.

I generally go by "if it ain't broke, don't fix it" and for me eslint isn't really broken but I can see why the speed up increase is a nice-to-have.

Don't feel strongly about it though if others in the team are fine with the short comings and like the extra performance as a trade-off.

Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

Overall this looks good. Hoping that they fix the last remaining rules we need.

}
throw e;
}),
chain
Copy link
Member

Choose a reason for hiding this comment

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

why did this formatting get updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a subtle difference between Prettier and Biome formatter. specially calling function chaining with anonymous functions. These formatting changes are because of it.

See the diff interactively on following link

@@ -44,6 +44,7 @@ function getPeerState(status: StreamStatus): routes.node.PeerState {
case "closing":
return "disconnecting";
case "closed":
return "disconnected";
Copy link
Member

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Such switch -> cases are considered useless. One may left those mistakenly without providing their body, so either to have a case body or remove such cases.

https://biomejs.dev/linter/rules/no-useless-switch-case/

@@ -396,7 +396,9 @@ export class NetworkProcessor {
if (item) {
this.gossipTopicConcurrency[topic] += numMessages;
this.processPendingGossipsubMessage(item)
.finally(() => (this.gossipTopicConcurrency[topic] -= numMessages))
.finally(() => {
Copy link
Member

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As described above.

@@ -44,7 +42,7 @@ function aggregate_verify(input: {pubkeys: string[]; messages: string[]; signatu
pubkeys.map((pk) => PublicKey.fromHex(pk)),
Signature.fromHex(signature)
);
} catch (e) {
Copy link
Member

Choose a reason for hiding this comment

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

I agree with @nflaig we should avoid code updates in this PR, please rename error with underscore on unused error variables.

constructor(
readonly currentSlot: Slot,
public genesisTime = 0
genesisTime = 0
Copy link
Member

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To enforce consistent accessibility modifiers everywhere.

We can either enforce explicitly specifying for every attribute or skip it for public. In our codebase most of the scenario were already following later case, so use noPublic option for that rule.

https://biomejs.dev/linter/rules/use-consistent-member-accessibility/

packages/cli/docsgen/markdown.ts Outdated Show resolved Hide resolved
},
"globals": ["BigInt"]
},
"overrides": [
Copy link
Member

Choose a reason for hiding this comment

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

I tend to think we should not include any override here that is "temporary".
Things like noConsoleLog: off in cli is fine, but noExplicitAny shouldn't be here.
Instead we should maintain per-line overrides.

I would prefer this PR to NOT change how we manage overrides, rather we just want faster linting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Earlier we used disabling some rules on file level with code comments on top of the file.

In Biome we can't disable rules at file level with code comments, only way is to add such files in the overrides. Which I believe is better place as it gives more visibility to developers. The code comments just hide from sight once added.

@@ -289,7 +288,6 @@ export function getTypeByEvent(config: ChainForkConfig): {[K in EventType]: Type
};
}

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
Copy link
Member

Choose a reason for hiding this comment

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

this one is sad, hoping this gets resolved quickly

@nazarhussain
Copy link
Contributor Author

@wemeetagain Created a PR myself for Biome to have that feature soon. biomejs/biome#4233

@nazarhussain
Copy link
Contributor Author

@wemeetagain I had been investigating and found some weird behavior from eslint. e.g. We have that rule to enforce return type for functions.

"@typescript-eslint/explicit-function-return-type": ["error", {allowExpressions: true}],

But found a lot of occurrences in the code which is not been linted properly for that rule. For a lot of these cases I don't consider are expressions, so the definition of expression is not clear from the eslint perspective.

return function urlFormatter(args: Args) {


async getAttestationsRewards({epoch, validatorIds}) {

@nflaig
Copy link
Member

nflaig commented Oct 10, 2024

But found a lot of occurrences in the code which is not been linted properly for that rule.

those are all functions that are returned inside another function which has the return type declared

@nazarhussain
Copy link
Contributor Author

those are all functions that are returned inside another function which has the return type declared

That's what I explained above I don't consider a lot of these cases as expressions so allowExpresions options seems wage to me.

@nflaig
Copy link
Member

nflaig commented Oct 10, 2024

allowExpresions options seems wage to me.

I am not sure this rule is even evaluated for those, have you tried if you set allowExpresions to false? I would expect that there is still no error because return type is inferred from top-level return or interface

@nazarhussain
Copy link
Contributor Author

I am not sure this rule is even evaluated for those, have you tried if you set allowExpresions to false? I would expect that there is still no error because return type is inferred from top-level return or interface

Yes it's evaluated and consider all parameters of a function or an attribute of an object as an expression. So if any function is passed as arguments or any function passed to object attributes it skip error for these. I am not aligned with their definition of the expression in these cases.

@wemeetagain wemeetagain merged commit 5c359f9 into unstable Oct 10, 2024
20 checks passed
@wemeetagain wemeetagain deleted the nh/biomejs branch October 10, 2024 16:43
philknows pushed a commit that referenced this pull request Oct 18, 2024
* Replace eslint with biomejs

* Update the inclusion of word

* Fix the formatting

* Update the lint task to do all checks

* Update biome rules from eslint config

* Replace eslint with biomejs

* Update the inclusion of word

* Fix the formatting

* Update the lint task to do all checks

* Update biome rules from eslint config

* Fix all lint issues

* Fix formatting

* Add extension recomendation for vscode

* Enable recommended rules

* Enable rule noUselessSwitchCase

* Enable rule noUselessConstructor

* Fix the types

* Fix unit tests

* Enforce import extensions

* Update the cli command

* Enforce useConsistentMemberAccessibility

* Update rules

* Fix rules

* Upgrade biomejs to latest version

* Update the rules

* Update and format the config file

* Fix types break during merge

* Fix unused check

* Add comment for explicit-return-type

* Remove eslint file

* Add _e objects for empty catch blocks

* Update formatter config

* Fix formatting
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.23.0 🎉

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