documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Unexpected invisible token

Open Berkmann18 opened this issue 7 years ago • 8 comments

Error

132:1 warning  unexpected token

Here's the line 132:

/**

I checked for encoding and the surrounding characters which are below:

};

/**
 * 

But I don't know why it's still doing this.

  • What version of documentation.js are you using?: 8.1.2
  • How are you running documentation.js (on the CLI, Node.js API, Grunt, other?): I'm running it as follows:
"doc:lint": "documentation lint src/**"

Berkmann18 avatar Oct 10 '18 13:10 Berkmann18

Mind specifying the complete source code of that file? The thing with 'unexpected token' errors is that it's "unexpected" because of context. It's not that there's a specific 'bad' token, it's that the code (which in this example comes before that }; line) sets up an expectation that is then not fulfilled. Or, alternately, make sure that the file in this example runs in Node or a browser to make sure it's parseable to begin with.

tmcw avatar Oct 10 '18 15:10 tmcw

@tmcw Sure, here's the file.

Berkmann18 avatar Oct 11 '18 08:10 Berkmann18

Looks like this is an error thrown by doctrine, the underlying JSDoc parser, so it's a JSDoc syntax error rather than a JavaScript one, and it appears to be triggered by the line

 * @param {string[]} [files=process.argv.slice(2, process.argv.length)] Array of file paths

tmcw avatar Oct 11 '18 17:10 tmcw

@tmcw I removed the process... and still get this error pointed to the same line.

Berkmann18 avatar Oct 12 '18 13:10 Berkmann18

Still getting that even by having this:

/**
 * @description Synchronously read files and scan them.
 * @param {string[]} [files] Array of file paths
 * @param {Config} obj Configuration
 * @see Config
 * @return {(undefined|string[]|{...string})} Data or nothing
 * @public
 * @example <caption>Reading from the CLI</caption>
 * readFilesSync();
 * @example <caption>Reading from specific files</caption>
 * readFilesSync(['output.txt']);
 * @example <caption>... With specific configurations</caption>
 * readFilesSync(['input.json'], {prettify: true, outputFormat: 'json'}); //logs {<br>  "output.json": "sha256-iTyF6rE+vAUIIWrWaC6bWt9NwI/74kpOuk4JZl9zCMM="<br>}
 * readFilesSync(['input.csv'], {outputDest: 'output.json', outputFormat: 'json'}); //Writes the above to output.json
 */
const readFilesSync = (files = [], { prettify = false, outputDest = OUTPUT_DEST, outputFormat = OUTPUT_FORMAT } = {}) => {
...

Berkmann18 avatar Nov 02 '18 10:11 Berkmann18

@tmcw Have you had a chance to look at this?

Berkmann18 avatar Dec 14 '18 16:12 Berkmann18

Please don't bump issues - I'll post back on something if I've made progress on it.

tmcw avatar Dec 14 '18 19:12 tmcw