Skip to content

Commit

Permalink
Add docs for @babel/parser's annexb option
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Feb 6, 2023
1 parent 92b00eb commit 35415ab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/parser.md
Expand Up @@ -33,6 +33,7 @@ mind. When in doubt, use `.parse()`.
<summary>History</summary>
| Version | Changes |
| --- | --- |
| `v7.21.0` | Added `annexb` |
| `v7.16.0` | Added `startColumn` |
| `v7.15.0` | Added `attachComment` |
| `v7.7.0` | Added `errorRecovery` |
Expand Down Expand Up @@ -68,6 +69,8 @@ mind. When in doubt, use `.parse()`.

- **attachComment**: By default, Babel attaches comments to adjacent AST nodes. When this option is set to `false`, comments are not attached. It can provide up to 30% performance improvement when the input code has _many_ comments. `@babel/eslint-parser` will set it for you. It is not recommended to use `attachComment: false` with Babel transform, as doing so removes all the comments in output code, and renders annotations such as `/* istanbul ignore next */` nonfunctional.

- **annexb**: By default, Babel parses JavaScript according to [ECMAScript's Annex B "_Additional ECMAScript Features for Web Browsers_"](https://tc39.es/ecma262/#sec-additional-ecmascript-features-for-web-browsers) syntax. When this option is set to `false`, Babel will parse syntax without the extensions specific to Annex B.

- **createParenthesizedExpressions**: By default, the parser sets `extra.parenthesized` on the expression nodes. When this option is set to `true`, `ParenthesizedExpression` AST nodes are created instead.

- **errorRecovery**: By default, Babel always throws an error when it finds some invalid
Expand Down

0 comments on commit 35415ab

Please sign in to comment.