esdoc-plugins icon indicating copy to clipboard operation
esdoc-plugins copied to clipboard

Crash esdoc-accessor-plugin "Cannot read property 'charAt' of null"

Open lll000111 opened this issue 8 years ago • 3 comments

.\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)

lll000111 avatar Sep 20 '17 11:09 lll000111

This seems to happen if you have a@typedef {T} but don't specify a name

vihanb avatar Oct 13 '17 22:10 vihanb

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

alexdiliberto avatar Sep 01 '18 23:09 alexdiliberto

undefined !== null

Simply change it to if (autoPrivate && doc.name && doc.name.charAt(0) === '_') {

DanielRuf avatar Aug 24 '19 17:08 DanielRuf