question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable logical assignment in @babel/preset-env

See original GitHub issue

Feature Request

<div align="center">

Logical assignment is Stage 4!

</div>

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

  1. Add it to packages/babel-preset-env/src/available-plugins.js
  2. Add the compat-table mapping to packages/babel-compat-data/scripts/data/plugin-features.js (you can find the correct feature name at https://kangax.github.io/compat-table/esnext/)
  3. Run cd packages/babel-compat-data and yarn build-data to update the data about the supported browser versions
  4. Update the test as needed (you don’t need to write new tests)
  5. 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)

  1. Write a comment there to let other possible contributors know that you are working on this bug.
  2. Fork the repo
  3. Run git clone https://github.com/<YOUR_USERNAME>/babel.git && cd babel
  4. Run yarn && make bootstrap
  5. Wait ⏳
  6. Run make watch (or make build whenever you change a file)
  7. Add a test if needed (only input.js; output.js will be automatically generated)
  8. Update the code!
  9. 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.
  10. If it is working, run make test to run all the tests
  11. Run git push and open a PR!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
JLHwungcommented, Jul 22, 2020

@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 an es2021 item out there.

The PR should also target to feat-7.11.0/stage-4 instead of main.

2reactions
existentialismcommented, Jul 22, 2020

@morrme you can create a new mapping like so:

const es2021 = {
  "proposal-logical-assignment-operators": "Logical Assignment",
};

And then add es2021 to module.exports at the bottom!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found