Skip to content

Improve module ergonomics #1645

@hegemonic

Description

@hegemonic

JSDoc users have many well-justified complaints about the way JSDoc supports modules. Those complaints tend to fall into at least one of these categories:

  • Syntax compatibility. JSDoc's syntax for modules is not compatible with VS Code/TypeScript/Closure Compiler/(your favorite tool here).

    For example, module longnames must start with module: (for example, module:foo/bar), which other tools don't recognize.

  • Code-parsing smarts. JSDoc is not as good as it could be at extracting information from your code.

    For example, suppose the module a.js is documented as module:a and exports the class Foo, and the module b.js does something like const { Foo } = require('a'). JSDoc knows about module:a.Foo, and it knows that module b has a variable named Foo, but it doesn't figure out that they both refer to the same thing.

It would be worthwhile to support some other syntax that's compatible with popular tools (most notably TypeScript and Closure Compiler) and IDEs (most notably VS Code), and to extract more information automatically based on that syntax. We should not invent a new syntax that is incompatible with the rest of the JS/TS universe (contra xkcd). Also, we should continue to support the existing module syntax unless that's absolutely not possible.

Nota bene: Adding support for a different module syntax would almost certainly require large, pervasive changes to JSDoc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions