Skip to content

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Apr 25, 2020

This PR contains the following updates:

Package Type Update Change
eslint-plugin-unicorn dependencies major ^18.0.0 -> ^19.0.0

Release Notes

sindresorhus/eslint-plugin-unicorn

v19.0.1

Compare Source

  • no-fn-reference-in-iterator: Ignore this. and Vue.filter (#​699) b02a9c6
  • no-fn-reference-in-iterator: Ignore cases obviously not a function reference (#​697) dae5107

v19.0.0

Compare Source

New rules
Breaking
Improvements
Fixes

Renovate configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻️ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by WhiteSource Renovate. View repository job log here.

@renovate renovate bot requested a review from a team April 25, 2020 15:10
@renovate
Copy link
Contributor Author

renovate bot commented Apr 27, 2020

PR has been edited

👷 This PR has received other commits, so Renovate will stop updating it to avoid conflicts or other problems. If you wish to abandon your changes and have Renovate start over you may click the "rebase" checkbox in the PR body/description.

@spaceninja
Copy link
Member

@calebeby this update required a lint fix for this rule: https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v19.0.0/docs/rules/prefer-set-has.md

Would you mind reviewing the lint fix?

@spaceninja spaceninja requested a review from calebeby April 27, 2020 17:27
@calebeby
Copy link
Member

@spaceninja the no-null rule seems very problematic, it breaks linting on a lot of code (unsurprisingly). Can we disable that rule?

@calebeby
Copy link
Member

calebeby commented Apr 27, 2020

Can we disable no-fn-reference-in-iterator as well? That is a pattern that I like to use. In the docs for that rule it explains a scenario where that pattern has the potential to mess things up, but that seems very edge-case-y

@gerardo-rodriguez
Copy link
Member

I agree with both suggestions from @calebeby. 😉

@calebeby
Copy link
Member

I wonder if we should disable prefer-set-has as well.

This rule changes all arrays (that it can detect) to sets if you call .includes() on it. While it is true that array.includes is O(n) and set.has is O(1), the conversion from array to set has a cost as well, it is probably O(n).

In the use case that was auto-fixed here it makes sense to use set, because the conversion from array to set only has to happen once, while .includes/.has happens in a loop, so this change is theoretically more performant.

I think we should disable this rule and let the humans decide when to use set vs array. The decision is more nuanced than "if you call .includes on it, you should be using set instead of array"

@gerardo-rodriguez
Copy link
Member

I wonder if we should disable prefer-set-has as well.

This rule changes all arrays (that it can detect) to sets if you call .includes() on it. While it is true that array.includes is O(n) and set.has is O(1), the conversion from array to set has a cost as well, it is probably O(n).

In the use case that was auto-fixed here it makes sense to use set, because the conversion from array to set only has to happen once, while .includes/.has happens in a loop, so this change is theoretically more performant.

I think we should disable this rule and let the humans decide when to use set vs array. The decision is more nuanced than "if you call .includes on it, you should be using set instead of array"

I think this is fair as well. Feels a bit heavy-handed of a change. 👍

@spaceninja
Copy link
Member

Null is ok, even though Sindre Sorhus doesn't like it

LOLOLOL @calebeby nice

@spaceninja
Copy link
Member

+1 to all the changes proposed.

@calebeby
Copy link
Member

@spaceninja I mean Sindre definitely has a lot of good points here but having a lint rule for this becomes really really annoying

@calebeby calebeby requested a review from spaceninja April 27, 2020 21:36
@spaceninja spaceninja merged commit e37d0e2 into master Apr 27, 2020
@renovate renovate bot deleted the renovate/eslint-plugin-unicorn-19.x branch April 27, 2020 21:38
@Josh68
Copy link

Josh68 commented Apr 27, 2020

Seems like there was consensus here. If you need my opinion, I can try to provide one, but I trust you guys have considered it fully.

EDIT: FWIW, I quickly scanned both references and agree on both decisions you've made.

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.

5 participants