prettier-plugin-uncomment weekly downloads statistics
By lassekt · npm · Prettier plugins
Prettier plugin that strips comments from JS/TS/JSX/Flow files, keeping tooling directives and developer-flagged comments.
prettier-plugin-uncomment has 49 recorded weekly downloads on npm, a decrease of 16.9% over the past 30 days, ranking #2779 of 3,247 tracked listings.
About prettier-plugin-uncomment
prettier-plugin-uncomment
A Prettier plugin that strips comments from JavaScript, TypeScript, JSX and
Flow files — every // and /* … */ — except comments that mean something
to tooling, JSDoc that documents your code, or comments a developer has
explicitly flagged to keep.
Install
npm install --save-dev prettier prettier-plugin-uncomment
Usage
On-demand, without installing (recommended)
Stripping comments is destructive, so you usually want to run it deliberately —
not on every format. Use Prettier's --plugin flag, which applies the plugin
only for that one command and never persists to your config. npx fetches
Prettier and the plugin transiently (nothing is added to package.json):
npx --package prettier --package prettier-plugin-uncomment -- \
prettier --plugin prettier-plugin-uncomment \
--write "src/**/*.{js,jsx,ts,tsx}"
If Prettier and the plugin are already installed in the project, the same run is just:
prettier --plugin=prettier-plugin-uncomment --write "src/**/*.{js,jsx,ts,tsx}"
Your existing Prettier config (print width, semicolons, …) is still read and
applied — --plugin only adds this plugin on top for that run.
If you run it often, wrap it in a package.json script. This lives in
scripts (not in your Prettier config), so it never triggers on a normal
format — only when you invoke it:
{
"scripts": {
"uncomment": "prettier --plugin=prettier-plugin-uncomment --write"
}
}
Pass the files to strip when you run it: npm run uncomment -- "src/**/*.ts".
Always-on, via config
If you really do want comments stripped on every format, add it to your Prettier config instead:
{
"plugins": ["prettier-plugin-uncomment"]
}
Then run Prettier as usual (npx prettier --write .). As with any Prettier run,
list the folders you never want touched in .prettierignore; see also
uncommentIgnorePaths below.
What is kept
Everything else is removed. Comments matching any of the following survive:
Tooling / linter / type-checker directives
eslint-disable*,eslint-enable,eslint-env@ts-ignore,@ts-expect-error,@ts-nocheck,@ts-check/// <reference … />(triple-slash directives)prettier-ignore,biome-ignore,deno-lint-ignore,stylelint-ignore,oxlint-ignore,rome-ignore- coverage pragmas:
v8 ignore,c8 ignore,istanbul ignore,node:coverage ignore
Build-tool "magic" comments (removing these changes runtime behaviour)
- webpack magic comments (
webpackChunkName,webpackPrefetch,webpackIgnore, …) @vite-ignore//# sourceMappingURL=///# sourceURL=/*#__PURE__*/,/*#__NO_SIDE_EFFECTS__*/
Compiler / runtime pragmas & legal banners
@jsx,@jsxRuntime,@jsxImportSource,@jsxFrag@flow,@noflow@license,@preserve,@copyright, and/*! … */banner comments
JSDoc that documents your code (the docs that feed TS/editor hover info)
/** … */blocks containing a recognized JSDoc tag —@param,@returns,@type,@typedef,@template,@satisfies,@callback,@enum,@deprecated,@see,@example, and the like.- Detection uses the same
/**-prefix rule TypeScript and editors use to identify a doc comment — no substring guessing. Prose-only/** … */blocks (doc-comment delimiters with no tag) are still stripped by default; tune this withuncommentJsdoc.
Developer-flagged comments (case-insensitive)
@hc,@hn,@Hacker Note,@Hacker CommentTODO,FIXME
Options
| Option | Type | Default | Description |
|---|---|---|---|
uncommentIgnorePaths | string[] | node_modules, dist, build, out, .next, .nuxt, .svelte-kit, coverage, vendor | Path segments whose files are left untouched. Setting this replaces the default list. |
uncommentKeep | string[] | [] | Extra case-insensitive substrings; any comment containing one is kept (extends the keep-list). |
uncommentJsdoc | "tagged" | "all" | "off" | "tagged" | How to treat /** … */ blocks. tagged: keep only blocks with a recognized JSDoc tag. all: keep every doc block. off: strip them unless another rule keeps them. |
{
"plugins": ["prettier-plugin-uncomment"],
"uncommentIgnorePaths": ["node_modules", "dist", "generated"],
"uncommentKeep": ["@keep", "IMPORTANT"],
"uncommentJsdoc": "tagged"
}
How it works
Prettier reads the top-level ast.comments array to attach and print comments.
The plugin wraps the built-in babel, babel-ts, babel-flow, typescript
and flow parsers and filters that array after parsing — dropping every comment
except the ones on the keep-list, so the rest are simply never printed. Node
locations are left untouched, so the AST stays valid.
Scope & caveats
- Covers the JS/TS parser family (
.js,.jsx,.ts,.tsx, Flow). CSS, HTML, Markdown, YAML, GraphQL and other languages are not touched. - Removing a comment that sat alone on its own line can leave the blank line it occupied — the same blank-line behaviour Prettier applies to any gap.
License
ISC
Description from the npm listing.
- prettier
- prettier-plugin
- comments
- uncomment
- strip-comments
- remove-comments
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (592)Similar npm Prettier plugins plugins
All 20 prettier-plugin-uncomment alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/prettier-plugin-uncomment. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.