Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unidentifiable Errors #11

Closed
benderTheCrime opened this issue Jun 11, 2015 · 8 comments
Closed

Unidentifiable Errors #11

benderTheCrime opened this issue Jun 11, 2015 · 8 comments

Comments

@benderTheCrime
Copy link

Thanks for putting together a library that generates ES6 docs! I ran into a few errors with a standard run:

esdoc.json:

{
  "source": "./src",
  "destination": "./doc",
  "autoPrivate": true,
  "coverage": true
}

errors:

/usr/local/lib/node_modules/esdoc/out/src/ESDoc.js:379
            throw _iteratorError5;
                  ^
TypeError: Cannot read property 'name' of null
    at DocFactory._joinSeparatedExport (/usr/local/lib/node_modules/esdoc/out/src/Factory/DocFactory.js:141:54)
    at new DocFactory (/usr/local/lib/node_modules/esdoc/out/src/Factory/DocFactory.js:87:10)
    at Function._traverse (/usr/local/lib/node_modules/esdoc/out/src/ESDoc.js:409:21)
    at /usr/local/lib/node_modules/esdoc/out/src/ESDoc.js:169:26
    at Function._walk (/usr/local/lib/node_modules/esdoc/out/src/ESDoc.js:363:13)
    at Function._walk (/usr/local/lib/node_modules/esdoc/out/src/ESDoc.js:365:18)
    at Function.generate (/usr/local/lib/node_modules/esdoc/out/src/ESDoc.js:112:12)
    at ESDocCLI.exec (/usr/local/lib/node_modules/esdoc/out/src/ESDocCLI.js:88:28)
    at Object.<anonymous> (/usr/local/lib/node_modules/esdoc/out/src/ESDocCLI.js:159:7)
    at Module._compile (module.js:410:26)
/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/SearchIndexBuilder.js:106
            throw _iteratorError;
                  ^
TypeError: Cannot read property 'kind' of undefined
    at SearchIndexBuilder._getOutputFileName (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:745:18)
    at SearchIndexBuilder._getOutputFileName (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:757:23)
    at SearchIndexBuilder._getURL (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/DocBuilder.js:728:29)
    at SearchIndexBuilder.exec (/usr/local/lib/node_modules/esdoc/out/src/Publisher/Builder/SearchIndexBuilder.js:76:24)
    at publish (/usr/local/lib/node_modules/esdoc/out/src/Publisher/publish.js:125:62)
    at Function.generate (/usr/local/lib/node_modules/esdoc/out/src/ESDoc.js:185:7)
    at ESDocCLI.exec (/usr/local/lib/node_modules/esdoc/out/src/ESDocCLI.js:88:28)
    at Object.<anonymous> (/usr/local/lib/node_modules/esdoc/out/src/ESDocCLI.js:159:7)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:428:10)

In the first case, I simply commented out the offending line:

    //if (node2.id.name !== node1.declaration.name) continue;

In the second, I wrapped the block in an if statement, which checked for the argument passed to the function:

    value: function _getOutputFileName(doc) {
        if (doc) {
            switch (doc.kind) {
                case 'variable':
                    return 'variable/index.html';
                // ...
            }
      }
}

In this way, I got the commands to work, but I'm not sure it generated proper docs.
Let me know if there is anything else I can do to help you reproduce. I would also like to see a config option to turn off stdout if there is not one already.

@h13i32maru
Copy link
Member

@benderTheCrime Hi! Thank you for reporting this issue! I want to fix the problems.

Let me know if there is anything else I can do to help you reproduce.

Could you tell me about the source codes or repository that reproduces the problems?

@benderTheCrime
Copy link
Author

https://github.com/benderTheCrime/angie in the gulpfile.babel.js.

@h13i32maru
Copy link
Member

@benderTheCrime I will try to fix the problem.

@Unruly-Coder
Copy link

This simple code crashes a standard run:

export default function() {
    return 'Do something';
}

I hope it will help you somehow.

@benderTheCrime
Copy link
Author

@Crazy-Ivan can you try doing a run with by aliasing the function and seeing if that helps?
Something like this:

export default function test() {
    return 'Do something';
}

I'm just trying to get a sense as to whether this issue is related generally to namespacing? I've noticed some weirdness in what is actually displayed once I've generated the docs as well. It does not show all of the exposed classes or functions.

@Unruly-Coder
Copy link

Yes, works like a charm if funcion/class etc has a name. The problem is with anonymous functions/classes. I think it is related to this issue #13

@h13i32maru
Copy link
Member

@Crazy-Ivan Hi
For now, ESDoc does not support anonymous class/function export(#13 export default function(){}). I think that I want to fix the issue in near future.

You can temporarily work around this issue by using @name (@name is un-official tag).

/**
 * @name thisFunctionName
 */
export default function(){
}

@h13i32maru
Copy link
Member

@benderTheCrime I fixed this issue and I will release the fixing in next version!

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

No branches or pull requests

3 participants