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

console-insights

v1.0.2

Published

A CLI tool to find, report, and remove console statements from code.

Downloads

37

Readme

console-insights

A powerful CLI tool to gain insights, find, report, and remove console.* statements from JavaScript, TypeScript, and JSX/TSX files.
Perfect for keeping your codebase clean and gaining visibility into logging before production, during code reviews, or as part of your CI/CD pipeline.


Features

  • Count all console.* statements in your codebase.
  • Report every console.* statement with file, line number, and code.
  • Summary Table: See a per-file summary with counts and line numbers.
  • Remove all or selected console.* statements, with:
    • --dry-run mode to preview changes.
    • --methods to target only specific console methods (e.g. log, warn).
    • --lines to target only specific line numbers.
  • Supports modern JavaScript, TypeScript, JSX, and TSX syntax.
  • Glob pattern support for flexible file selection.
  • Safe: Ignores node_modules by default.

Installation

npm install -g console-insights

Or use with npx (no install needed):

npx console-insights <command> [options]

Usage

Count console statements

Count in a specific file:

console-insights count src/App.jsx

Count only console.log and console.warn in a specific file:

console-insights count src/App.jsx --methods log,warn

Count in all JS/JSX/TS/TSX files recursively:

console-insights count "**/*.{js,jsx,ts,tsx}"

Count only console.error in all files:

console-insights count "**/*.{js,jsx,ts,tsx}" --methods error

Report all console statements (file, line, code)

Report in a specific file:

console-insights report src/App.jsx

Report only console.log and console.warn in a specific file:

console-insights report src/App.jsx --methods log,warn

Report in all files:

console-insights report "**/*.{js,jsx,ts,tsx}"

Report only console.error in all files:

console-insights report "**/*.{js,jsx,ts,tsx}" --methods error

Show a summary table

Summary for a specific file:

console-insights summary src/App.jsx

Summary for all files:

console-insights summary "**/*.{js,jsx,ts,tsx}"

Remove console statements

Remove from a specific file:

console-insights remove src/App.jsx

Remove from all files:

console-insights remove "**/*.{js,jsx,ts,tsx}"

Dry run (preview what would be removed)

console-insights remove src/App.jsx --dry-run

Remove only specific methods

console-insights remove src/App.jsx --methods log,warn

Remove only on specific lines

console-insights remove src/App.jsx --lines 10,15

Combine options

console-insights remove src/App.jsx --methods log,warn --lines 10,15 --dry-run

Example Usage Table

| Command Example | What it Does | |--------------------------------------------------------------------- |----------------------------------------------| | console-insights count src/App.jsx | Count all console statements in a file | | console-insights count src/App.jsx --methods log,warn | Count only console.log and console.warn in a file | | console-insights report src/App.jsx | List all console statements in a file | | console-insights report src/App.jsx --methods log,warn | List only console.log and console.warn in a file | | console-insights summary src/App.jsx | Show summary for a single file | | console-insights remove src/App.jsx | Remove all console statements from a file | | console-insights count "**/*.js" | Count all console statements in JS files | | console-insights count "**/*.js" --methods error | Count only console.error in JS files | | console-insights report "src/**/*.{js,jsx}" | List all console statements in src/ | | console-insights report "src/**/*.{js,jsx}" --methods warn | List only console.warn in src/ | | console-insights summary "**/*.{js,jsx,ts,tsx}" | Show summary table for all code files | | console-insights remove "**/*.js" --dry-run | Show what would be removed (no changes) | | console-insights remove "**/*.js" --methods log,warn | Remove only console.log and console.warn | | console-insights remove "**/*.js" --lines 10,15 | Remove consoles only on lines 10 and 15 | | console-insights remove "**/*.js" --methods log --lines 10,15 | Remove console.log only on lines 10, 15 |

Options

| Option | Description | |----------------|------------------------------------------------------------------| | --dry-run | Show what would be removed, but do not modify files | | --methods | Comma-separated list of console methods to count/report/remove (e.g. log,warn)| | --lines | Comma-separated list of line numbers to remove (e.g. 10,15) |

Why use console-insights?

  • Gain insights into your codebase's logging.
  • Keep your codebase clean before production.
  • Automate code review for forgotten debug logs.
  • Integrate with CI/CD to enforce no-console policies.
  • Flexible and safe: preview changes, target only what you want.

Typical Use Cases

  • Pre-deployment cleanup: Remove all debug logs before production.
  • Code review: Audit for forgotten console.* statements.
  • CI/CD integration: Fail builds if any console.* statements remain.
  • Selective removal: Remove only certain types or lines of console statements.

License

MIT

Contributing

Pull requests and issues are welcome! If you have ideas for new features or improvements, please open an issue or PR.

Author

Gitesh Pareek
https://www.linkedin.com/in/itsgitesh/