npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

@code-pushup/jsdocs-plugin

v0.113.0

Published

Code PushUp plugin for tracking documentation coverage πŸ“š

Downloads

1,784

Readme

@code-pushup/jsdocs-plugin

npm downloads dependencies

πŸ“š Code PushUp plugin for tracking documentation coverage. πŸ“

This plugin allows you to measure and track documentation coverage in your TypeScript/JavaScript project. It analyzes your codebase and checks for documentation on different code elements like classes, functions, interfaces, types, and variables.

Measured documentation types are mapped to Code PushUp audits in the following way:

  • value: The value is the number of undocumented nodes -> 4
  • displayValue: ${value} undocumented ${type} -> 4 undocumented functions
  • score: 0.5 -> total nodes 8, undocumented 4 -> 4/8
  • The score is value converted to 0-1 range
  • Missing documentation is mapped to issues in the audit details (undocumented classes, functions, interfaces, etc.)

Getting started

  1. If you haven't already, install @code-pushup/cli and create a configuration file.

  2. Install as a dev dependency with your package manager:

    npm install --save-dev @code-pushup/jsdocs-plugin
    yarn add --dev @code-pushup/jsdocs-plugin
    pnpm add --save-dev @code-pushup/jsdocs-plugin
  3. Add this plugin to the plugins array in your Code PushUp CLI config file (e.g. code-pushup.config.ts).

    import jsDocsPlugin from '@code-pushup/jsdocs-plugin';
    
    export default {
      // ...
      plugins: [
        // ...
        jsDocsPlugin(['**/*.ts']),
      ],
    };
  4. (Optional) Reference individual audits or the provided plugin group which you wish to include in custom categories (use npx code-pushup print-config to list audits and groups).

    πŸ’‘ Assign weights based on what influence each documentation type should have on the overall category score (assign weight 0 to only include as extra info, without influencing category score).

    export default {
      // ...
      categories: [
        {
          slug: 'documentation',
          title: 'Documentation',
          refs: [
            {
              type: 'group',
              plugin: 'jsdocs',
              slug: 'jsdocs',
              weight: 1,
            },
            // ...
          ],
        },
        // ...
      ],
    };
  5. Run the CLI with npx code-pushup collect and view or upload report (refer to CLI docs).

About documentation coverage

Documentation coverage is a metric that indicates what percentage of your code elements have proper documentation. It helps ensure your codebase is well-documented and maintainable.

The plugin provides multiple audits, one for each documentation type (classes, functions, interfaces, etc.), and groups them together for an overall documentation coverage measurement. Each audit:

  • Measures the documentation coverage for its specific type (e.g., classes, functions)
  • Provides a score based on the percentage of documented elements
  • Includes details about which elements are missing documentation

These audits are grouped together to provide a comprehensive view of your codebase's documentation status. You can use either:

  • The complete group of audits for overall documentation coverage
  • Individual audits to focus on specific documentation types

Plugin architecture

Plugin configuration specification

The plugin accepts the following parameters:

patterns

Required parameter. The patterns option accepts an array of strings that define patterns to include or exclude files. You can use glob patterns to match files and the ! symbol to exclude specific patterns. Example:

jsDocsPlugin({
  patterns: [
    'src/**/*.ts',              // include all TypeScript files in src
    '!src/**/*.{spec,test}.ts', // exclude test files
    '!src/**/testing/**/*.ts'   // exclude testing utilities
  ],
}),

OnlyAudits

Optional parameter. The onlyAudits option allows you to specify which documentation types you want to measure. Only the specified audits will be included in the results. Example:

jsDocsPlugin({
  patterns: ['src/**/*.ts'],
  onlyAudits: [
    'classes-coverage',
    'functions-coverage'
  ] // Only measure documentation for classes and functions
}),

SkipAudits

Optional parameter. The skipAudits option allows you to exclude specific documentation types from measurement. All other types will be included in the results.

jsDocsPlugin({
  patterns: ['src/**/*.ts'],
  skipAudits: [
    'variables-coverage',
    'interfaces-coverage'
  ] // Measure all documentation types except variables and interfaces
}),

[!WARNING] You cannot use both onlyAudits and skipAudits in the same configuration. Choose the one that better suits your needs.

Audits and group

This plugin provides a group for convenient declaration in your config. When defined this way, all measured documentation type audits have the same weight.

     // ...
     categories: [
       {
         slug: 'documentation',
         title: 'Documentation',
         refs: [
           {
             type: 'group',
             plugin: 'jsdocs',
             slug: 'jsdocs',
             weight: 1,
           },
           // ...
         ],
       },
       // ...
     ],

Each documentation type still has its own audit. So when you want to include a subset of documentation types or assign different weights to them, you can do so in the following way:

     // ...
     categories: [
       {
         slug: 'documentation',
         title: 'Documentation',
         refs: [
           {
             type: 'audit',
             plugin: 'jsdocs',
             slug: 'class-jsdocs',
             weight: 2,
           },
           {
             type: 'audit',
             plugin: 'jsdocs',
             slug: 'function-jsdocs',
             weight: 1,
           },
           // ...
         ],
       },
       // ...
     ],

Audit output

The plugin outputs a single audit that measures the overall documentation coverage percentage of your codebase.

For instance, this is an example of the plugin output:

{
  "packageName": "@code-pushup/jsdocs-plugin",
  "version": "0.57.0",
  "title": "Documentation coverage",
  "slug": "jsdocs",
  "icon": "folder-src",
  "duration": 920,
  "date": "2024-12-17T16:45:28.581Z",
  "audits": [
    {
      "slug": "percentage-coverage",
      "displayValue": "16 %",
      "value": 16,
      "score": 0.16,
      "details": {
        "issues": []
      },
      "title": "Percentage of codebase with documentation",
      "description": "Measures how many % of the codebase have documentation."
    }
  ],
  "description": "Official Code PushUp documentation coverage plugin.",
  "docsUrl": "https://www.npmjs.com/package/@code-pushup/jsdocs-plugin/",
  "groups": [
    {
      "slug": "jsdocs",
      "refs": [
        {
          "slug": "percentage-coverage",
          "weight": 1
        }
      ],
      "title": "Documentation coverage metrics",
      "description": "Group containing all defined documentation coverage types as audits."
    }
  ]
}