-
-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
There're some corner cases like handling Object.assign({}, ...) with array of objects.
Let's look at some examples:
'prefer-spread-syntax' turned Off
const arr = [
{ a: 1 },
{ b: 2 },
{ c: 3 }
]
const obj = Object.assign({}, ...arr)
// { a: 1, b: 2, c: 3 }
// This works right'prefer-spread-syntax' turned On with eslint . --fix script:
const arr = [
{ a: 1 },
{ b: 2 },
{ c: 3 }
]
const obj = { ......arr } // error (alert) - three more dots for spread
// After dots fix
// { 0: { a: 1 }, 1: { b: 1 }, 2: { c: 1 } }
// Wrong properties in the final object, because Object spread ({ ...obj }) only spreads properties of a single object, not array of objectsReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels