Skip to content

Error when using ES2017/ES8 async/await terms on a function #149

Closed
@CarbonCollins

Description

@CarbonCollins

Hi,

I'm getting an error when running jsdoc-to-markdown after I used an async with a function, code example:

async function sequentialPromiseFromArray(context, fn, elements) {
  const resultArr = [];
  for (let i = 0, iLength = elements.length; i < iLength; i += 1) {
    resultArr.push(await fn.call(context, elements[i]));
  }
  return resultArr;
}

Once i run the task of generating the docs i get this error (errors on the function token immediately following the async token)):

[06:58:25] JSDOC_ERROR: ERROR: Unable to parse {redacted}\GitHub\Public Modules\openraildata-referencedata-nodejs\lib\refData.js: Unexpected token function
    at Explain.verifyOutput ({redacted}\GitHub\Public Modules\openraildata-referencedata-nodejs\node_modules\jsdoc-api\lib\jsdoc-command.js:113:19)
    at ChildProcess.handle.on.code ({redacted}\GitHub\Public Modules\openraildata-referencedata-nodejs\node_modules\jsdoc-api\lib\explain.js:48:38)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:927:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
The terminal process terminated with exit code: 1

I did get the same error on ESLint however after enabling ES8 mode the error was cleared on ESLint, however the issue still remains on jsdoc-to-markdown. Is there a configuration or flag that i am missing or is this a valid issue?

I'm running Node v8.5.0 with npm 5.6.0 and yarn 1.3.2 if that helps anything :)

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions