jsdoc: "Export default class" doesn't work as expected
When generating documentation for the code snippet below, the “Classes” menu on the right shows “exports” instead of “Car”. Also, it shows “new exports()” instead of “new Car()” on its documentation page.
/**
* @property {number} id ID of the car.
*/
export default class Car {
}
The code below works fine, though:
/**
* @property {number} id ID of the car.
*/
class Car {
}
export default Car;
About this issue
- Original URL
- State: open
- Created 9 years ago
- Reactions: 9
- Comments: 28 (2 by maintainers)
Commits related to this issue
- jsdoc works (but bug prevents display `export class X extends Y` is broken in 3.6. See: https://github.com/jsdoc/jsdoc/issues/1132 Two examples in scale of putting export on own line works, but hack... — committed to cuthbertLab/music21j by mscuthbert 5 years ago
- WIP - add jsdoc style comments This is WIP because of an issue with jsdoc, meaning that "export default class" doesn't document properly. There's no point continuing until that bug is fixed. https://... — committed to nhsuk/user-feedback-form by mikemonteith 4 years ago
- fix(jsdoc): export default classes after declaration to fix doc https://github.com/jsdoc/jsdoc/issues/1132 — committed to Geoportail-Luxembourg/geoportailv3 by tkohr 2 years ago
- fix(jsdoc): export default classes after declaration to fix doc https://github.com/jsdoc/jsdoc/issues/1132 — committed to Geoportail-Luxembourg/geoportailv3 by tkohr 2 years ago
- CM6: Add jsdoc build step, fix JSDoc annotations, and add @stable tags There is a known bug with JSDoc and using `export default`. These must be separate statements for JSDoc to parse properly. See h... — committed to wikimedia/mediawiki-extensions-CodeMirror by MusikAnimal 3 months ago
- Update git submodules * Update CodeMirror from branch 'master' to f91f08947c6b494ca625827631d22fed07901bd1 - Merge "CM6: Add jsdoc build step, fix JSDoc annotations, and add @stable tags" - CM6... — committed to wikimedia/mediawiki-extensions by deleted user 3 months ago
@hegemonic Can we reopen this issue since it is still not working.
Also experiencing this issue in 3.5.5.
Me too, 3.5.5.
Still the same issue with @3.5.4
Builds to: https://i.gyazo.com/7645bcde76062f5e92598d3a5c6ae900.png
The file has
@module
tag Movingexport default hasEmptyValues
after function declaration seems to fix itStill there in JSDoc 4.0.2
Same on 3.6.3
Facing this issue too. When creating a class extending another, it still generates a exports class
I was experiencing a similar issue with ES6 classes which extended another class. After looking into jsdoc-export-default-interop, it looked to me like the regex doesn’t account for
extends
.So I issued a PR last week which seems to fix my scenario, hopefully @nathanmarks will be happy to merge it. I’d be interested to learn if this impacts anyone else.
I missed the fact that the examples are missing a
@module
tag, which JSDoc needs in order to know that it’s parsing a module. Once you add that, everything works as expected (at least on GitHub master):The current GitHub master will be released soon as JSDoc 3.5.0.
I’ve found
jsdoc-export-default-interop
plugin on npm that fixes the bug. Still, I hope it’ll be fixed in the jsdoc3 without any side plugins.I’m seeing this with jsdoc 3.4.3
3.6.2 it doesn’t work yet 😦 I had to put it like
@hegemonic Still having that issue with the master branch:
Results in:
Works fine with defining the class and exporting it in a second line
Same issue with
export default function