Open SilentImp opened 7 years ago
Is related to Plugin.js file in the ecmascript-proposal plugin... a workaround is to change line 4 with
const plugins = ev.data.option.plugins;
Currently there is a ev.data.parserOption that is never passed...
I've found it could be related to gulp-esdoc in my configuration...
Hi, I've got the same error since I updated from 0.5.x to 1.x. I would be glad to help identifying the issue.
I just found out that the issue came from the general esdoc installation, that was not updated to 1.x, when updated the error disappeared.
I have similar issue with objectRestSpread option of esdoc-ecmascript-proposal-plugin Another options are good
{
"source": "./src",
"destination": "./docs",
"plugins": [
{"name": "esdoc-ecmascript-proposal-plugin", "option": {
"objectRestSpread": true
}}
]
}
So what's the status here? Do we know whether it's an issue with esdoc-type-inference-plugin
or with esdoc-ecmascript-proposal-plugin
?
I put a console.log just before https://github.com/esdoc/esdoc-plugins/blob/master/esdoc-type-inference-plugin/src/Plugin.js#L157, and from what I see.. Usually, prop
indeed is an object with a key property, for example:
>> { prop:
{ type: 'ObjectProperty',
start: 116,
end: 127,
loc: { start: [Object], end: [Object] },
method: false,
shorthand: true,
computed: false,
key:
{ type: 'Identifier',
start: 116,
end: 122,
loc: [Object],
name: 'repeat',
[Symbol(already)]: true },
value:
{ type: 'AssignmentPattern',
start: 116,
end: 127,
loc: [Object],
left: [Object],
right: [Object],
[Symbol(already)]: true },
extra: { shorthand: true },
[Symbol(already)]: true }
For me, when it fails, this is the prop object:
>> { prop:
{ type: 'RestProperty',
start: 129,
end: 139,
loc: { start: [Object], end: [Object] },
argument:
{ type: 'Identifier',
start: 132,
end: 139,
loc: [Object],
name: 'options',
[Symbol(already)]: true },
[Symbol(already)]: true },
key: undefined,
name: undefined }
@a-x- have you found a workaround? Or does it mean we must avoid spread properties?
(I have another project with a much older esdoc setup, esdoc@0.5.2
and esdoc-es7-plugin@0.0.3
, and everything works fine there. I'd rather use that old setup than not use object spread)
no, I didn't
Well I disabled the esdoc-type-inference-plugin
for now, and it "helps" - not sure what it would normally do tho, its functionality must be missing now.
{
"name": "esdoc-type-inference-plugin",
"option": {
"enable": false
}
},
@loopmode or anyone else that comes across this issue, you can work around it by creating a jsdoc definition for the parameter yourself. This way it doesn't have to use the inference plugin to figure it out.
/**
* Foobar does stuff
*
* @param {Object} [options={}]
* @param {Boolean} [options.foo='bar']
* @param {...*} [options.rest] <- Throws error without this.
*/
export function foobar({ foo = 'bar', ...rest } = {}) {
console.log(foo, ...rest);
}
Having said that, does anyone know the correct way to document rest parameters in an object?
Is it @param {...*} [options.rest]
or @param {*} [...options.rest]
Both seem to work okay but the generated docs end up slightly different.
Hi, I have tried add plugin to the project project with following config:
but when I try to generate documentation I have got:
Any ideas what may have go wrong?