[babel 8] Remove useSpread and useBuiltIns jsx options (#12593)
* [babel 8] Remove `useSpread` and `useBuiltIns` jsx options backport of 8cc8696851fa4bf02d7f6ae591404626d1ca32a3 Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> Co-authored-by: Brian Ng <bng412@gmail.com> * Update fixtures (Windows) Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com> Co-authored-by: Brian Ng <bng412@gmail.com> Co-authored-by: Babel Bot <babel-bot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<Component
|
||||
{...props}
|
||||
sound="moo" />
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": false
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, babelHelpers.extends({}, props, {
|
||||
sound: "moo"
|
||||
}));
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": true
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, babelHelpers.extends({}, props, {
|
||||
React.createElement(Component, { ...props,
|
||||
sound: "moo"
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": false
|
||||
}
|
||||
3
packages/babel-plugin-transform-react-jsx/test/fixtures/react/assignment-babel-7/output.js
vendored
Normal file
3
packages/babel-plugin-transform-react-jsx/test/fixtures/react/assignment-babel-7/output.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var div = /*#__PURE__*/React.createElement(Component, babelHelpers.extends({}, props, {
|
||||
foo: "bar"
|
||||
}));
|
||||
3
packages/babel-plugin-transform-react-jsx/test/fixtures/react/assignment/options.json
vendored
Normal file
3
packages/babel-plugin-transform-react-jsx/test/fixtures/react/assignment/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": true
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
var div = /*#__PURE__*/React.createElement(Component, babelHelpers.extends({}, props, {
|
||||
var div = /*#__PURE__*/React.createElement(Component, { ...props,
|
||||
foo: "bar"
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": false
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
var x = (
|
||||
<>
|
||||
<div>
|
||||
<div key="1" />
|
||||
<div key="2" meow="wolf" />
|
||||
<div key="3" />
|
||||
<div {...props} key="4" />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": false
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
var x = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
||||
key: "1"
|
||||
}), /*#__PURE__*/React.createElement("div", {
|
||||
key: "2",
|
||||
meow: "wolf"
|
||||
}), /*#__PURE__*/React.createElement("div", {
|
||||
key: "3"
|
||||
}), /*#__PURE__*/React.createElement("div", babelHelpers.extends({}, props, {
|
||||
key: "4"
|
||||
}))));
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": true
|
||||
}
|
||||
@@ -5,6 +5,6 @@ var x = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/Reac
|
||||
meow: "wolf"
|
||||
}), /*#__PURE__*/React.createElement("div", {
|
||||
key: "3"
|
||||
}), /*#__PURE__*/React.createElement("div", babelHelpers.extends({}, props, {
|
||||
}), /*#__PURE__*/React.createElement("div", { ...props,
|
||||
key: "4"
|
||||
}))));
|
||||
})));
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<Component { ... x } y
|
||||
={2 } z />
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": false
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, babelHelpers.extends({}, x, {
|
||||
y: 2,
|
||||
z: true
|
||||
}));
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": true
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, babelHelpers.extends({}, x, {
|
||||
React.createElement(Component, { ...x,
|
||||
y: 2,
|
||||
z: true
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<Component y={2} z { ... x } />
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": false
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, babelHelpers.extends({
|
||||
y: 2,
|
||||
z: true
|
||||
}, x));
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": true
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, babelHelpers.extends({
|
||||
React.createElement(Component, {
|
||||
y: 2,
|
||||
z: true
|
||||
}, x));
|
||||
z: true,
|
||||
...x
|
||||
});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<Component y={2} { ... x } z />
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": false
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, babelHelpers.extends({
|
||||
y: 2
|
||||
}, x, {
|
||||
z: true
|
||||
}));
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": true
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, babelHelpers.extends({
|
||||
y: 2
|
||||
}, x, {
|
||||
React.createElement(Component, {
|
||||
y: 2,
|
||||
...x,
|
||||
z: true
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": true,
|
||||
"plugins": [["transform-react-jsx", { "useBuiltIns": false }]],
|
||||
"throws": "@babel/plugin-transform-react-jsx: Since \"useBuiltIns\" is removed in Babel 8, you can remove it from the config."
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": true,
|
||||
"plugins": [["transform-react-jsx", { "useBuiltIns": true }]],
|
||||
"throws": "@babel/plugin-transform-react-jsx: Since \"useBuiltIns\" is removed in Babel 8, you can remove it from the config."
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": true,
|
||||
"plugins": [["transform-react-jsx", { "useSpread": false }]],
|
||||
"throws": "transform-react-jsx: Since Babel 8, an inline object with spread elements is always used, and the \"useSpread\" option is no longer available. Please remove it from your config."
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": true,
|
||||
"plugins": [["transform-react-jsx", { "useSpread": true }]],
|
||||
"throws": "transform-react-jsx: Since Babel 8, an inline object with spread elements is always used, and the \"useSpread\" option is no longer available. Please remove it from your config."
|
||||
}
|
||||
3
packages/babel-plugin-transform-react-jsx/test/fixtures/spread-transform/options.json
vendored
Normal file
3
packages/babel-plugin-transform-react-jsx/test/fixtures/spread-transform/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"BABEL_8_BREAKING": true
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
var div = <Component {...props} foo="bar" />
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"plugins": ["transform-react-jsx", ["proposal-object-rest-spread", {
|
||||
"loose": true,
|
||||
"useBuiltIns": false
|
||||
}], "external-helpers"]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
var div = /*#__PURE__*/React.createElement(Component, babelHelpers.extends({}, props, {
|
||||
foo: "bar"
|
||||
}));
|
||||
@@ -0,0 +1 @@
|
||||
var div = <Component {...props} foo="bar" />
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"plugins": ["transform-react-jsx", ["proposal-object-rest-spread", {
|
||||
"loose": true,
|
||||
"useBuiltIns": true
|
||||
}]]
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"plugins": [["transform-react-jsx", { "useBuiltIns": "invalidOption" }]],
|
||||
"throws": "transform-react-jsx currently only accepts a boolean option for useBuiltIns (defaults to false)"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": [["transform-react-jsx", { "useBuiltIns": true }]]
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"plugins": [["transform-react-jsx", { "useSpread": 0 }]],
|
||||
"throws": "transform-react-jsx currently only accepts a boolean option for useSpread (defaults to false)"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"plugins": [
|
||||
["transform-react-jsx", { "useSpread": true, "useBuiltIns": true }]
|
||||
],
|
||||
"throws": "transform-react-jsx currently only accepts useBuiltIns or useSpread but not both"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
var div = /*#__PURE__*/React.createElement(Component, { ...props,
|
||||
foo: "bar"
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": [["transform-react-jsx", { "useSpread": true }]]
|
||||
}
|
||||
Reference in New Issue
Block a user