Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for @babel/parser's annexb option #2716

Merged
merged 2 commits into from Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
@@ -1 +1 @@
* text eol=lf
* text=auto eol=lf
4 changes: 3 additions & 1 deletion docs/parser.md
Expand Up @@ -34,7 +34,7 @@ mind. When in doubt, use `.parse()`.

| Version | Changes |
| --- | --- |
| `v7.21.0` | Added `allowNewTargetOutsideFunction` |
| `v7.21.0` | Added `allowNewTargetOutsideFunction` and `annexb` |
| `v7.16.0` | Added `startColumn` |
| `v7.15.0` | Added `attachComment` |
| `v7.7.0` | Added `errorRecovery` |
Expand Down Expand Up @@ -73,6 +73,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