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 🙏

© 2024 – Pkg Stats / Ryan Hefner

jsdoc-todo

v1.0.2

Published

Turn "to do" comments in your JavaScript code into a handy checklist in your project's README.md (or a different) file..

Downloads

18

Readme

JSDoc To Do

Turn "to do" comments in your JavaScript code into a handy checklist in your project's README.md (or a different) file.

Features

  • Extracts "to do" items into an easily accessible checklist.
  • Links each "to do" item to its source file and line number.
  • Marks "to do" items as completed directly in JS files.
  • Updates "to do" list when @todo or @todolist comments are added or removed.

Installation

npm install -D jsdoc-todo

Usage

  1. Add the below to your JSDoc configuration file.

    // jsdoc.config.js
    const { todoPlugin } = require("jsdoc-todo");
    
    module.exports = {
      plugins: [todoPlugin],
    };

    OR

    // jsdoc.config.json
    {
      "plugins": ["node_modules/jsdoc-todo/jsdoc-todo.js"]
    }
  2. Run jsdoc with the configuration file created in the previous step.

    jsdoc -c path/to/jsdoc-config-file .

[!NOTE] jsdoc-todo writes the generated "to do" list to a project's README.md file by default. If you wish to have jsdoc-todo write the generated "to do" list to a different file, add a todoPlugin.outFile property to the project's JSDoc configuration file as shown below.

const { todoPlugin } = require("jsdoc-todo");

module.exports = {
  plugins: [todoPlugin],
  todoPlugin: {
    outFile: "some/other/file.md",
  },
};

OR

{
  "plugins": ["node_modules/jsdoc-todo/jsdoc-todo.js"],
  "todoPlugin": {
    "outFile": "some/other/file.md"
  }
}

[!TIP] See todoPlugin for all todoPlugin configuration options.

Example

Input

/**
 * @todolist
 * The below will match anything that's an instance of Object (i.e., Arrays, Maps etc.). Use `Object.prototype.toString.call(arg)` instead.
 * Don't forget to test it before your next PR.
 * Consider using Zod's `z.object(arg)` etc. for this and other validators/validations.
 */
function isObject(arg) {
  if (arg instanceof Object) {
    return true;
  }
}

/** @todo Capitalize this and other constant identifiers +x */
const { NODE_ENV, JWT_PRIVATE_KEY } = process.env;

/**
 * @todo
 * A multi-line @todo item
 * is processed
 * as a single line.
 * Use @todolist tags if you want each line to contain a to do item.
 */

Output

<!-- @todolist
DO NOT MANUALLY EDIT THIS TO DO LIST !!!
THIS WHOLE SECTION, INCLUDING ITS HEADING IS AUTO-GENERATED BY `jsdoc-todo` plugin.
ALL MANUAL CHANGES WILL BE OVERWRITTEN THE NEXT TIME jsdoc RUNS !!!!

IF YOU MUST DIRECTLY/MANUALLY INCLUDE TO DO ITEMS IN THIS DOCUMENT,
PLEASE ADD THEM DIRECTLY BELOW THE "@endtodolist" HTML COMMENT BELOW. -->

## To Do

- [ ] A multi-line @todo item is processed as a single line. Use @todolist tags if you want each line to contain a to do item.&nbsp;-&nbsp;[review](tests/jsdoc-todo.test.js#L116)
- [ ] The below will match anything that's an instance of Object (i.e., Arrays, Maps etc.). Use `Object.prototype.toString.call(arg)` instead.&nbsp;-&nbsp;[review](tests/jsdoc-todo.test.js#L101)
- [ ] Don't forget to test it before your next PR.&nbsp;-&nbsp;[review](tests/jsdoc-todo.test.js#L102)
- [ ] Consider using Zod's `z.object(arg)` etc. for this and other validators/validations.&nbsp;-&nbsp;[review](tests/jsdoc-todo.test.js#L103)
- [x] Capitalize this and other constant identifiers&nbsp;-&nbsp;[review](tests/jsdoc-todo.test.js#L111)

<!-- @endtodolist -->

Marking a task/to-do as completed.

Append +x to the end of a line in a @todolist or a single-line @todo to mark the task as completed.

If you're working with a multiline @todo, append +x to the end of the last line instead.

todoPlugin Configuration

| Setting | Description | Type | Required | Default | | -------------- | --------------------------------------- | -------- | -------- | ----------- | | heading | "To Do" section's heading. | string | false | To Do | | headingLevel | HTML heading type (1 to 6). | number | false | 2 | | outFile | Output file. | number | false | README.md | | tag | Marks the start of the "To Do" section. | string | false | todolist |

Development

git clone https://github.com/achianumba/jsdoc-todo.git

cd jsdoc-todo

pnpm install

pnpm run build

Testing

# Run pnpm run build beforehand
pnpm run test

Known issues

  • Doesn't support TypeScript. Consider setting "removeComments": true in your tsconfig.json file for now and parsing the emitted files.

To Do

  • [ ] Generate "to do" list from TS files too. - review
  • [ ] Test against JSX and TSX files. - review
  • [ ] Delete todolist section from config.outFile if no "to do" comments are found in source code. - review
  • [ ] JSDoc has a built-in @todo tag. Allow users to configure whether @todo doclets are omitted from the generated HTML docs instead of omitting it by default. - review