Improved support for class fields and properties
See original GitHub issueHey there, I’ve got a class that uses the ES7 Class Fields and Properties proposal (as outlined https://github.com/jeffmo/es-class-fields-and-static-properties)
I’ve noticed that some of my properties get recognised and added to the documentation, but some do not. The ones that do get picked up are typically the uninitialised ones or ones with null, and the ones which are ignored are typically the ones with a default value assigned.
Example:
class Tracker {
allowedLibraries = {
'GTM': new GtmTracker(),
'KISS': new KissTracker(),
'Optimizely': new OptimizelyTracker()
};
eventQueueName = 'tracker_stuff';
eventQueue = null;
get queueLength() {
return this.eventQueue.length;
}
// ... rest of code
}
Only two of these members appear in the docs:

I’ve got the esdoc-es7-plugin installed and added to my config. Here are my installed versions:
"esdoc": "^0.4.7",
"esdoc-es7-plugin": "0.0.3",
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Faster initialization of instances with new class features
The initialization of class fields and private methods was much slower than the assignment of ordinary properties. The class field initializers ...
Read more >c# - Properties vs. Fields: Need help grasping the uses of ...
I always use properties to get and set methods where possible. ... Using fields is usually practiced in private classes that is not...
Read more >Public class fields - JavaScript - MDN Web Docs - Mozilla
Both static and instance public fields are writable, enumerable, and configurable properties. As such, unlike their private counterparts, they participate ...
Read more >Add Support for Class Fields · Issue #2731 · google/closure ...
I wish to see this feature soon in closure compiler, having static fields helps a lot in class feature encapsulation. class A {...
Read more >Backing Fields - EF Core
Backing fields allow EF to read and/or write to a field rather than a property. This can be useful when encapsulation in the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yeah… That is a Babylon AST node & not ESTree… Well. It’s still possible to use the main ESDoc repo as you could get “sneaky” with a plugin. IE you could add babylon as a dependency for the plugin and in
onHandleCode
you could parse it and save the AST tree to consume and add extra tags duringonHandleTags
adding the ClassProperty node data to the variable / member data of the class.In my fork the AST is waiting there to be handled in
onHandleAST
, but the above trick is so close to being the same. I’d really like to upstream the babylon fork I have though. The Babylon AST is essentially a superset more or less of ESTree syntax.The
esdoc-es7-plugin
just ignores ES7 syntax, but is also out of date, so it doesn’t support anything related to ES7 as things go.I can’t say this will help you, but I have a fork of ESDoc that supports Babylon for parsing with all Babylon plugins enabled by default here. It’s unpublished on NPM so you have to link to the Github repo. It would be interesting to see what the results would be with you example though.