esdoc: Cannot read property 'length' of undefined

Short summary of your issue

When i run esdoc, esdoc reports an error.

Input data for reproducing

Configuration

{
  "source": "./app",
  "destination": "./doc",
  "experimentalProposal": {
    "objectRestSpread": true
  }
}

Codes

repo

Output data

Log

yarn docs v0.21.3                                                                                                                                                                                 
$ esdoc                                                                                                                                                                                           
parse: /home/dimensi/projects/camellia/app/api/initPage.js                                                                                                                                        
parse: /home/dimensi/projects/camellia/app/background.js                                                                                                                                          
parse: /home/dimensi/projects/camellia/app/constants/newtab.js                                                                                                                                    
parse: /home/dimensi/projects/camellia/app/helpers/functions.js                                                                                                                                   
parse: /home/dimensi/projects/camellia/app/newtab.js                                                                                                                                              
parse: /home/dimensi/projects/camellia/app/options.js                                                                                                                                             
parse: /home/dimensi/projects/camellia/app/store/newtab.js                                                                                                                                        
parse: /home/dimensi/projects/camellia/app/store/options.js                                                                                                                                       
parse: /home/dimensi/projects/camellia/app/vendors/js/browser-polyfill.js                                                                                                                         
resolve: extends chain                                                                                                                                                                            
resolve: necessary                                                                                                                                                                                
resolve: access                                                                                                                                                                                   
resolve: unexported identifier                                                                                                                                                                    
resolve: undocument identifier                                                                                                                                                                    
resolve: duplication                                                                                                                                                                              
resolve: ignore                                                                                                                                                                                   
resolve: link                                                                                                                                                                                     
resolve: markdown in description                                                                                                                                                                  
resolve: test relation                                                                                                                                                                            
output: badge.svg                                                                                                                                                                                 
output: identifiers.html                                                                                                                                                                          
output: index.html                                                                                                                                                                                
output: function/index.html                                                                                                                                                                       
output: variable/index.html                                                                                                                                                                       
output: file/app/api/initPage.js.html                                                                                                                                                             
output: file/app/background.js.html                                                                                                                                                               
output: file/app/constants/newtab.js.html                                                                                                                                                         
output: file/app/helpers/functions.js.html                                                                                                                                                        
output: file/app/newtab.js.html                                                                                                                                                                   
output: file/app/options.js.html                                                                                                                                                                  
output: file/app/store/newtab.js.html                                                                                                                                                             
output: file/app/store/options.js.html                                                                                                                                                            
output: file/app/vendors/js/browser-polyfill.js.html                                                                                                                                              
output: ./css                                                                                                                                                                                     
output: ./script                                                                                                                                                                                  
output: ./image                            
output: script/search_index.js                                                                                                                                                                    
output: source.html                                                                                                                                                                               
==================================                                                                                                                                                                
Coverage: 62.5% (5/8)                                                                                                                                                                             
==================================                                                                                                                                                                
                                                                                                                                                                                                  
TypeError: Cannot read property 'length' of undefined                                                                                                                                             
    at LintDocBuilder._showResult (/home/dimensi/projects/camellia/node_modules/esdoc/out/src/Publisher/Builder/LintDocBuilder.js:150:64)                                                         
    at LintDocBuilder.exec (/home/dimensi/projects/camellia/node_modules/esdoc/out/src/Publisher/Builder/LintDocBuilder.js:52:10)                                                                 
    at publish (/home/dimensi/projects/camellia/node_modules/esdoc/out/src/Publisher/publish.js:177:48)                                                                                           
    at Function.generate (/home/dimensi/projects/camellia/node_modules/esdoc/out/src/ESDoc.js:137:7)                                                                                              
    at ESDocCLI.exec (/home/dimensi/projects/camellia/node_modules/esdoc/out/src/ESDocCLI.js:75:23)                                                                                               
    at Object.<anonymous> (/home/dimensi/projects/camellia/node_modules/esdoc/out/src/ESDocCLI.js:186:7)                                                                                          
    at Module._compile (module.js:571:32)                                                                                                                                                         
    at Object.Module._extensions..js (module.js:580:10)                                                                                                                                           
    at Module.load (module.js:488:32)                                                                                                                                                             
    at tryModuleLoad (module.js:447:12)                                                                                                                                                           
                                                                                                                                                                                                  
