From 0562304d7a88704dc8654bf3a0d6c8d8504a646a Mon Sep 17 00:00:00 2001 From: David Blackman Date: Sun, 24 Mar 2024 11:41:58 -0600 Subject: [PATCH 1/2] Update plugin-proposal-optional-chaining-assign.md docs to work (#2882) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update plugin-proposal-optional-chaining-assign.md to work with required version field When installing this plugin I received this error and needed to fix it as such Error: [BABEL] /Users/blackmad/Code/gen2-blackmadeco/src/index.tsx: @babel/plugin-syntax-optional-chaining-assign: '.version' option required, representing the last proposal update. Currently, the only supported value is '2023-07'. (While processing: "/Users/blackmad/Code/gen2-blackmadeco/node_modules/@babel/plugin-proposal-optional-chaining-assign/lib/index.js$inherits") * update version docs * add it to the early stages sidebar * Update docs/plugin-proposal-optional-chaining-assign.md Co-authored-by: Nicolò Ribaudo * fix sidebar label --------- Co-authored-by: Huáng Jùnliàng Co-authored-by: Nicolò Ribaudo --- ...lugin-proposal-optional-chaining-assign.md | 29 +++++++++++++------ website/sidebars.js | 1 + 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/plugin-proposal-optional-chaining-assign.md b/docs/plugin-proposal-optional-chaining-assign.md index b36515b09..e359b4b48 100644 --- a/docs/plugin-proposal-optional-chaining-assign.md +++ b/docs/plugin-proposal-optional-chaining-assign.md @@ -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. @@ -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" + }]], }); ``` @@ -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) diff --git a/website/sidebars.js b/website/sidebars.js index 7885889d9..13f4eec00 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -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", From 5abb81cc996bd9a82a7e6c58e700628d5a61da58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julio=20Jord=C3=A1n?= Date: Sun, 24 Mar 2024 18:42:40 +0100 Subject: [PATCH 2/2] Fix page not found error (#2879) --- website/data/tools/babel_cli/usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/data/tools/babel_cli/usage.md b/website/data/tools/babel_cli/usage.md index d36dea3ed..7d893d397 100644 --- a/website/data/tools/babel_cli/usage.md +++ b/website/data/tools/babel_cli/usage.md @@ -34,6 +34,6 @@ Alternatively, you can reference the `babel` cli inside of `node_modules`.

- For full documentation on the Babel CLI see the usage docs. + For full documentation on the Babel CLI see the usage docs.