-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking: remove useSpread and useBuiltIns option (#11141)
* breaking: remove useSpread and useBuiltIns option * chore: update test fixtures * Make CRA e2e test pass * Bump dependencies _before_ running "yarn install" * chore: update test fixtures * address review comments * fix: assert.rejects should passed by async function * Update packages/babel-plugin-transform-react-jsx/src/transform-classic.js Co-authored-by: Brian Ng <bng412@gmail.com> * update test fixtures Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com> Co-authored-by: Brian Ng <bng412@gmail.com>
- Loading branch information
1 parent
6e46372
commit 8cc8696
Showing
30 changed files
with
109 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...ugin-transform-react-inline-elements/test/fixtures/inline-elements/spread-deopt/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/*#__PURE__*/ | ||
React.createElement(Foo, bar); | ||
React.createElement(Foo, { ...bar | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...t-jsx/test/fixtures/react/adds-appropriate-newlines-when-using-spread-attribute/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/*#__PURE__*/ | ||
React.createElement(Component, babelHelpers.extends({}, props, { | ||
React.createElement(Component, { ...props, | ||
sound: "moo" | ||
})); | ||
}); |
4 changes: 2 additions & 2 deletions
4
...jsx/test/fixtures/react/wraps-props-in-react-spread-for-first-spread-attributes/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*#__PURE__*/ | ||
React.createElement(Component, babelHelpers.extends({}, x, { | ||
React.createElement(Component, { ...x, | ||
y: 2, | ||
z: true | ||
})); | ||
}); |
7 changes: 4 additions & 3 deletions
7
...-jsx/test/fixtures/react/wraps-props-in-react-spread-for-last-spread-attributes/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/*#__PURE__*/ | ||
React.createElement(Component, babelHelpers.extends({ | ||
React.createElement(Component, { | ||
y: 2, | ||
z: true | ||
}, x)); | ||
z: true, | ||
...x | ||
}); |
8 changes: 4 additions & 4 deletions
8
...sx/test/fixtures/react/wraps-props-in-react-spread-for-middle-spread-attributes/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/*#__PURE__*/ | ||
React.createElement(Component, babelHelpers.extends({ | ||
y: 2 | ||
}, x, { | ||
React.createElement(Component, { | ||
y: 2, | ||
...x, | ||
z: true | ||
})); | ||
}); |
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...l-plugin-transform-react-jsx/test/fixtures/transform-to-babel-extend/assignment/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var div = /*#__PURE__*/React.createElement(Component, babelHelpers.extends({}, props, { | ||
foo: "bar" | ||
})); |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
...react-jsx/test/fixtures/transform-to-babel-extend/invalid-use-builtins-false/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": [["transform-react-jsx", { "useBuiltIns": false }]], | ||
"rejects": "transform-react-jsx: Since \"useBuiltIns\" is removed in Babel 8, you must remove it from your config.\n- Babel 8 now transforms JSX spread to object spread. If you need to transpile object spread with\n`useBuiltIns: false`, you can use the following config\n{\n \"plugins\": [\n \"@babel/plugin-transform-react-jsx\",\n [\"@babel/plugin-proposal-object-rest-spread\", { \"loose\": true, \"useBuiltIns\": false }]\n ]\n}" | ||
} |
6 changes: 6 additions & 0 deletions
6
...ges/babel-plugin-transform-react-jsx/test/fixtures/transform-to-babel-extend/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"plugins": ["transform-react-jsx", ["proposal-object-rest-spread", { | ||
"loose": true, | ||
"useBuiltIns": false | ||
}], "external-helpers"] | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
...react-jsx/test/fixtures/transform-to-object-assign/invalid-use-builtins-true/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": [["transform-react-jsx", { "useBuiltIns": true }]], | ||
"rejects": "transform-react-jsx: Since \"useBuiltIns\" is removed in Babel 8, you must remove it from your config.\n- Babel 8 now transforms JSX spread to object spread. If you need to transpile object spread with\n`useBuiltIns: true`, you can use the following config\n{\n \"plugins\": [\n \"@babel/plugin-transform-react-jsx\",\n [\"@babel/plugin-proposal-object-rest-spread\", { \"loose\": true, \"useBuiltIns\": true }]\n ]\n}" | ||
} |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
...-react-jsx/test/fixtures/transform-to-object-assign/invalid-use-spread-false/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": [["transform-react-jsx", { "useSpread": false }]], | ||
"rejects": "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." | ||
} |
1 change: 1 addition & 0 deletions
1
...sform-react-jsx/test/fixtures/transform-to-object-assign/invalid-use-spread-true/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
var div = <Component {...props} foo="bar" /> |
4 changes: 4 additions & 0 deletions
4
...m-react-jsx/test/fixtures/transform-to-object-assign/invalid-use-spread-true/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": [["transform-react-jsx", { "useSpread": true }]], | ||
"rejects": "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." | ||
} |
6 changes: 6 additions & 0 deletions
6
...es/babel-plugin-transform-react-jsx/test/fixtures/transform-to-object-assign/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"plugins": ["transform-react-jsx", ["proposal-object-rest-spread", { | ||
"loose": true, | ||
"useBuiltIns": true | ||
}]] | ||
} |
4 changes: 0 additions & 4 deletions
4
...ugin-transform-react-jsx/test/fixtures/useBuiltIns/assignment-invalid-option/options.json
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
packages/babel-plugin-transform-react-jsx/test/fixtures/useBuiltIns/options.json
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
...plugin-transform-react-jsx/test/fixtures/useSpread/assignment-invalid-option/options.json
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
...el-plugin-transform-react-jsx/test/fixtures/useSpread/assignment-use-builtin/options.json
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/assignment/output.js
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
packages/babel-plugin-transform-react-jsx/test/fixtures/useSpread/options.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters