Issue 1:
Bug Report

Current Behavior

I've updated to 7.5 and have been following the developments with issues that should have been resolved with https://github.com/babel/babel/releases/tag/v7.5.1 however after stripping and reinstalling everything babel-related, I'm still getting this error.

Babel packages

@babel/cli: "^7.5.0"

@babel/core: "^7.5.0"

@babel/helpers: "^7.5.1"

@babel/plugin-proposal-object-rest-spread: "^7.5.1"

@babel/plugin-transform-runtime: "^7.5.0"

@babel/polyfill: "^7.4.4"

@babel/preset-env: "^7.5.0"

@babel/preset-react: "^7.0.0"

babel-eslint: "^10.0.2"

babel-jest: "^24.8.0"

babel-loader: "^8.0.6"

babel-plugin-dynamic-import-node: "^2.3.0"

babel-plugin-jsx-remove-data-test-id: "^2.0.0"

babel-plugin-transform-class-properties: "^6.24.1"

babel-plugin-transform-decorators-legacy: "^1.3.5"

babel-plugin-transform-export-extensions: "^6.22.0"

babel-plugin-transform-object-rest-spread: "^6.26.0"

Babel Configuration (.babelrc, package.json, cli command)

{
"env": {
"test": {
"plugins": [
"transform-class-properties",
"dynamic-import-node",
"@babel/plugin-transform-runtime"
]
},
"production": {
"plugins": ["babel-plugin-jsx-remove-data-test-id"]
}
},
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["transform-class-properties"]
}

Environment

Babel version(s): 7.5.0

Node/npm version: 6.5.0

OS: Linux Mint Cinnamon

Monorepo: yes

Issue 2:
Input Code

const user = { name: 'Max', password: '123', _id: 1, __v: 42 }
const fields = ['__v', 'password']
const filtered = fields.reduce((a, c) => (({ [c]: _, ...rest } = a), rest), user)

this code compiled and works as expected on node, but fails on babel

Babel/Babylon Configuration (.babelrc, package.json, cli command)

Using babel 6.26.0

package.json
...
"devDependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1"
}

Expected Behavior

Get filtered user without __v and password fields

Current Behavior

Cannot compile code. Output log:

$ babel --plugins transform-object-rest-spread src/index.js
babel-preset-env: `DEBUG` option

Using targets:
{}

Modules transform: commonjs

Using plugins:
check-es2015-constants {}
transform-es2015-arrow-functions {}
transform-es2015-block-scoped-functions {}
transform-es2015-block-scoping {}
transform-es2015-classes {}
transform-es2015-computed-properties {}
transform-es2015-destructuring {}
transform-es2015-duplicate-keys {}
transform-es2015-for-of {}
transform-es2015-function-name {}
transform-es2015-literals {}
transform-es2015-object-super {}
transform-es2015-parameters {}
transform-es2015-shorthand-properties {}
transform-es2015-spread {}
transform-es2015-sticky-regex {}
transform-es2015-template-literals {}
transform-es2015-typeof-symbol {}
transform-es2015-unicode-regex {}
transform-regenerator {}
transform-exponentiation-operator {}
transform-async-to-generator {}
syntax-trailing-function-commas {}
TypeError: src/index.js: Property arguments[0] of CallExpression expected node to be of a type ["Expression","SpreadElement"] but instead got undefined
at validate (node_modules\babel-cli\node_modules\babel-types\lib\definitions\index.js:109:13)
at validator (node_modules\babel-cli\node_modules\babel-types\lib\definitions\index.js:57:7)
at Object.validate (node_modules\babel-cli\node_modules\babel-types\lib\definitions\index.js:190:10)
at validate (node_modules\babel-cli\node_modules\babel-types\lib\index.js:505:9)
at Object.builder (node_modules\babel-cli\node_modules\babel-types\lib\index.js:466:7)
at createObjectSpread (C:\Tools\projects\em2\backpack-test\node_modules\babel-plugin-transform-object-rest-spread\lib\index.js:70:38)
at PluginPass.AssignmentExpression (C:\Tools\projects\em2\backpack-test\node_modules\babel-plugin-transform-object-rest-spread\lib\index.js:186:38)
at newFn (node_modules\babel-cli\node_modules\babel-traverse\lib\visitors.js:276:21)
at NodePath._call (node_modules\babel-cli\node_modules\babel-traverse\lib\path\context.js:76:18)
at NodePath.call (node_modules\babel-cli\node_modules\babel-traverse\lib\path\context.js:48:17)

Possible Solution

rewrite filtered like this

const filtered = fields.reduce((a, c) => {
const { [c]: _, ...rest } = a
return rest
}, user)

Context

I was trying to do code in one line like this

(a, c) => (({ [c]: _, ...rest } = a), rest)

instead of this:

(a, c) => {
const { [c]: _, ...rest } = a
return rest
}

Your Environment

software
version(s)

Babel
6.26.0 (babel-core 6.26.0)

node
v9.11.1

npm
5.6.0

Operating System
Win10