angular / dgeni-packages

A collection of dgeni packages for generating documentation from source code.
MIT License
142 stars 101 forks source link

Warnings when using import #250

Closed stofolus closed 6 years ago

stofolus commented 6 years ago

I'm getting warnings when the jsdoc name processor encounters an es2015 import statement. Is this supposed to throw a warning?

If not I could add a new matcher for it but I'd like some help with how it should be handled

petebacondarwin commented 6 years ago

I guess that we should be ignoring imports?

stofolus commented 6 years ago

Is ignoring done by return null from the matcher?

petebacondarwin commented 6 years ago

@wingedfox ??

wingedfox commented 6 years ago

Afais there's no matcher for import so it is OK to see a warning there. I don't know details of import node in AST but there should be a left subtree with the local names for imports and right subtree with the module name. The question with import is in case of multiple imports where we've to decide which name to take. Perhaps matching left subtree is sufficient to find a name. Take a look at https://github.com/angular/dgeni-packages/blob/master/jsdoc/services/code-name-matchers/assignment-expression.js

wingedfox commented 6 years ago

I guess that we should be ignoring imports?

I'm not sure whether it is OK to ignore import names because later export may expose it to the consumer.

Is ignoring done by return null from the matcher?

You're right.

petebacondarwin commented 6 years ago

Still not convinced it makes sense to capture the name of imports... but I guess it does no harm.

stofolus commented 6 years ago

I can change it to return null instead if thats preferred?

petebacondarwin commented 6 years ago

No, I just think it will not be useful.

petebacondarwin commented 6 years ago

I'm not sure whether it is OK to ignore import names because later export may expose it to the consumer.

@wingedfox - if an export exposes an import then we would get the name from the export not the import, right?