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

typescript-todo-or-die-plugin

v0.6.0

Published

`TODO`'s that speak up for themselves via the TypeScript Language Server.

Downloads

8

Readme

typescript-todo-or-die-plugin

TODO's that speak up for themselves via the TypeScript Language Server.

Examples

// Will result in your editor showing an error: "It's time to do it!"
// TODO::after_date("2021-04-02"): remove april fools code
// Will result in your editor showing an error:
// "Your package has arrived! now on 4.5.1"
// FIXME::when("typescript", ">4.5.0"): check your types

Usage

Run as language server plugin

This plugin requires a project with TypeScript setup.

  1. Install dependency
npm install --save-dev typescript-todo-or-die-plugin

or

yarn add typescript-todo-or-die-plugin --dev
  1. Add a plugins section to your tsconfig.json.
{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-todo-or-die-plugin",
        "options": {
          "after_date": {
            "warn": "1w"
          },
          "when": {
            "warn": "1p"
          }
        },
        "additionalKeywords": ["FIX", "TODO_OR_DIE"]
      }
    ]
  }
}
  1. Add TODO's with conditions to your codebase

Note: If you're using Visual Studio Code, you'll have to run the "TypeScript: Select TypeScript Version" command and choose "Use Workspace Version", or click the version number next to "TypeScript" in the lower-right corner. Otherwise, VS Code will not be able to find your plugin.

Run in command line

  1. Follow steps 1 and 2 from "Run as language server plugin"

  2. Run in command line:

tod <file|dir|glob...>
  1. All errors and warnings in the given range of files are outputted to the terminal. When there is at least one error the process will exit with code 1. In the ci the process will exit with code 1 when there is at least one warning.

Conditions

The following conditions are available to use inside your TODO comments

after_date(date)

| Param | Type | Description | | ----- | ------------ | ---------------------------------------- | | date | yyyy-mm-dd | Date after which an error will be shown. |

Show an error if today is after the given date

Configuration options:
  • warn?: string | boolean (Ex: '1w'/'2d'/'30h'/true)

Show a warning before the given date

when(package, version)

| Param | Type | Description | | ------- | -------- | --------------------------------------------------------------- | | package | string | Package name to be tracked as defined in the package.json file. | | version | >1.0.0 | A comparator (> or =) followed by the version to be matched |

Show an error when version is compared with the current version as defined in the package.json file.

Configuration options:
  • warn?: string | boolean (Ex: '1M'/'2m'/'4p'/true)

Show a warning before the given version matching on M - major versions, m - minor versions, p - patches. Defaults to 1 patch ahead when warn option is present.

on_branch(branch_name)

| Param | Type | Description | | ------------ | ------------ | ------------------------------------------- | | branch_name | string | Git branch, on which an error will be shown |

Show an error if current git branch matches specified one

Additional keywords

By default TODO & FIXME are valid keywords to use for your todo comments. Additional keywords can be added as shown here:

"plugins": [
  {
    "name": "typescript-todo-or-die-plugin",
    "additionalKeywords": ["FIX", "TODO_OR_DIE"]
  }
]

Contributors

Made with contributors-img.