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

@cffnpwr/textlint-plugin-comments

v1.0.0

Published

ソースコード・設定ファイルのコメント部分だけをtextlintの検査対象にするプラグイン

Readme

@cffnpwr/textlint-plugin-comments

GitHub License npm Version JSR Version

A textlint plugin that lints only the comments in source code and configuration files.

日本語のREADMEはこちら

Code and string literals outside comments are not linted.

// This line comment is linted.
var s = "// This string literal is not linted."

func main() {} // Trailing comments are linted too.

Supported Languages

| Language | Extensions | | --- | --- | | Go | .go | | TypeScript | .ts .mts .cts .tsx | | JavaScript | .js .mjs .cjs .jsx | | Rust | .rs | | Python | .py .pyi | | JSONC | .jsonc .json | | YAML | .yaml .yml | | TOML | .toml | | Shell script | .sh .bash |

Comments are identified with the tree-sitter grammar of each language. .json files are parsed as JSONC, since files such as tsconfig.json are commonly written with comments. Files without an extension, such as .gitignore, cannot be supported because of the textlint CLI's behavior (it determines the extension with path.extname).

How Comments Are Handled

Comment markers (// /// //! /* */ #), and the leading * of each block comment line together with the surrounding whitespace, are excluded from linting. Comments with an empty body are not linted. Shebangs (#!) and Python docstrings are not linted.

Comments are grouped into paragraphs before linting.

  • Line comments with the same marker that start their lines on consecutive lines form one paragraph.

    // この関数は入力を
    // 検証します。
  • Blank lines, code lines, and comment lines with an empty body separate paragraphs. In the example below, the comments on the first and third lines form separate paragraphs.

    // この関数は入力を
    //
    // 検証します。
  • A trailing comment written after code forms a paragraph by itself.

    func main() {} // この関数は入力を検証します。
  • A block comment forms one paragraph, and lines with an empty body inside it separate paragraphs.

    /* この関数は入力を
     * 検証します。
     *
     * この文は別の段落です。
    */
  • Rust's //, ///, and //! are different kinds of comments and are split into separate paragraphs. In the example below, every line forms a separate paragraph.

    /// 設定を読み込み、
    //! 失敗したらエラーを返します。
    //  これは別の段落です。

Autofix

Autofixes from rules (textlint --fix) are converted to keep the comment syntax intact before they are applied.

  • A fix that inserts a line break adds the continuation-line indentation and comment marker (* for JSDoc-style block comments) after the inserted line break.
  • A fix that inserts a line break into a trailing comment is not applied; only the error is reported.
  • A fix that joins lines also removes the indentation and comment marker of the next line.
  • A fix that rewrites only part of a comment marker, or that reaches outside the comment body, is not applied; only the error is reported.

An inserted line break uses the line ending at the end of the first line of the paragraph. If that line is the last line of the file and has no line ending, the line ending of the previous line is used; if the file has no line endings at all, LF is used.

How to Install

npm

npm install --save-dev @cffnpwr/textlint-plugin-comments

or

npx jsr add -D @cffnpwr/textlint-plugin-comments

yarn

yarn add --dev @cffnpwr/textlint-plugin-comments

or

yarn dlx jsr add -D @cffnpwr/textlint-plugin-comments

pnpm

pnpm add --save-dev @cffnpwr/textlint-plugin-comments

or

pnpm dlx jsr add -D @cffnpwr/textlint-plugin-comments

Bun

bun add --dev @cffnpwr/textlint-plugin-comments

or

bunx jsr add -D @cffnpwr/textlint-plugin-comments

Deno

deno add --dev npm:@cffnpwr/textlint-plugin-comments

or

deno add --dev jsr:@cffnpwr/textlint-plugin-comments

When installed from JSR, the plugin fetches the language grammar files (.wasm) from jsr.io at runtime. Running textlint therefore requires network permission for jsr.io (--allow-net=jsr.io).

How to Use

Add the plugin to plugins in .textlintrc.json, and configure the rules to apply in rules.

{
  "plugins": {
    "@cffnpwr/comments": true
  },
  "rules": {
    "@cffnpwr/textlint-rule-no-dash": true
  }
}
npx textlint "src/**/*.ts"

Options

This plugin has no options.

License

MIT