Detalhes do pacote

prettier-plugin-jsdoc-type

ota-meshi7.6kMIT0.1.12

Prettier plugin for JSDoc type annotations

jsdoc, prettier-plugin

readme (leia-me)

prettier-plugin-jsdoc-type

Prettier plugin for formatting JSDoc type annotations.

This plugin is in the experimental stages of development.

Features

  • Formats JSDoc type annotations to a consistent TypeScript style.
  • Supports various JSDoc type syntax that TypeScript can parse, including object types, arrays, and unions.

Example:

Input:

/** @type {{a?:number,b?:string}} */
const obj = {}

/**
 * @param {{
 * type?:string,
 *  a?:number
 *   b?:string}} n
 * @returns {n   is Foo}
 */
function fn (n) {
  // do something
}

/** @import {Foo}from'bar'  */

Output:

/** @type {{ a?: number; b?: string }} */
const obj = {};

/**
 * @param {{
 *   type?: string;
 *   a?: number;
 *   b?: string;
 * }} n
 * @returns {n is Foo}
 */
function fn(n) {
  // do something
}

/** @import { Foo } from "bar"  */

Installation

npm install --save-dev prettier-plugin-jsdoc-type

Usage

You can use this plugin with Prettier by adding it to your Prettier configuration file:

{
  "plugins": ["prettier-plugin-jsdoc-type"]
}

What is the difference with prettier-plugin-jsdoc?

This plugin is focused on formatting JSDoc type annotations, while prettier-plugin-jsdoc is focused on formatting JSDoc comments.

This plugin supports some more JSDoc type definition syntax than prettier-plugin-jsdoc, such as @import and @returns {foo is Foo}. This plugin can also be combined with prettier-plugin-jsdoc.

changelog (log de mudanças)

prettier-plugin-jsdoc-type

0.1.12

Patch Changes

0.1.11

Patch Changes

0.1.10

Patch Changes

0.1.9

Patch Changes

0.1.8

Patch Changes

0.1.7

Patch Changes

0.1.6

Patch Changes

0.1.5

Patch Changes

0.1.4

Patch Changes

0.1.3

Patch Changes

0.1.2

Patch Changes

0.1.1

Patch Changes

0.1.0

Minor Changes