Registry / serialization / jsdoc-babel

jsdoc-babel

JSON →
library0.5.0jsnpmunverified

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-babel
INSTALL
IMPORT
SIG · JSDOC-BABEL
J
jsdoc-babel
serializationjavascriptv0.5.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

jsdoc-babel plugin
Use the string 'node_modules/jsdoc-babel' in JSDoc config's plugins array.
import jsdocBabel from 'jsdoc-babel'
This is a JSDoc plugin, not a regular npm module. It is loaded by JSDoc at runtime via configuration, not by import/require.
Babel options
Add 'babel' key to JSDoc config JSON. Example: { 'plugins': ['node_modules/jsdoc-babel'], 'babel': { 'presets': ['@babel/env'] } }
Using .babelrc without overriding in JSDoc config - options merge may cause conflicts.
Options defined in JSDoc config take precedence over .babelrc. Set 'babelrc': false to disable .babelrc resolution.
File extensions
Specify 'babel.extensions' array in JSDoc config to include additional extensions like 'es6', 'jsx'.
Assuming all file extensions are processed automatically.
Default extension is only '.js'. Add custom extensions explicitly.

JSDoc configuration that enables the plugin, processes .es6 and .jsx files, and passes Babel options directly (ignoring .babelrc).

{ "plugins": ["node_modules/jsdoc-babel"], "babel": { "extensions": ["js", "es6", "jsx"], "presets": ["@babel/preset-env"], "babelrc": false } }
Debug
Known issues
gotchaPlugin only processes files with .js extension by default. Files with other extensions (e.g., .es6, .jsx) will not be transformed unless you add them to the 'babel.extensions' array.
fix
Add the desired extensions to the 'babel.extensions' array in your JSDoc configuration.
affects: >=0.1
gotchaOptions defined in JSDoc config take precedence over those in .babelrc. Unexpected merging behavior can occur if both are present.
fix
Set 'babelrc': false in JSDoc config to disable .babelrc resolution, or ensure no conflicting options.
affects: >=0.1
deprecatedThe plugin uses the older Babel 7 API (babel.transform), which may not support newer Babel 7.x features or preset syntax. Future Babel versions might break compatibility.
fix
Monitor for updates or consider using JSDoc's built-in Babylon parser if you do not need Babel transforms.
affects: 0.5.x
Errors
Common errors & fixes
Error: JSDoc plugin "node_modules/jsdoc-babel" failed to load: Cannot find module '@babel/core'
@babel/core is a peer dependency; not installed.
fix
Run 'npm install @babel/core --save-dev' to install the peer dependency.
Error: Unable to parse source file: ... You may need an appropriate loader to handle this file type.
JSDoc cannot parse a non-.js file because the plugin's extensions list does not include that file's extension.
fix
Add the file extension to the 'babel.extensions' array in JSDoc config.
JSDoc reports no documented source files.
Plugin transforms fail silently, leaving files unparsed because .babelrc is ignored or misconfigured.
fix
Ensure 'babel' config in JSDoc includes required presets (e.g., '@babel/preset-env') and set 'babelrc': false if you rely solely on JSDoc config.
Upgrade
Version history
0.5.0latest on npm
Audit
Dependencies
@babel/corerequiredPeer dependency required for Babel transformations.
Agent activity
6 hits · last 30 days
node
6
Resources
jsdoc-babel — npm install jsdoc-babel · libregistry