Skip to content

Commit

Permalink
Add 2022 (and 13) as allowed ecmaVersion
Browse files Browse the repository at this point in the history
Some features are only supported in 2022 and above. While some
of the existing tests already specify 2022 as ecmaVersion (or
the equivalent 13 level), it wasn't explicitly listed as allowed
option in the documentation or types.

Therefore, add the supported ecmaVersion to the list and types.
Downstream, we are using acorn and want to specify ecmaVersion
2022 for class field support, but TypeScript prohibits us from
doing that at the moment.
  • Loading branch information
TimvdLippe authored and marijnh committed Jun 1, 2021
1 parent 2a460c8 commit 8c8a149
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions acorn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ required):

- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019),
11 (2020), or 12 (2021, partial support), or `"latest"` (the latest
the library supports). This influences support for strict mode, the
set of reserved words, and support for new syntax features.
11 (2020), 12 (2021, partial support), 13 (2022, partial support)
or `"latest"` (the latest the library supports). This influences
support for strict mode, the set of reserved words, and support
for new syntax features.

**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
implemented by Acorn. Other proposed new features must be
Expand Down
2 changes: 1 addition & 1 deletion acorn/dist/acorn.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ declare namespace acorn {
}

interface Options {
ecmaVersion: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 'latest'
ecmaVersion: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 'latest'
sourceType?: 'script' | 'module'
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
Expand Down
7 changes: 4 additions & 3 deletions acorn/src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import {SourceLocation} from "./locutil.js"
export const defaultOptions = {
// `ecmaVersion` indicates the ECMAScript version to parse. Must be
// either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
// (2019), 11 (2020), 12 (2021), or `"latest"` (the latest version
// the library supports). This influences support for strict mode,
// the set of reserved words, and support for new syntax features.
// (2019), 11 (2020), 12 (2021), 13 (2022), or `"latest"` (the
// latest version the library supports). This influences support
// for strict mode, the set of reserved words, and support for
// new syntax features.
ecmaVersion: null,
// `sourceType` indicates the mode the code should be parsed in.
// Can be either `"script"` or `"module"`. This influences global
Expand Down

0 comments on commit 8c8a149

Please sign in to comment.