Enable logical assignment in @babel/preset-env
See original GitHub issueFeature Request
<div align="center">Logical assignment is Stage 4!
This means that it should be enabled by default in @babel/preset-env
🎉
It should be done similarly to this commit: https://github.com/babel/babel/commit/b92ad318f173e1a0573a188324aa0c222ea35782
- Add it to
packages/babel-preset-env/src/available-plugins.js
- Add the
compat-table
mapping topackages/babel-compat-data/scripts/data/plugin-features.js
(you can find the correct feature name at https://kangax.github.io/compat-table/esnext/) - Run
cd packages/babel-compat-data
andyarn build-data
to update the data about the supported browser versions - Update the test as needed (you don’t need to write new tests)
- PR! 🎉
If it is the first time that you contribute to Babel, follow these steps: (you need to have make
and yarn
available on your machine)
- Write a comment there to let other possible contributors know that you are working on this bug.
- Fork the repo
- Run
git clone https://github.com/<YOUR_USERNAME>/babel.git && cd babel
- Run
yarn && make bootstrap
- Wait ⏳
- Run
make watch
(ormake build
whenever you change a file) - Add a test if needed (only
input.js
;output.js
will be automatically generated) - Update the code!
yarn jest babel-preset-env
to run the tests- If some test outputs don’t match but the new results are correct, you can delete the bad
output.js
files and run the tests again - If you prefer, you can run
OVERWRITE=true yarn jest babel-preset-env
and they will be automatically updated.
- If some test outputs don’t match but the new results are correct, you can delete the bad
- If it is working, run
make test
to run all the tests - Run
git push
and open a PR!
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
babel/plugin-proposal-logical-assignment-operators
NOTE**: This plugin is included in `@babel/preset-env`, in [ES2021](https://github.com/tc39/proposals/blob/master/finished-proposals.md)
Read more >@babel/preset-env - npm
Start using @babel/preset-env in your project by running `npm i @babel/preset-env`. ... @babel/plugin-proposal-logical-assignment-operators ...
Read more >@babel/plugin-proposal-logical-assignment-operators ... - Snyk
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >@babel/plugin-proposal-logical-assignment-operators | Yarn
Transforms logical assignment operators into short-circuited assignments. babel-plugin. readme. babel. The compiler for writing next generation JavaScript.
Read more >babel/preset-env - npm.io
Check @babel/preset-env 7.19.4 package - Last release 7.19.4 with MIT licence at ... @babel/plugin-syntax-logical-assignment-operators@babel/plugin-syntax- ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@morrme I forgot to mention that we have a new feature branch
feat-7.11.0/stage-4
, if you just started working on this issue, I suggest you checkout that branch. You can see there is anes2021
item out there.The PR should also target to
feat-7.11.0/stage-4
instead ofmain
.@morrme you can create a new mapping like so:
And then add
es2021
tomodule.exports
at the bottom!