I am getting a weird eslint error when using the spread operator a certain way. I am using it all over my application, but this one line is throwing an error
//this is ok
const sortById = arr => [...arr].sort((a, b) => (parseInt(a.EMPLOYEE_ID) < parseInt(b.EMPLOYEE_ID) ? -1 : 1));
//this is ok
const addStoreType = arr => arr.map(obj => ({ ...obj, STORE_TYPE: typeOfStore(parseInt(obj.DEPARTMENT_NBR))}));
//throws error
const reduceData = arr => arr.map(({ SEQUENCE, TEST_DATE, ADJUSTED_HIRE_DATE, ...rest }) => rest);
This is my eslint config
{
"extends": ["plugin:prettier/recommended"],
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module"
},
"rules": {
"prettier/prettier": ["error", {
"singleQuote": true
}]
}
}