You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/prefer-spread.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Prefer the spread operator over `Array.from(…)`, `Array#concat(…)` and `Array#slice()`
1
+
# Prefer the spread operator over `Array.from(…)`, `Array#concat(…)`, `Array#slice()` and `String#split('')`
2
2
3
3
Enforces the use of [the spread operator (`...`)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) over
4
4
@@ -18,6 +18,12 @@ Enforces the use of [the spread operator (`...`)](https://developer.mozilla.org/
18
18
19
19
Variables named `arrayBuffer`, `blob`, `buffer`, `file`, and `this` are ignored.
20
20
21
+
-`String#split('')`
22
+
23
+
Split a string into an array of characters.
24
+
25
+
Note: [The suggestion fix may get different result](https://stackoverflow.com/questions/4547609/how-to-get-character-array-from-a-string/34717402#34717402).
Some cases are fixed using extra spread syntax. Therefore we recommend enabling the [`unicorn/no-useless-spread`](./no-useless-spread.md) rule to fix it.
Copy file name to clipboardExpand all lines: readme.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -231,7 +231,7 @@ Each rule has emojis denoting:
231
231
|[prefer-reflect-apply](docs/rules/prefer-reflect-apply.md)| Prefer `Reflect.apply()` over `Function#apply()`. | ✅ | 🔧 ||
232
232
|[prefer-regexp-test](docs/rules/prefer-regexp-test.md)| Prefer `RegExp#test()` over `String#match()` and `RegExp#exec()`. | ✅ | 🔧 ||
233
233
|[prefer-set-has](docs/rules/prefer-set-has.md)| Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence. | ✅ | 🔧 | 💡 |
234
-
|[prefer-spread](docs/rules/prefer-spread.md)| Prefer the spread operator over `Array.from(…)`, `Array#concat(…)` and `Array#slice()`. | ✅ | 🔧 | 💡 |
234
+
|[prefer-spread](docs/rules/prefer-spread.md)| Prefer the spread operator over `Array.from(…)`, `Array#concat(…)`, `Array#slice()` and `String#split('')`. | ✅ | 🔧 | 💡 |
235
235
|[prefer-string-replace-all](docs/rules/prefer-string-replace-all.md)| Prefer `String#replaceAll()` over regex searches with the global flag. || 🔧 ||
236
236
|[prefer-string-slice](docs/rules/prefer-string-slice.md)| Prefer `String#slice()` over `String#substr()` and `String#substring()`. | ✅ | 🔧 ||
0 commit comments