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-filter-rule-code-comments

v1.0.0

Published

ソースコードのコメントにだけ、指定したtextlintルールの報告を適用しないフィルタールール

Readme

@cffnpwr/textlint-filter-rule-code-comments

GitHub License npm Version JSR Version

A textlint filter rule that suppresses the reports of the specified rules only in source code comments.

日本語のREADMEはこちら

With a single configuration file, you can apply different writing conventions to documents and to code comments. For example, you can require a period at the end of every sentence in documents with ja-no-mixed-period, while writing code comments as noun phrases without a period.

// 設定ファイルの読み込み
const config = loadConfig();

The comment above does not end with a period, but it is not an error because the reports of ja-no-mixed-period are suppressed. With the same configuration, a sentence without a period in a Markdown document is still an error.

Target Files

Only files with an extension handled by @cffnpwr/textlint-plugin-comments are targeted. The list of extensions is taken from the plugin. Extensions are matched the same way textlint selects the plugin that parses a file: by suffix match against the extension of the file path (path.extname).

When the file path is not available, no reports are suppressed. This is the case when textlint is used through its API without filePath. The textlint CLI requires --stdin-filename when linting standard input, so the extension of that file name is used.

How to Install

This filter rule uses @cffnpwr/textlint-plugin-comments to extract comments. The plugin is installed together as a dependency.

npm

npm install --save-dev @cffnpwr/textlint-filter-rule-code-comments

or

npx jsr add -D @cffnpwr/textlint-filter-rule-code-comments

yarn

yarn add --dev @cffnpwr/textlint-filter-rule-code-comments

or

yarn dlx jsr add -D @cffnpwr/textlint-filter-rule-code-comments

pnpm

pnpm add --save-dev @cffnpwr/textlint-filter-rule-code-comments

or

pnpm dlx jsr add -D @cffnpwr/textlint-filter-rule-code-comments

Bun

bun add --dev @cffnpwr/textlint-filter-rule-code-comments

or

bunx jsr add -D @cffnpwr/textlint-filter-rule-code-comments

Deno

deno add --dev npm:@cffnpwr/textlint-filter-rule-code-comments

or

deno add --dev jsr:@cffnpwr/textlint-filter-rule-code-comments

How to Use

Add the plugin to plugins and this filter rule to filters in .textlintrc.json. The key in filters is @cffnpwr/code-comments. The package name @cffnpwr/textlint-filter-rule-code-comments also works as the key.

{
  "plugins": {
    "@cffnpwr/comments": true
  },
  "filters": {
    "@cffnpwr/code-comments": {
      "ignoredRules": ["ja-no-mixed-period"]
    }
  },
  "rules": {
    "ja-no-mixed-period": true
  }
}
npx textlint "src/**/*.ts" "docs/**/*.md"

Options

interface Options {
  ignoredRules?: string[];
}

| Option | Default | Description | | --- | --- | --- | | ignoredRules | [] | IDs of the rules whose reports are suppressed in code comments |

When ignoredRules is not specified, no reports are suppressed. "*" suppresses the reports of all rules. Specifying an unknown option key, a value of ignoredRules that is not an array, or an empty string as an element of ignoredRules is an error.

Rule IDs

A rule ID is the value textlint shows at the end of each error in its output.

| Rule configuration | ID in ignoredRules | | --- | --- | | A single rule configured as "ja-no-mixed-period" in rules | ja-no-mixed-period | | ja-no-mixed-period in a preset configured as "preset-ja-technical-writing" in rules | ja-technical-writing/ja-no-mixed-period |

The ID of a rule in a preset is the preset name without textlint-rule-preset- or preset-, followed by / and the rule name in the preset. When ignoredRules contains a prefixed name such as preset-ja-technical-writing/ja-no-mixed-period, textlint removes the prefix before matching.

The reports of a rule configured in rules with a key that includes textlint-rule- (for example, "textlint-rule-ja-no-mixed-period") cannot be suppressed. textlint removes textlint-rule- from the values in ignoredRules before matching, while it uses the key in rules as is for the ID of a report. Write the key in rules without textlint-rule- for the rules whose reports you want to suppress.

{
  "plugins": {
    "@cffnpwr/comments": true
  },
  "filters": {
    "@cffnpwr/code-comments": {
      "ignoredRules": ["ja-technical-writing/ja-no-mixed-period"]
    }
  },
  "rules": {
    "preset-ja-technical-writing": true
  }
}

License

MIT