https://github.com/tyilo/ecmascript-syntax
https://github.com/tyilo/ecmascript-syntax
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tyilo/ecmascript-syntax
- Owner: tyilo
- Created: 2025-04-03T11:54:00.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-04-04T10:03:04.000Z (about 1 year ago)
- Last Synced: 2025-04-04T11:20:31.620Z (about 1 year ago)
- Language: Rust
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ecmascript-syntax
Determine the ECMAScript version required to parse the syntax of a JavaScript file.
This doesn't check that the required runtime objects/functions/etc. are available.
## Example usage
See [`test.js`](test.js).
```
$ cargo run -- test.js
ES2015 required because of:
- Class declaration
- for (... of ...)
- Arrow function (() => {})
- Generator (function *)
- import statement
- export statement
- let binding
- const binding
- Template literal (`${1 + 1}`)
ES2016 required because of:
- Exponentiation (**, **=)
ES2017 required because of:
- Async function
- await expression
ES2018 required because of:
- Async generator (async function*)
- for await (... of ...)
- Spread operator (...)
- Rest parameters (...)
- RegExp literal flag /s
ES2019 required because of:
- try-catch without binding (try { ... } catch { ... })
ES2020 required because of:
- BigInt literal (1n)
- Optional chaining (?.)
- Nullish coalescing operator (??)
- Dynamic import (await import("..."))
ES2021 required because of:
- Nullish coalescing assignment (??=)
- Logical and assignment (&&=)
- Logical or assignment (||=)
ES2022 required because of:
- Field declaration in class
- Private field or method (#foo)
- Static class initializer (static { ... })
- Top-level await expression
- RegExp literal flag /d
ES2024 required because of:
- RegExp literal flag /v
```