@@ -7,10 +7,10 @@ import {SourceLocation} from "./locutil.js"
7
7
export const defaultOptions = {
8
8
// `ecmaVersion` indicates the ECMAScript version to parse. Must be
9
9
// either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
10
- // (2019), 11 (2020), 12 (2021), 13 (2022), or `"latest"` (the
11
- // latest version the library supports). This influences support
12
- // for strict mode, the set of reserved words, and support for
13
- // new syntax features.
10
+ // (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"`
11
+ // (the latest version the library supports). This influences
12
+ // support for strict mode, the set of reserved words, and support
13
+ // for new syntax features.
14
14
ecmaVersion : null ,
15
15
// `sourceType` indicates the mode the code should be parsed in.
16
16
// Can be either `"script"` or `"module"`. This influences global
@@ -44,8 +44,9 @@ export const defaultOptions = {
44
44
// When enabled, super identifiers are not constrained to
45
45
// appearing in methods and do not raise an error when they appear elsewhere.
46
46
allowSuperOutsideMethod : null ,
47
- // When enabled, hashbang directive in the beginning of file
48
- // is allowed and treated as a line comment.
47
+ // When enabled, hashbang directive in the beginning of file is
48
+ // allowed and treated as a line comment. Enabled by default when
49
+ // `ecmaVersion` >= 2023.
49
50
allowHashBang : false ,
50
51
// When `locations` is on, `loc` properties holding objects with
51
52
// `start` and `end` properties in `{line, column}` form (with
@@ -120,6 +121,9 @@ export function getOptions(opts) {
120
121
if ( options . allowReserved == null )
121
122
options . allowReserved = options . ecmaVersion < 5
122
123
124
+ if ( opts . allowHashBang == null )
125
+ options . allowHashBang = options . ecmaVersion >= 14
126
+
123
127
if ( isArray ( options . onToken ) ) {
124
128
let tokens = options . onToken
125
129
options . onToken = ( token ) => tokens . push ( token )
0 commit comments