Skip to content

Commit 695e582

Browse files
committed
added ecmafeatures property to parser options
1 parent e06dce6 commit 695e582

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

espree.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const parsers = {
108108
* Tokenizes the given code.
109109
* @param {string} code The code to tokenize.
110110
* @param {ParserOptions} options Options defining how to tokenize.
111-
* @returns {Token[]} An array of tokens.
111+
* @returns {import("./lib/token-translator.js").EsprimaToken[]} An array of tokens.
112112
* @throws {SyntaxError} If the input code is invalid.
113113
* @private
114114
*/

lib/espree.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ function extendAcornParser(Parser) {
251251

252252
/**
253253
* Overwrites the default raise method to throw Esprima-style errors.
254-
* @param {int} pos The position of the error.
254+
* @param {number} pos The position of the error.
255255
* @param {string} message The error message.
256256
* @throws {SyntaxError} A syntax error.
257257
* @returns {void}
@@ -268,7 +268,7 @@ function extendAcornParser(Parser) {
268268

269269
/**
270270
* Overwrites the default raise method to throw Esprima-style errors.
271-
* @param {int} pos The position of the error.
271+
* @param {number} pos The position of the error.
272272
* @param {string} message The error message.
273273
* @throws {SyntaxError} A syntax error.
274274
* @returns {void}
@@ -279,7 +279,7 @@ function extendAcornParser(Parser) {
279279

280280
/**
281281
* Overwrites the default unexpected method to throw Esprima-style errors.
282-
* @param {int} pos The position of the error.
282+
* @param {number} pos The position of the error.
283283
* @throws {SyntaxError} A syntax error.
284284
* @returns {void}
285285
*/
@@ -324,8 +324,8 @@ function extendAcornParser(Parser) {
324324

325325
/**
326326
* Performs last-minute Esprima-specific compatibility checks and fixes.
327-
* @param {ASTNode} result The node to check.
328-
* @returns {ASTNode} The finished node.
327+
* @param {acorn.Node} result The node to check.
328+
* @returns {acorn.Node} The finished node.
329329
*/
330330
[ESPRIMA_FINISH_NODE](result) {
331331

lib/features.js

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@
1414
// Public
1515
//------------------------------------------------------------------------------
1616

17+
/**
18+
* @typedef {Object} EcmaFeatures
19+
* @property {boolean} jsx
20+
* @property {boolean} globalReturn
21+
* @property {boolean} impliedStrict
22+
*/
23+
24+
/**
25+
* @type {EcmaFeatures}
26+
*/
1727
export default {
1828

1929
// React JSX parsing

lib/options.js

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function normalizeSourceType(sourceType = "script") {
9090
* @property {number|"latest"} ecmaVersion The ECMAScript version to use (between 3 and 13, or 2015 and 2022, or "latest").
9191
* @property {boolean} allowReserved Only allowed when `ecmaVersion` is set to 3.
9292
* @property {"script"|"module"|"commonjs"} sourceType The kind of the source string being parsed.
93+
* @property {import("./features").EcmaFeatures} ecmaFeatures The additional features to enable.
9394
*/
9495

9596
/**

0 commit comments

Comments
 (0)