Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/babel/website into sync-5ab…
Browse files Browse the repository at this point in the history
…b81cc
  • Loading branch information
docschina-bot committed Mar 24, 2024
2 parents df9c9fd + 5abb81c commit f3e60ce
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
29 changes: 20 additions & 9 deletions docs/plugin-proposal-optional-chaining-assign.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: babel-plugin-proposal-optional-chaining-assign
title: "@babel/plugin-proposal-optional-chaining-assign"
sidebar_label: optional-chaining
sidebar_label: optional-chaining-assign
---

Transform optional chaining on the left-hand side of assignment expressions.
Expand Down Expand Up @@ -33,21 +33,22 @@ npm install --save-dev @babel/plugin-proposal-optional-chaining-assign
```json title="babel.config.json"
{
"plugins": ["@babel/plugin-proposal-optional-chaining-assign"]
"plugins": [
"@babel/plugin-proposal-optional-chaining-assign",
{
"version": "2023-07"
}
]
}
```
### Via CLI
```sh title="Shell"
babel --plugins @babel/plugin-proposal-optional-chaining-assign script.js
```
### Via Node API
```js title="JavaScript"
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-proposal-optional-chaining-assign"],
plugins: [["@babel/plugin-proposal-optional-chaining-assign", {
"version": "2023-07"
}]],
});
```
Expand All @@ -57,6 +58,16 @@ require("@babel/core").transformSync("code", {
This plugin is affected by the [`noDocumentAll`](https://babeljs.io/docs/assumptions#nodocumentall) assumption.
### `version`
Required.
`"2023-07"`
Selects the proposal to use:
- `"2023-07"`: The stage 1 proposal as defined at [`tc39/proposal-optional-chaining-assignment@49d055c44b`](https://github.com/tc39/proposal-optional-chaining-assignment/commit/e7b48795b66a8196b1abcab2e52e2049d055c44b), presented in the July 2023 TC39 meeting.
## References
- [Proposal: Optional Chaining Assignment](https://github.com/tc39/proposal-optional-chaining-assignment)
2 changes: 1 addition & 1 deletion website/data/tools/babel_cli/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ npm run build

<blockquote class="alert alert--info">
<p>
For full documentation on the Babel CLI see the <a href="/docs/usage/cli/">usage docs</a>.
For full documentation on the Babel CLI see the <a href="/docs/usage#basic-usage-with-cli">usage docs</a>.
</p>
</blockquote>
1 change: 1 addition & 0 deletions website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ module.exports = {
"babel-plugin-proposal-function-bind",
"babel-plugin-proposal-function-sent",
"babel-plugin-proposal-import-defer",
"babel-plugin-proposal-optional-chaining-assign",
"babel-plugin-proposal-partial-application",
"babel-plugin-proposal-pipeline-operator",
"babel-plugin-proposal-record-and-tuple",
Expand Down

0 comments on commit f3e60ce

Please sign in to comment.