test(linter/no-useless-spread): ensure spreads on identifiers pass (#5561)

Closes #5405
This commit is contained in:
DonIsaac 2024-09-06 19:03:16 +00:00
parent ce71982567
commit af69393a1c

View file

@ -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,
@ -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)]",
@ -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)"),