Skip to content

Commit

Permalink
docs: added ecmafeatures property to parser options
Browse files Browse the repository at this point in the history
  • Loading branch information
srijan-paul committed Jan 24, 2022
1 parent 2979012 commit c86b367
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion espree.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const parsers = {
* Tokenizes the given code.
* @param {string} code The code to tokenize.
* @param {ParserOptions} options Options defining how to tokenize.
* @returns {Token[]} An array of tokens.
* @returns {import("./lib/token-translator.js").EsprimaToken[]} An array of tokens.
* @throws {SyntaxError} If the input code is invalid.
* @private
*/
Expand Down
10 changes: 5 additions & 5 deletions lib/espree.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ function extendAcornParser(Parser) {

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

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

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

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

Expand Down
10 changes: 10 additions & 0 deletions lib/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
// Public
//------------------------------------------------------------------------------

/**
* @typedef {Object} EcmaFeatures
* @property {boolean} jsx
* @property {boolean} globalReturn
* @property {boolean} impliedStrict
*/

/**
* @type {EcmaFeatures}
*/
export default {

// React JSX parsing
Expand Down
1 change: 1 addition & 0 deletions lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ function normalizeSourceType(sourceType = "script") {
* @property {number|"latest"} ecmaVersion The ECMAScript version to use (between 3 and 13, or 2015 and 2022, or "latest").
* @property {boolean} allowReserved Only allowed when `ecmaVersion` is set to 3.
* @property {"script"|"module"|"commonjs"} sourceType The kind of the source string being parsed.
* @property {import("./features").EcmaFeatures} ecmaFeatures The additional features to enable.
*/

/**
Expand Down

0 comments on commit c86b367

Please sign in to comment.