node icon indicating copy to clipboard operation
node copied to clipboard

lib: prefer logical assignment

Open avivkeller opened this issue 1 year ago • 9 comments

Enforces https://eslint.org/docs/latest/rules/logical-assignment-operators


IMO logical assignment operators are more concise and readable than if/then and || statements. This way, we can do more in less code, while keeping the files readable.

avivkeller avatar Sep 21 '24 14:09 avivkeller

Codecov Report

Attention: Patch coverage is 97.08738% with 3 lines in your changes missing coverage. Please review.

Project coverage is 88.42%. Comparing base (bbdfeeb) to head (c9b98f4). Report is 365 commits behind head on main.

Files with missing lines Patch % Lines
lib/_http_server.js 75.00% 1 Missing :warning:
lib/internal/child_process.js 50.00% 0 Missing and 1 partial :warning:
lib/internal/test_runner/utils.js 0.00% 1 Missing :warning:
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #55044   +/-   ##
=======================================
  Coverage   88.41%   88.42%           
=======================================
  Files         652      652           
  Lines      186612   186531   -81     
  Branches    36062    35981   -81     
=======================================
- Hits       165001   164932   -69     
+ Misses      14885    14873   -12     
  Partials     6726     6726           
Files with missing lines Coverage Δ
lib/_http_agent.js 98.17% <100.00%> (-0.02%) :arrow_down:
lib/_http_client.js 97.96% <100.00%> (ø)
lib/_tls_common.js 97.43% <100.00%> (-0.02%) :arrow_down:
lib/_tls_wrap.js 93.38% <100.00%> (ø)
lib/assert.js 99.87% <100.00%> (ø)
lib/async_hooks.js 99.65% <100.00%> (ø)
lib/child_process.js 97.72% <100.00%> (-0.02%) :arrow_down:
lib/dgram.js 97.31% <100.00%> (-0.01%) :arrow_down:
lib/events.js 99.75% <100.00%> (-0.09%) :arrow_down:
lib/internal/assert.js 100.00% <100.00%> (ø)
... and 32 more

... and 37 files with indirect coverage changes

codecov[bot] avatar Sep 21 '24 15:09 codecov[bot]

CI: https://ci.nodejs.org/job/node-test-pull-request/62645/

nodejs-github-bot avatar Sep 21 '24 16:09 nodejs-github-bot

WIP until I develop a lint rule.

avivkeller avatar Sep 21 '24 23:09 avivkeller

@anonrig I enforced the logical-assignment-operators lint rule. Are you still blocking?

avivkeller avatar Sep 22 '24 00:09 avivkeller

74 files is almost impossible to review for me.

anonrig avatar Sep 22 '24 22:09 anonrig

@jasnell @trivikr @atlowChemi please rereview since the changes you approved are no longer the same.

anonrig avatar Sep 22 '24 22:09 anonrig

@RedYetiDev what is the motivation for this change, please add it to your description for reviewers

anonrig avatar Sep 22 '24 22:09 anonrig

@anonrig sorry for the little mistakes in this PR, i hope it's all good now. Thank you so much for your patience (everyone really)

avivkeller avatar Sep 22 '24 23:09 avivkeller

Okay. This should be A-OK now, could everyone have another look?

avivkeller avatar Sep 23 '24 00:09 avivkeller

Could someone restart the github CIs that failed to start?


@anonrig it's been a week, are you still blocking?

avivkeller avatar Oct 01 '24 20:10 avivkeller

CI: https://ci.nodejs.org/job/node-test-pull-request/62878/

nodejs-github-bot avatar Oct 01 '24 20:10 nodejs-github-bot

Can someone approve + CI so this can land after the most recent rebase?

avivkeller avatar Oct 08 '24 19:10 avivkeller

CI: https://ci.nodejs.org/job/node-test-pull-request/62996/

nodejs-github-bot avatar Oct 08 '24 19:10 nodejs-github-bot

Landed in 71785889c893a82f335e04a7e81c6ba08546a32e

nodejs-github-bot avatar Oct 09 '24 06:10 nodejs-github-bot

This commit does not land cleanly on v22.x-staging and will need manual backport in case we want it in v22.x.

ruyadorno avatar Nov 27 '24 06:11 ruyadorno