Skip to content

Commit

Permalink
test(linter/no-useless-spread): ensure spreads on identifiers pass (#…
Browse files Browse the repository at this point in the history
…5561)

Closes #5405
  • Loading branch information
DonIsaac committed Sep 6, 2024
1 parent ce71982 commit af69393
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/oxc_linter/src/rules/unicorn/no_useless_spread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ fn test() {
r"[...not.array]",
r"[...not.array()]",
r"[...array.unknown()]",
r"const arr = [1, 2, 3]; const unique = [...arr];", // valid method to shallow-clone an array
r"[...Object.notReturningArray(foo)]",
r"[...NotObject.keys(foo)]",
// NOTE (@DonIsaac) these are pathological, should really not be done,
Expand All @@ -562,6 +563,7 @@ fn test() {
// r"[...Int8Array.of()]",
// r"[...new Int8Array(3)]",
r"[...new Set(iter)]",
r"const set = new Set([1, 2, 3]); const unique = [...set];",
r"[...Promise.all(foo)]",
r"[...Promise.allSettled(foo)]",
r"[...await Promise.all(foo, extraArgument)]",
Expand Down Expand Up @@ -722,7 +724,6 @@ fn test() {
("[...foo.map(x => !!x)]", "foo.map(x => !!x)"),
("[...new Array()]", "new Array()"),
("[...new Array(1, 2, 3)]", "new Array(1, 2, 3)"),
// usel
// useless clones - complex
(r"[...await Promise.all(foo)]", r"await Promise.all(foo)"),
(r"[...Array.from(iterable)]", r"Array.from(iterable)"),
Expand Down

0 comments on commit af69393

Please sign in to comment.