-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
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 asmodule:a
and exports the classFoo
, and the moduleb.js
does something likeconst { Foo } = require('a')
. JSDoc knows aboutmodule:a.Foo
, and it knows that moduleb
has a variable namedFoo
, 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.