Error while generating doc using example esdoc.json #24

Closed
yamalight opened this Issue Jul 7, 2015 · 8 comments

Comments

Projects
None yet
4 participants
@yamalight

So, my config looks like this:

{
  "source": "./src",
  "destination": "./esdoc"
}

And if I try to run it on blank rxmq project I get the following error:

➜  rxmq.js git:(master) ✗ esdoc -c esdoc.json
identifiers.html
index.html
/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:77
            throw _iteratorError;
                  ^
TypeError: Cannot read property 'indexOf' of undefined
    at ClassDocBuilder._buildSignatureHTML (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:1041:26)
    at /usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:451:38
    at IceCap.loop (/usr/local/lib/node_modules/esdoc/node_modules/ice-cap/out/src/IceCap.js:319:15)
    at ClassDocBuilder._buildSummaryDoc (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:448:11)
    at ClassDocBuilder._buildSummaryHTML (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:407:29)
    at ClassDocBuilder._buildClassDoc (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:158:38)
    at ClassDocBuilder.exec (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/ClassDocBuilder.js:62:36)
    at publish (/usr/local/lib/node_modules/esdoc/out/src/Publisher/publish.js:121:59)
    at Function.generate (/usr/local/lib/node_modules/esdoc/out/src/ESDoc.js:189:7)
    at ESDocCLI.exec (/usr/local/lib/node_modules/esdoc/out/src/ESDocCLI.js:88:28)

Any thoughts why that might happen?
Using iojs v2.3.3, npm v.2.12.1

@yamalight

This comment has been minimized.

Show comment
Hide comment
@yamalight

yamalight Jul 7, 2015

Looks like this is due to parameter destruction, e.g.:

subscribe({topic, onNext, onError, onCompleted}) {
    return this.observe(topic).subscribe(onNext, onError, onCompleted);
}

Looks like this is due to parameter destruction, e.g.:

subscribe({topic, onNext, onError, onCompleted}) {
    return this.observe(topic).subscribe(onNext, onError, onCompleted);
}
@yamalight

This comment has been minimized.

Show comment
Hide comment
@yamalight

yamalight Jul 7, 2015

yep, so, this function:

observe({channel, topic}) {
    return this.channel(channel).observe(topic);
}

produces this tree:

{ kind: 'method',
  static: false,
  variation: null,
  name: 'observe',
  memberof: 'src/rxmq.js~Rxmq',
  longname: 'src/rxmq.js~Rxmq#observe',
  access: 'public',
  description: null,
  lineNumber: 17,
  undocument: true,
  params: [ { description: undefined } ],
  return: { types: [ '*' ], description: undefined },
  generator: false,
  ___id: 'T000002R000031',
  ___s: true }

and as you can see, params is complete wrong here.

Trying to figure out why and maybe create a PR.

yep, so, this function:

observe({channel, topic}) {
    return this.channel(channel).observe(topic);
}

produces this tree:

{ kind: 'method',
  static: false,
  variation: null,
  name: 'observe',
  memberof: 'src/rxmq.js~Rxmq',
  longname: 'src/rxmq.js~Rxmq#observe',
  access: 'public',
  description: null,
  lineNumber: 17,
  undocument: true,
  params: [ { description: undefined } ],
  return: { types: [ '*' ], description: undefined },
  generator: false,
  ___id: 'T000002R000031',
  ___s: true }

and as you can see, params is complete wrong here.

Trying to figure out why and maybe create a PR.

@yamalight

This comment has been minimized.

Show comment
Hide comment
@yamalight

yamalight Jul 7, 2015

Interesting thing - if you manually create jsdoc that splits those params into single ones - it compiles OK

Interesting thing - if you manually create jsdoc that splits those params into single ones - it compiles OK

@h13i32maru

This comment has been minimized.

Show comment
Hide comment
@h13i32maru

h13i32maru Jul 8, 2015

Member

@yamalight Hi! Thank you for this issue!

This is known ESDoc problem. 😓

With documentation tag, success to build documentation.

class Foo {
  /**
   * @param {{a: string, b: number, c: boolean}} myObject - this is my object.
   */
  method({a, b, c}){}
}

But if without documentation tag, occur problem to build documentation.

class Foo {
  method({a, b, c}){}
}

Now, workaround is to use Object Param Syntax.
I will want to fix this issue in next version.

Member

h13i32maru commented Jul 8, 2015

