esdoc-plugins
esdoc-plugins copied to clipboard
Crash esdoc-accessor-plugin "Cannot read property 'charAt' of null"
.\one\node_modules\esdoc-accessor-plugin\src\Plugin.js:16
if (autoPrivate && doc.name.charAt(0) === '_') {
^
TypeError: Cannot read property 'charAt' of null
at Plugin.onHandleDocs (.\one\node_modules\esdoc-accessor-plugin\src\Plugin.js:16:36)
at Plugin._execHandler (.\one\node_modules\esdoc\out\src\Plugin\Plugin.js:55:26)
at Plugin.onHandleDocs (.\one\node_modules\esdoc\out\src\Plugin\Plugin.js:135:10)
at Function.generate (.s\one\node_modules\esdoc\out\src\ESDoc.js:133:32)
at ESDocCLI.exec (.\one\node_modules\esdoc\out\src\ESDocCLI.js:71:23)
at Object.<anonymous> (.\one\node_modules\esdoc\out\src\ESDocCLI.js:182:7)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
This seems to happen if you have a@typedef {T} but don't specify a name
Also seeing this if I use a class field which has a dasherized name;
export default class MyComponent {
/* I am a prop */
'my-prop': 123;
}
doc.name will be undefined in this case and the Plugin will throw the TypeError
undefined !== null
Simply change it to if (autoPrivate && doc.name && doc.name.charAt(0) === '_') {