Skip to content

Commit

Permalink
Class leading comments order test
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-Knights committed Sep 11, 2024
1 parent bebc700 commit bf6b345
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
45 changes: 44 additions & 1 deletion test/dest/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,49 @@
"scope": "inner",
"memberof": "module:test"
},
{
"comment": "/** @ignore */",
"meta": {
"range": [
434,
465
],
"filename": "LeadingComments.js",
"lineno": 14,
"columnno": 0,
"code": {
"name": "exports.LeadingComments",
"type": "ClassDeclaration"
}
},
"ignore": true,
"name": "LeadingComments",
"longname": "LeadingComments",
"kind": "class",
"scope": "global"
},
{
"comment": "/**\n * Doclet\n */",
"meta": {
"range": [
441,
465
],
"filename": "LeadingComments.js",
"lineno": 14,
"columnno": 7,
"code": {
"name": "LeadingComments",
"type": "ClassDeclaration",
"paramnames": []
}
},
"classdesc": "Doclet",
"name": "LeadingComments",
"longname": "LeadingComments",
"kind": "class",
"scope": "global"
},
{
"comment": "/**\n * @module test/sub/NumberStore\n */",
"meta": {
Expand Down Expand Up @@ -465,4 +508,4 @@
"longname": "module:test/sub/NumberStore",
"kind": "member"
}
]
]
14 changes: 14 additions & 0 deletions test/src/sub/LeadingComments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Import statement required for JSDoc to include first comment as leading comment of the class.
// Otherwise, it gets moved in the AST to the `Program` node from the `ExportNamedDeclaration` class node:
// https://github.com/jsdoc/jsdoc/blob/main/packages/jsdoc-ast/lib/walker.js#L465
// This itself may be a bug, as it seems to be intended for @module comments.
import ''; // eslint-disable-line

/*
Comment
*/

/**
* Doclet
*/
export class LeadingComments {}

0 comments on commit bf6b345

Please sign in to comment.