@yamalight Hi! Thank you for this issue!

This is known ESDoc problem. 😓

With documentation tag, success to build documentation.

class Foo {
  /**
   * @param {{a: string, b: number, c: boolean}} myObject - this is my object.
   */
  method({a, b, c}){}
}

But if without documentation tag, occur problem to build documentation.

class Foo {
  method({a, b, c}){}
}

Now, workaround is to use Object Param Syntax.
I will want to fix this issue in next version.

@yamalight

This comment has been minimized.

Show comment
Hide comment
@yamalight

yamalight Jul 8, 2015

@h13i32maru yup, object params is exactly what I'd used so far.
thanks for quick response! 👍

@h13i32maru yup, object params is exactly what I'd used so far.
thanks for quick response! 👍

@loopmode

This comment has been minimized.

Show comment
Hide comment
@loopmode

loopmode Aug 29, 2016

It's kind of hard to figure out where in your source code the problem arises.

If this is not easily fixed, please at least print some helpful information so users can figure out how to avoid the problem.
Any tips besides editing esdoc sources to log/debug?

I did exactly that, edited esdoc sources, to figure out.
For others who encounter such problems, here is how I did it.

In my case, the error was this:

D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:483
            throw _iteratorError2;
            ^

TypeError: Cannot read property 'indexOf' of undefined
    at IdentifiersDocBuilder._buildSignatureHTML (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:1144:26)
    at D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:512:38
    at IceCap.loop (D:\Projects\NISV\source\client\client-core\node_modules\ice-cap\out\src\IceCap.js:261:9)
    at IdentifiersDocBuilder._buildSummaryDoc (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:509:11)
    at IdentifiersDocBuilder._buildSummaryHTML (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:468:29)
    at IdentifiersDocBuilder._buildIdentifierDoc (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\IdentifiersDocBuilder.js:77:40)
    at IdentifiersDocBuilder.exec (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\IdentifiersDocBuilder.js:52:32)
    at publish (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\publish.js:167:65)
    at Function.generate (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\ESDoc.js:204:7)
    at ESDocCLI.exec (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\ESDocCLI.js:90:28)

So, I edited node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js and placed this code in line 1144:

            if (!paramName) {
              console.warn('--------------------- CRASH LOG -----------------------');
              console.log(doc);
              console.warn('-------------------------------------------------------');
            }

and it helped me figure out the problematic sources:

--------------------- CRASH LOG -----------------------
{ __docId__: 3360,
  kind: 'function',
  static: true,
  variation: null,
  name: 'normalizeRangeAbs',
  memberof: 'src/mediaplayer/flux/helpers/assetRangeHelper.js',
  longname: 'src/mediaplayer/flux/helpers/assetRangeHelper.js~normalizeRangeAbs',
  access: 'public',
  export: true,
  importPath: 'client-core/src/mediaplayer/flux/helpers/assetRangeHelper.js',
  importStyle: '{normalizeRangeAbs}',
  description: null,
  lineNumber: 18,
  undocument: true,
  params:
   [ { description: undefined },
     { name: 'asset', types: [Object], description: undefined } ],
  return: { types: [ '*' ], description: undefined },
  generator: false,
  ___id: 'T000002R003362',
  ___s: true }
-------------------------------------------------------
D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:483
            throw _iteratorError2;
            ^

It's kind of hard to figure out where in your source code the problem arises.

If this is not easily fixed, please at least print some helpful information so users can figure out how to avoid the problem.
Any tips besides editing esdoc sources to log/debug?

I did exactly that, edited esdoc sources, to figure out.
For others who encounter such problems, here is how I did it.

In my case, the error was this:

D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:483
            throw _iteratorError2;
            ^

TypeError: Cannot read property 'indexOf' of undefined
    at IdentifiersDocBuilder._buildSignatureHTML (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:1144:26)
    at D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:512:38
    at IceCap.loop (D:\Projects\NISV\source\client\client-core\node_modules\ice-cap\out\src\IceCap.js:261:9)
    at IdentifiersDocBuilder._buildSummaryDoc (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:509:11)
    at IdentifiersDocBuilder._buildSummaryHTML (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:468:29)
    at IdentifiersDocBuilder._buildIdentifierDoc (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\IdentifiersDocBuilder.js:77:40)
    at IdentifiersDocBuilder.exec (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\IdentifiersDocBuilder.js:52:32)
    at publish (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\publish.js:167:65)
    at Function.generate (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\ESDoc.js:204:7)
    at ESDocCLI.exec (D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\ESDocCLI.js:90:28)

