jsdoc-babel is a JSDoc plugin that transforms ES6+ source files with Babel before JSDoc processes them. At version 0.5.0, it allows JSDoc to handle unsupported syntax (e.g., modern JavaScript, Flow, TypeScript) by leveraging Babel's transpilation pipeline. The plugin is lightweight, requires only @babel/core as a peer dependency, and integrates via JSDoc's configuration. It supports custom file extensions (default .js) and allows Babel options to be passed directly in the JSDoc config or via .babelrc. Compared to alternatives like jsdoc-babel-only, it is simpler and more directly tied to Babel 7+.
npm install jsdoc-babelVerified import paths — ran on the pinned version, not inferred.
JSDoc configuration that enables the plugin, processes .es6 and .jsx files, and passes Babel options directly (ignoring .babelrc).
Add the desired extensions to the 'babel.extensions' array in your JSDoc configuration.
Set 'babelrc': false in JSDoc config to disable .babelrc resolution, or ensure no conflicting options.
Monitor for updates or consider using JSDoc's built-in Babylon parser if you do not need Babel transforms.
Run 'npm install @babel/core --save-dev' to install the peer dependency.
Add the file extension to the 'babel.extensions' array in JSDoc config.
Ensure 'babel' config in JSDoc includes required presets (e.g., '@babel/preset-env') and set 'babelrc': false if you rely solely on JSDoc config.