Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable syntax plugins for syntax that works in node #9775

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/babel-preset-jest/index.js
Expand Up @@ -5,14 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/

module.exports = () => ({
plugins: [
require.resolve('babel-plugin-jest-hoist'),
// TODO: replace all the below with a single preset in Jest 26: https://github.com/facebook/jest/pull/9774
require.resolve('@babel/plugin-syntax-object-rest-spread'),
require.resolve('@babel/plugin-syntax-bigint'),
require.resolve('@babel/plugin-syntax-class-properties'),
require.resolve('@babel/plugin-syntax-logical-assignment-operators'),
require.resolve('@babel/plugin-syntax-numeric-separator'),
],
});
const plugins = [
require.resolve('babel-plugin-jest-hoist'),
// TODO: replace all the below with a single preset in Jest 26: https://github.com/facebook/jest/pull/9774
require.resolve('@babel/plugin-syntax-object-rest-spread'),
require.resolve('@babel/plugin-syntax-bigint'),
require.resolve('@babel/plugin-syntax-class-properties'),
require.resolve('@babel/plugin-syntax-numeric-separator'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also add optional chaining and nullish coalescing (Babel 7.8.0).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nevermind, it's not supported by Node.js.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll be supported in node 14 though, which is due to release April 21st, so might make sense to add regardless

];

// @babel/core requires us to export a function
module.exports = () => ({plugins});
1 change: 0 additions & 1 deletion packages/babel-preset-jest/package.json
Expand Up @@ -11,7 +11,6 @@
"dependencies": {
"@babel/plugin-syntax-bigint": "^7.0.0",
"@babel/plugin-syntax-class-properties": "^7.0.0",
"@babel/plugin-syntax-logical-assignment-operators": "^7.0.0",
"@babel/plugin-syntax-numeric-separator": "^7.0.0",
"@babel/plugin-syntax-object-rest-spread": "^7.0.0",
"babel-plugin-jest-hoist": "^25.2.6"
Expand Down
7 changes: 0 additions & 7 deletions yarn.lock
Expand Up @@ -479,13 +479,6 @@
dependencies:
"@babel/helper-plugin-utils" "^7.8.3"

"@babel/plugin-syntax-logical-assignment-operators@^7.0.0":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.8.3.tgz#3995d7d7ffff432f6ddc742b47e730c054599897"
integrity sha512-Zpg2Sgc++37kuFl6ppq2Q7Awc6E6AIW671x5PY8E/f7MCIyPPGK/EoeZXvvY3P42exZ3Q4/t3YOzP/HiN79jDg==
dependencies:
"@babel/helper-plugin-utils" "^7.8.3"

"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.0":
version "7.8.3"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9"
Expand Down