mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(linter): false positive in unicorn/no-useless-spread (#7940)
closes #7936
This commit is contained in:
parent
6f8bb1cebf
commit
6f41d92972
2 changed files with 4 additions and 1 deletions
|
|
@ -89,7 +89,7 @@ impl ConstEval for Argument<'_> {
|
|||
|
||||
impl ConstEval for NewExpression<'_> {
|
||||
fn const_eval(&self) -> ValueHint {
|
||||
if is_new_array(self) || is_new_typed_array(self) {
|
||||
if is_new_array(self) {
|
||||
ValueHint::NewArray
|
||||
} else if is_new_map_or_set(self) {
|
||||
ValueHint::NewIterable
|
||||
|
|
|
|||
|
|
@ -594,6 +594,9 @@ fn test() {
|
|||
"[...arr.reduce((set, b) => set.add(b), new Set(iter))]",
|
||||
// NOTE: we may want to consider this a violation in the future
|
||||
"[...(foo ? new Set() : [])]",
|
||||
// Issue: <https://github.com/oxc-project/oxc/issues/7936>
|
||||
"[ ...Uint8Array([ 1, 2, 3 ]) ].map(byte => byte.toString())",
|
||||
"[ ...new Uint8Array([ 1, 2, 3 ]) ].map(byte => byte.toString())",
|
||||
];
|
||||
|
||||
let fail = vec![
|
||||
|
|
|
|||
Loading…
Reference in a new issue