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

Extraction of some doc tags is failing #44

Closed
cuberoot opened this issue Jun 18, 2019 · 2 comments
Closed

Extraction of some doc tags is failing #44

cuberoot opened this issue Jun 18, 2019 · 2 comments

Comments

@cuberoot
Copy link

cuberoot commented Jun 18, 2019

Thanks for creating this great project! I am able to use it for some of our api doc extraction already.

I have hit two problems in my Typescript/LitElement project:

  1. If I add extra doc tags for things that are not automatically picked up, e.g. @fires change, those seem to be ignored
  2. Some of the tags from your examples trigger errors when scanning.

I am seeing errors like this:

Fatal error:  Invalid regular expression: /^(\s*?\{(?<type>.*)\})?(((?<name1>.+)(\s\-\s)(?<comment1>.+))|(\s?\-\s)(?<comment2>.+)|(?<name2>.*?))$/: Invalid group
SyntaxError: Invalid regular expression: /^(\s*?\{(?<type>.*)\})?(((?<name1>.+)(\s\-\s)(?<comment1>.+))|(\s?\-\s)(?<comment2>.+)|(?<name2>.*?))$/: Invalid group
    at parseJsDocTag (/Users/mitaylor/Scratch/wc-analyze-test/node_modules/web-component-analyzer/lib/index.cjs.js:241:17)

I have attached a simple test project that demonstrates this (wc-analyze-test.zip).

  1. Unzip the directory
  2. cd wc-analyze-test
  3. npm install
  4. npm run analyze

If I delete some of the tags from component.ts, it runs, but the @fires is ignored. Edit the JSDoc comment to look like:

/**
 * Here is a description of my web component.
 * 
 * @element my-element
 * 
 * @fires change - This jsdoc tag makes it possible to document events.
 * @fires submit
 */

Then try npm analyze again. It should run, but you won't see any mention of the change event in the output.

@runem
Copy link
Owner

runem commented Jun 19, 2019

Hi Michael, thanks for opening this issue! :-)

Regarding the regex problem I suspect you are running a version of Node less than 10. I use named capture groups and these came to Node in version 10. Sorry that I haven't documented the required Node version anywhere yet! In addition, maybe I can look into getting rid of named capture groups so that the required Node version can be lowered.

Regarding the @fires problem, right now documentation on the github repo is out of sync with the published version because I updated the documentation recently. However I just published version 0.1.9 of web-component-analyzer. I tested it on your test project, and it seems to work fine 🎉

@cuberoot
Copy link
Author

Thanks for the fast response! I was on Node v8. When I upgraded to v10 and to 0.1.9 of the analyzer, everything worked.

Thanks again for creating this. It was really timely for us!

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

No branches or pull requests

2 participants