JSDoc is an API documentation generator for JavaScript, enabling developers to create static HTML documentation websites directly from specially formatted comments within their source code. It supports modern JavaScript features, including ES2015 classes and modules, through its use of the Babylon (now @babel/parser) JavaScript parser. The project is actively maintained, with the current stable version being 4.0.5, and receives irregular but consistent updates focused on bug fixes, Node.js compatibility, and parser improvements. Key differentiators include its long-standing presence in the JavaScript ecosystem (since 1999), flexible configuration options via JSON or JavaScript files, and a rich community ecosystem offering numerous custom templates and build tool integrations (e.g., Grunt, Gulp). JSDoc allows for comprehensive annotation of functions, classes, modules, and parameters, facilitating improved code readability, maintainability, and providing rich IntelliSense support in modern IDEs.
npm install jsdocVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install JSDoc locally, add JSDoc comments to a JavaScript class, and generate HTML documentation into a './docs' directory using an npm script.
Ensure your JSDoc plugins and templates are compatible with the updated parser. Review generated documentation for any unexpected changes, especially for ES2015+ features. If encountering issues, check the JSDoc changelog or GitHub issues for known parser-related incompatibilities.
If migrating an older configuration, ensure your configuration file is either valid JSON or correctly formatted JavaScript that exports the configuration object. Update your JSDoc command-line arguments (e.g., `-c`) if the filename or extension changes.
Always check the `engines.node` field in `package.json` or the official documentation (`jsdoc.app`) for the required Node.js version for your specific JSDoc release. Update your Node.js environment if necessary.
Ensure all comments intended for documentation strictly begin with `/**`. Avoid extra asterisks or single-asterisk block comments for JSDoc-parsed blocks.
Upgrade to JSDoc 3.5.2 or later to ensure the `@hideconstructor` tag functions as expected with the default template. If using a custom template, verify its implementation of this tag.
Use `npm install -g jsdoc --force` or fix npm permissions using `sudo npm install -g jsdoc` (less recommended due to security implications, better to fix npm's directory permissions). Refer to npm's documentation on 'resolving EACCES permissions errors'.
If installed locally, run it using `./node_modules/.bin/jsdoc yourJavaScriptFile.js` or define an npm script in `package.json` like `"docs": "jsdoc -c jsdoc.json"` and run with `npm run docs`.
Upgrade JSDoc to version 3.5.0 or newer. This version introduced the Babylon parser, providing robust support for contemporary JavaScript and JSX.
Ensure all desired JSDoc blocks start with `/**`. Check for extra asterisks (`/***`) or single-asterisk block comments (`/*`). Verify that comments are immediately preceding the code they document. Upgrade to JSDoc 3.5.3 or later for fixes related to comment parsing in specific scenarios (e.g., end-of-file comments, specific namepaths).
No dependency data recorded yet.