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

infra(unicorn): prefer-spread #2421

Merged
merged 9 commits into from
Oct 17, 2023
Merged

infra(unicorn): prefer-spread #2421

merged 9 commits into from
Oct 17, 2023

Conversation

Shinigami92
Copy link
Member

⚠️ #2418 needs to be merged first ⚠️

@Shinigami92 Shinigami92 added c: chore PR that doesn't affect the runtime behavior do NOT merge yet Do not merge this PR into the target branch yet labels Sep 23, 2023
@Shinigami92 Shinigami92 added this to the vAnytime milestone Sep 23, 2023
@Shinigami92 Shinigami92 requested a review from a team as a code owner September 23, 2023 21:50
@Shinigami92 Shinigami92 self-assigned this Sep 23, 2023
@codecov
Copy link

codecov bot commented Sep 23, 2023

Codecov Report

Merging #2421 (7674d33) into next (f3de0f6) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 7674d33 differs from pull request most recent head 85fbd2d. Consider uploading reports for the commit 85fbd2d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2421      +/-   ##
==========================================
- Coverage   99.59%   99.59%   -0.01%     
==========================================
  Files        2823     2823              
  Lines      255524   255509      -15     
  Branches     1105     1105              
==========================================
- Hits       254487   254466      -21     
- Misses       1009     1015       +6     
  Partials       28       28              
Files Coverage Δ
src/internal/merge.ts 100.00% <100.00%> (ø)
src/modules/color/index.ts 99.79% <100.00%> (ø)
src/modules/company/index.ts 100.00% <100.00%> (ø)
src/modules/finance/index.ts 100.00% <100.00%> (ø)
src/modules/helpers/index.ts 98.98% <100.00%> (ø)
src/modules/internet/index.ts 100.00% <100.00%> (ø)
src/modules/string/index.ts 100.00% <100.00%> (ø)
src/modules/system/index.ts 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

Copy link
Member

@ST-DDT ST-DDT left a comment

Choose a reason for hiding this comment

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

I'm not sure whether I like this change.
The spread operator does not always conveys the same intention. E.g. slice=clone, Array.from=set to array clone, ...

src/modules/color/index.ts Outdated Show resolved Hide resolved
@Shinigami92
Copy link
Member Author

I'm not sure whether I like this change. The spread operator does not always conveys the same intention. E.g. slice=clone, Array.from=set to array clone, ...

Uhm... the spread operator is literally for cloning?! 👀

@matthewmayer
Copy link
Contributor

I'm not sure whether I like this change. The spread operator does not always conveys the same intention. E.g. slice=clone, Array.from=set to array clone, ...

I agree this change seems a bit nitpicky. Javascript is not Python where "there should be one-- and preferably only one --obvious way to do it." and the spread operator isn't always the easiest to read.

Consistency is nice, but i think it can be disheartening for new contributors when they try to write some simple code and are immediately confronted with 1000 lint warnings. These kind of fixes also add a lot of churn when git blame is run and you are trying to spot the important changes.

@Shinigami92
Copy link
Member Author

Javascript is not Python where "there should be one-- and preferably only one --obvious way to do it." and the spread operator isn't always the easiest to read.

Instead of trying to explain each individual diff in this PR, I just point to the documentation and you can read about why the spread is preferred over outdated patterns here: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-spread.md

Consistency is nice, but i think it can be disheartening for new contributors when they try to write some simple code and are immediately confronted with 1000 lint warnings.

I always saw it the other way around: instead of getting reviewed by a human post-submitting the PR and then need to go to multiple feedback cycles, I instantly got feedback from eslint (an automatic tool that is not human-biased) and then can read the docs and even learn something about why something I wrote can be done in a better way.

These kind of fixes also add a lot of churn when git blame is run and you are trying to spot the important changes.

If you really really want to, I can introduce https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
But to be honest, who really cares...

@matthewmayer
Copy link
Contributor

matthewmayer commented Sep 24, 2023

instead of getting reviewed by a human post-submitting the PR and then need to go to multiple feedback cycles, I instantly got feedback from eslint

I don't really see much evidence of that happening though. Where PR reviews have multiple rounds of reviews it's normally about something like missing tests, or disagreement about parameter naming, which linting isn't going to affect.

@matthewmayer
Copy link
Contributor

Moreover these kind of frequent small changes often cause all pending PRs to need rebasing, further slowing down the acceptance of other PRs as well have to wait for the authors to fix the conflicts.

@matthewmayer
Copy link
Contributor

i think my overall point is that although linting = good it doesn't necessarily mean that more linting = better. I think there comes a point where the time spent

  • configuring more lint rules
  • making sure they aren't controversial,
  • making sure they interact correctly with other tools like prettier
  • rebasing unrelated PRs

Ends up outweighing the actual time and headache saving.

Is this the correct place to draw the line? Perhaps not, but i think there is a line to be drawn at some point where we say "OK we have enough linting rules now and anything else is just personal preference/unimportant".

@ST-DDT ST-DDT added the needs rebase There is a merge conflict label Sep 25, 2023
Base automatically changed from add-eslint-unicorn-dep to next October 6, 2023 21:14
@ST-DDT ST-DDT added s: needs decision Needs team/maintainer decision c: infra Changes to our infrastructure or project setup and removed needs rebase There is a merge conflict do NOT merge yet Do not merge this PR into the target branch yet c: chore PR that doesn't affect the runtime behavior labels Oct 7, 2023
test/modules/system.spec.ts Outdated Show resolved Hide resolved
ST-DDT
ST-DDT previously approved these changes Oct 7, 2023
Copy link
Member

@ST-DDT ST-DDT left a comment

Choose a reason for hiding this comment

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

Implementation wise this looks good to me.
But IMO we should talk about this in the next team meeting.

@ST-DDT ST-DDT added the p: 1-normal Nothing urgent label Oct 7, 2023
@ST-DDT ST-DDT requested review from a team and xDivisionByZerox October 7, 2023 22:56
@ST-DDT ST-DDT changed the title chore(unicorn): prefer-spread infra(unicorn): prefer-spread Oct 7, 2023
@ST-DDT
Copy link
Member

ST-DDT commented Oct 10, 2023

Team Decision

  • We will enable this rule for consistency reasons.

@ST-DDT ST-DDT added s: accepted Accepted feature / Confirmed bug and removed s: needs decision Needs team/maintainer decision labels Oct 10, 2023
@ST-DDT ST-DDT dismissed stale reviews from xDivisionByZerox and themself via 7674d33 October 11, 2023 21:49
@ST-DDT ST-DDT requested review from xDivisionByZerox and a team October 11, 2023 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: infra Changes to our infrastructure or project setup p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants