prettier-plugin-drone-jsdoc
raw JSON → 1.8.0 verified Sat Apr 25 auth: no javascript
A Prettier plugin for formatting JSDoc comments, forked from prettier-plugin-jsdoc. Current stable version is 1.8.0, updated regularly. Key differentiator: removes leading whitespace on the first line of multi-line block comments, aligning with the Drone style guide. Requires Prettier ^3.0.0, supports Node >=14.13.1 or >=16.0.0, and ships TypeScript type declarations.
Common errors
error Error: Cannot find module 'prettier-plugin-drone-jsdoc' ↓
cause Plugin not installed or not in node_modules.
fix
Install the plugin via npm: 'npm install --save-dev prettier-plugin-drone-jsdoc'
error TypeError: plugin is not a function ↓
cause Incorrectly importing plugin as a function instead of using it in Prettier config.
fix
Add the plugin to the 'plugins' array in .prettierrc instead of calling it directly.
Warnings
benign Plugin modifies the first line of multi-line block comments, which may not be desired for all projects. ↓
fix Disable the plugin or adjust configuration to preserve original formatting.
Install
npm install prettier-plugin-drone-jsdoc yarn add prettier-plugin-drone-jsdoc pnpm add prettier-plugin-drone-jsdoc Imports
- default wrong
const plugin = require('prettier-plugin-drone-jsdoc')correctimport plugin from 'prettier-plugin-drone-jsdoc' - PluginOptions
import type { PluginOptions } from 'prettier-plugin-drone-jsdoc' - options wrong
const { options } = require('prettier-plugin-drone-jsdoc'); // options is not a functioncorrectimport { options } from 'prettier-plugin-drone-jsdoc'; // used within a Prettier config object
Quickstart
// .prettierrc
{
"plugins": ["prettier-plugin-drone-jsdoc"],
"jsdocCommentLineStrategy": "singleLine",
"jsdocSeparateReturnsFromParams": true
}