jsdoc-api
jsdoc-api copied to clipboard
Explicitly setting pedantic to false generates error
As I experimented with JSDoc API, I tried the following code:
const jsdoc = require('jsdoc-api')
jsdoc.explainSync({files: 'functions/engine/scenarios.js', pedantic: false});
Unfortunately, that throws an error, where it seems as if false has been mistaken for a path.
/Users/martin/dev/src/fictive-tools/node_modules/jsdoc-api/lib/jsdoc-command.js:114
throw err
^
JSDOC_ERROR: ERROR: Unable to find the source file or directory /Users/martin/dev/src/fictive-tools/false
at ExplainSync.verifyOutput (/Users/martin/dev/src/fictive-tools/node_modules/jsdoc-api/lib/jsdoc-command.js:112:19)
at ExplainSync._runJsdoc (/Users/martin/dev/src/fictive-tools/node_modules/jsdoc-api/lib/explain-sync.js:34:32)
at ExplainSync.getOutput (/Users/martin/dev/src/fictive-tools/node_modules/jsdoc-api/lib/explain-sync.js:17:19)
at ExplainSync.execute (/Users/martin/dev/src/fictive-tools/node_modules/jsdoc-api/lib/jsdoc-command.js:49:24)
at Object.explainSync (/Users/martin/dev/src/fictive-tools/node_modules/jsdoc-api/index.js:20:18)
at Object.<anonymous> (/Users/martin/dev/src/fictive-tools/test.js:2:7)
at Module._compile (internal/modules/cjs/loader.js:1185:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1205:10)
at Module.load (internal/modules/cjs/loader.js:1034:32)
at Function.Module._load (internal/modules/cjs/loader.js:923:14)
Calling with true works, however.
Thanks, Martin
hi, thanks for the report.. in your project's node_modules
folder, please put console.log(jsdocArgs)
above this line and post the output 👍
thanks!
Sure, that outputs:
[
'/Users/martin/dev/src/fictive-tools/node_modules/jsdoc/jsdoc.js',
'--pedantic',
'false',
'-X',
'functions/engine/scenarios.js'
]
I think it's because --pedantic is a flag in JSdoc CLI, so if it exists, its true, if it doesn't exist, it's false.
OK, yes you're probably right - i'll take a look.. does your documentation generate correctly when not using pedantic mode?
So far I'm not generating docs but using the explain only to produce a CLI. I can run without setting pedantic and it's working, so I can manage.
ok, glad you can manage for now.. will have a look this evening