Skip to content

[Bug]: JSX transform flattens spreads with __proto__ #14756

@Andarist

Description

@Andarist

💻

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

<div {...{__proto__: null}}/>

Configuration file name

No response

Configuration

{
  plugins: ['@babel/plugin-transform-react-jsx'],
}

Current and expected behavior

current

"use strict";

/*#__PURE__*/
React.createElement("div", {
  __proto__: null
});

expected

"use strict";

/*#__PURE__*/
React.createElement("div", _objectSpread({}, {
  __proto__: null
}));

Environment

System:
OS: macOS 12.3
Binaries:
Node: 16.15.0 - ~/Library/Caches/fnm_multishells/52478_1657785102300/bin/node
Yarn: 3.1.1 - /usr/local/bin/yarn
npm: 8.5.5 - ~/Library/Caches/fnm_multishells/52478_1657785102300/bin/npm
Monorepos:
Yarn Workspaces: 3.1.1
npmPackages:
@babel/cli: ^7.17.10 => 7.17.10
@babel/core: ^7.18.0 => 7.18.0
@babel/eslint-config-internal: workspace:^ => 7.16.1
@babel/eslint-parser: workspace:^ => 7.18.2
@babel/eslint-plugin-development: workspace:^ => 7.17.7
@babel/eslint-plugin-development-internal: workspace:^ => 7.18.6
@babel/plugin-proposal-dynamic-import: ^7.16.7 => 7.16.7
@babel/plugin-proposal-export-namespace-from: ^7.17.12 => 7.17.12
@babel/plugin-proposal-object-rest-spread: ^7.18.0 => 7.18.0
@babel/plugin-transform-modules-commonjs: ^7.18.0 => 7.18.0
@babel/plugin-transform-runtime: ^7.18.0 => 7.18.0
@babel/preset-env: ^7.18.0 => 7.18.0
@babel/preset-flow: ^7.17.12 => 7.17.12
@babel/preset-typescript: ^7.17.12 => 7.17.12
@babel/runtime: ^7.18.0 => 7.18.0
babel-plugin-transform-charcodes: ^0.2.0 => 0.2.0
eslint: ^8.9.0 => 8.9.0
jest: ^28.0.3 => 28.0.3

Possible solution

No response

Additional context

It has been suggested here that this is probably a bug in Babel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: jsxoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions