Bug: prefer-spread
shouldn't encourage iterating over strings
#2521
Labels
prefer-spread
shouldn't encourage iterating over strings
#2521
prefer-spread
reports onString#split('')
, fixing to a typical...
. That matches the design of string iterability as it was originally intended. However, allowing primitives to be iterated over is widely considered a mistake: https://github.com/tc39/how-we-work/blob/main/normative-conventions.md#reject-primitives-in-iterable-taking-positions.Proposal: can
eslint-plugin-unicorn
remove the preference ofString#split('')
fromprefer-spread
?I'm roughly quoting @Josh-Cena from this discussion: https://github.com/typescript-eslint/typescript-eslint/pull/8509/files#r1781707713. Context: in typescript-eslint, we're implementing typescript-eslint/typescript-eslint#748 Rule proposal: prevent array, iterable and function spreads into objects. The rule is set to report on
...string
by default... and thenunicorn/prefer-spread
reports onString#split('')
. You can't win!The text was updated successfully, but these errors were encountered: