documentation icon indicating copy to clipboard operation
documentation copied to clipboard

getting babel related issues when generating documentation

Open lfaz opened this issue 4 years ago • 5 comments

Getting babel related issues when running: documentation build './packages/*' -f html -o docs --document-exported --babel=./babel.config.js

I am not sure what should babel.config.js have to support the error that generating! I have babel 7 defined on package.json.

Error:

SyntaxError: Unexpected token, expected ";" (2:10) at _temp._raise (/x/.config/yarn/global/node_modules/documentation/node_modules/@babel/parser/lib/index.js:799:17) at _temp.raiseWithData (/xj/.config/yarn/global/node_modules/documentation/node_modules/@babel/parser/lib/index.js:792:17) at _temp.raise (/x/.config/yarn/global/node_modules/documentation/node_modules/@babel/parser/lib/index.js:786:17) at _temp.unexpected (/x/.config/yarn/global/node_modules/documentation/node_modules/@babel/parser/lib/index.js:9089:16) at _temp.semicolon (/x.config/yarn/global/node_modules/documentation/node_modules/@babel/parser/lib/index.js:9071:40) at _temp.parseExpressionStatement (/xj/.config/yarn/global/node_modules/documentation/node_modules/@babel/parser/lib/index.js:12117:10)

  • What version of documentation.js are you using?: 13.1.0
  • How are you running documentation.js (on the CLI, Node.js API, Grunt, other?): CLI

lfaz avatar Jan 22 '21 09:01 lfaz

This needs a testcase and a code example, there's no way to tell what input in particular is triggering this.

tmcw avatar Mar 28 '21 17:03 tmcw

I am getting the exact same error. Would be easier to debug if the parser could print out the path of the file that is causing the error !

Exlord avatar Mar 31 '21 04:03 Exlord

Any update on this? I am also getting this same error.

sashwini avatar Feb 09 '22 06:02 sashwini

hello, could you please check on master, do you have the same error?

anthony-redFox avatar Feb 09 '22 08:02 anthony-redFox

Top level await is what was causing this issue for me. This is the input that was throwing:

import { readdir } from 'fs/promises';
import { resolve } from 'path';

const dir = process.argv.pop();

if (!dir) throw new Error('missing path parameter');

const definitions = await readdir(resolve(process.cwd(), dir));

Error location is line 8, col 26, which is the end of the await on the last line.

bbeesley avatar Jun 10 '22 10:06 bbeesley