error Command failed with exit code 1.      

Screen shot of documentation

image

Your environment

  • OS type and version: ubuntu 16.04
  • Node.js version: 7.7.2
  • ESDoc version: 0.5.2

I try console.log it.

image


undefined                                                                                                                                                                                         
{ node:                                                                                                                                                                                           
   { type: 'ArrowFunctionExpression',                                                                                                                                                             
     start: 2045,                                                                                                                                                                                 
     end: 2124,                                                                                                                                                                                   
     loc: { start: [Object], end: [Object] },                                                                                                                                                     
     id:                                                                                                                                                                                          
      { type: 'Identifier',                                                                                                                                                                       
        start: 2030,                                                                                                                                                                              
        end: 2042,                                                                                                                                                                                
        loc: [Object],                                                                                                                                                                            
        name: 'getRandomInt',                                                                                                                                                                     
        leadingComments: null },                                                                                                                                                                  
     generator: false,                                                                                                                                                                            
     expression: false,                                                                                                                                                                           
     async: false,                                                                                                                                                                                
     params: [ [Object], [Object] ],                                                                                                                                                              
     body:                                                                                                                                                                                        
      { type: 'BlockStatement',                                                                                                                                                                   
        start: 2059,                                                                                                                                                                              
        end: 2124,                                                                                                                                                                                
        loc: [Object],                                                                                                                                                                            
        body: [Object],                                                                                                                                                                           
        directives: [],                                                                                                                                                                           
        trailingComments: null },                                                                                                                                                                 
     trailingComments: null },                                                                                                                                                                    
  doc:                                                                                                                                                                                            
   { __docId__: 11,                                                                                                                                                                               
     kind: 'function',                                                                                                                                                                            
     name: 'getRandomInt',                                                                                                                                                                        
     memberof: 'app/helpers/functions.js',                                                                                                                                                        
     generator: false,                                                                                                                                                                            
     async: false,                                                                                                                                                                                
     static: true,                                                                                                                                                                                
     longname: 'app/helpers/functions.js~getRandomInt',                                                                                                                                           
     access: 'public',                                                                                                                                                                            
     export: true,                                                                                                                                                                                
     importPath: 'camellia/app/helpers/functions.js',                                                                                                                                             
     importStyle: '{getRandomInt}',                                                                                                                                                               
     description: '<p>Generates random integer in given range.</p>\n',                                                                                                                            
     lineNumber: 98,                                                                                                                                                                              
     since: '1.0.0',                                                                                                                                                                              
     params: [ [Object], [Object] ],                                                                                                                                                              
     return:                                                                                                                                                                                      
      { nullable: null,                                                                                                                                                                           
        types: [Object],                                                                                                                                                                          
        spread: false,                                                                                                                                                                            
        description: '<p>array Random integer.</p>\n',                                                                                                                                            
        descriptionRaw: 'array Random integer.' },                                                                                                                                                
     ___id: 'T000002R000013',                                                                                                                                                                     
     ___s: true,                                                                                                                                                                                  
     descriptionRaw: 'Generates random integer in given range.' },         
  codeParams: [ 'min', 'max' ],                                                                                                                                                                   
  docParams: [ 'int', 'int' ] }       

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 18

Most upvoted comments

Would be good if it threw the error where it happens 👍

Just had a similar problem and found out that if you do object destructuring you should specify the object being destructured as single parameter.

For instance, the following code will fail:

/**
 * My function
 * @param var1
 * @param var2
 */
const myFunction = ({var1, var2}) => {}

you can make it work by changing it for something like this:

/**
 * My function
 * @param param
 * @param param.var1
 * @param param.var2
 */
const myFunction = ({var1, var2}) => {}

Notice that the name param is arbitrary and doesn’t need to be explicitly set on your code.

Any chance we can get an error message showing us where the offending line is?

I had the same error, and I corrected it by removing one extra @param tag. But if it does not resolve your problem, turn the linter off by adding this to your esdoc config file { "lint": false }

See more here #384