在终端中,我运行以下命令:
$ node sample.js
hello, Stephen MC
$ node_modules/.bin/jsdoc --version
JSDoc 3.3.3 (Tue, 22 Sep 2015 23:14:17 GMT)
$ node_modules/.bin/jsdoc -c jsdocConf.json
Parsing /**/sample.js ...ERROR: Unable to parse /**/sample.js: Line 14: Unexpected token ILLEGAL
complete.
Generating output files...complete.
Finished running in 0.29 seconds.
我的 sample.js 文件如下所示:
/** @module myjsdoc/sample */
"use strict";
const me = "Stephen MC";
/** This function logs the parameter.
* @param {string} param - The string to log.
*/
const myFunc = function ( param ) {
console.log( param );
};
myFunc( `hello, ${me}` );
我用于 jsdoc 的 conf.json 如下所示:
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc","closure"]
},
"source": {
"include": [ "./" ],
"exclude": [ "documentation", "node_modules" ],
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_|.+[Ss]pec\\.js"
},
"templates": {
"cleverLinks": false,
"monospaceLinks": false
},
"opts": {
"destination": "./documentation/",
"readme": "./README.md",
"recurse": true,
"verbose": true
}
}
有没有办法配置 jsdoc 3.3.3 来容忍 ES6 模板字符串?也许有一个插件可以工作?