So, I edited node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js and placed this code in line 1144:

            if (!paramName) {
              console.warn('--------------------- CRASH LOG -----------------------');
              console.log(doc);
              console.warn('-------------------------------------------------------');
            }

and it helped me figure out the problematic sources:

--------------------- CRASH LOG -----------------------
{ __docId__: 3360,
  kind: 'function',
  static: true,
  variation: null,
  name: 'normalizeRangeAbs',
  memberof: 'src/mediaplayer/flux/helpers/assetRangeHelper.js',
  longname: 'src/mediaplayer/flux/helpers/assetRangeHelper.js~normalizeRangeAbs',
  access: 'public',
  export: true,
  importPath: 'client-core/src/mediaplayer/flux/helpers/assetRangeHelper.js',
  importStyle: '{normalizeRangeAbs}',
  description: null,
  lineNumber: 18,
  undocument: true,
  params:
   [ { description: undefined },
     { name: 'asset', types: [Object], description: undefined } ],
  return: { types: [ '*' ], description: undefined },
  generator: false,
  ___id: 'T000002R003362',
  ___s: true }
-------------------------------------------------------
D:\Projects\NISV\source\client\client-core\node_modules\esdoc\out\src\Publisher\Builder\DocBuilder.js:483
            throw _iteratorError2;
            ^

@alrykov

This comment has been minimized.

Show comment
Hide comment
@alrykov

alrykov Sep 19, 2016

I've got similar problem:

badge.svg
/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:483
            throw _iteratorError2;
            ^

TypeError: Cannot read property 'replace' of undefined
    at /usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:924:34
    at Array.map (native)
    at IdentifiersDocBuilder._buildTypeDocLinkHTML (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:919:41)
    at IdentifiersDocBuilder._buildSignatureHTML (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:1202:40)
    at /usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:512:38
    at IceCap.loop (/usr/local/lib/node_modules/esdoc/node_modules/ice-cap/out/src/IceCap.js:261:9)
    at IdentifiersDocBuilder._buildSummaryDoc (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:509:11)
    at IdentifiersDocBuilder._buildSummaryHTML (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:468:29)
    at IdentifiersDocBuilder._buildIdentifierDoc (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/IdentifiersDocBuilder.js:77:40)
    at IdentifiersDocBuilder.exec (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/IdentifiersDocBuilder.js:52:32)

added console log on 923 line

if (!tmp.length < 2) {
  console.warn('--------------------- CRASH LOG -----------------------');
  console.log(tmp);
  console.warn('-------------------------------------------------------');
}

and got log below

--------------------- CRASH LOG -----------------------
[ '*' ]
-------------------------------------------------------

hope it will be helpful

alrykov commented Sep 19, 2016

I've got similar problem:

badge.svg
/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:483
            throw _iteratorError2;
            ^

TypeError: Cannot read property 'replace' of undefined
    at /usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:924:34
    at Array.map (native)
    at IdentifiersDocBuilder._buildTypeDocLinkHTML (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:919:41)
    at IdentifiersDocBuilder._buildSignatureHTML (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:1202:40)
    at /usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:512:38
    at IceCap.loop (/usr/local/lib/node_modules/esdoc/node_modules/ice-cap/out/src/IceCap.js:261:9)
    at IdentifiersDocBuilder._buildSummaryDoc (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:509:11)
    at IdentifiersDocBuilder._buildSummaryHTML (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:468:29)
    at IdentifiersDocBuilder._buildIdentifierDoc (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/IdentifiersDocBuilder.js:77:40)
    at IdentifiersDocBuilder.exec (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/IdentifiersDocBuilder.js:52:32)

added console log on 923 line

if (!tmp.length < 2) {
  console.warn('--------------------- CRASH LOG -----------------------');
  console.log(tmp);
  console.warn('-------------------------------------------------------');
}

and got log below

--------------------- CRASH LOG -----------------------
[ '*' ]
-------------------------------------------------------

hope it will be helpful

@h13i32maru

This comment has been minimized.

Show comment
Hide comment
@h13i32maru

h13i32maru Dec 30, 2016

Member

Please check latest version.

Member

h13i32maru commented Dec 30, 2016

Please check latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment