Using `export` keeps us from seeing class constructor param names
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 290
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
When you use export, the value of meta.code.name within the class's doclet takes on the value "exports.PioneerUtils", rather than simply "PioneerUtils". This seems to prevent the usual merging of the constructor's doclet with the class's, since the constructor's retains the shorter, different name "PioneerUtils" no matter what. Thus, the class does not take on the constructor's meta.code.paramnames array of ["config"].
Reduction:
/**
* Utilities for making Pioneer Studies.
*/
export class PioneerUtils {
/**
* @param {Config} config
*/
constructor(config) {
this.config = config;
this.encrypter = null;
}
}
Run jsdoc -X 3.5.5 over that, then remove export and do it again. The interesting parts of the diff are these:
16,17c16,20
< "name": "exports.PioneerUtils",
< "type": "ClassDeclaration"
---
> "name": "PioneerUtils",
> "type": "ClassDeclaration",
> "paramnames": [
> "config"
> ]
37,62d39
< "comment": "",
< "meta": {
< "range": [
< 56,
< 197
< ],
< "filename": "PioneerUtils.js",
< "lineno": 4,
< "columnno": 7,
< "path": "/Users/erose/Checkouts/pioneer-studies-addon-utils/src",
< "code": {
< "id": "astnode100000003",
< "name": "PioneerUtils",
< "type": "ClassDeclaration",
< "paramnames": [
< "config"
< ]
< }
< },
< "undocumented": true,
< "name": "PioneerUtils",
< "longname": "PioneerUtils",
< "kind": "class",
< "scope": "global"
< },
< {
This strikes me as something that might be best fixed in jsdoc itself.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run jsdoc -X 3.5.5 on the reduced PioneerUtils.js example with and without export, then compare the class and constructor metadata shown in the issue. Trace where the exported class name is assigned and where constructor paramnames are merged; done means the exported class retains PioneerUtils and its config paramnames, or the issue is confirmed to belong in jsdoc itself.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100