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 🙏

© 2025 – Pkg Stats / Ryan Hefner

auto-format-staged

v1.0.1

Published

Zero-config pre-commit formatter and linter. Installs in 30 seconds, uses your existing Prettier & ESLint setup. No config files needed.

Readme

auto-format-staged

npm version License: MIT

Zero-config pre-commit formatter and linter. Automatically detects and uses your project's Prettier and ESLint configuration.

Features

  • 🚀 30-second setup - One command and you're done
  • 🎯 Zero configuration - Uses your existing .prettierrc and .eslintrc
  • 🚫 Blocks bad commits - Linting errors prevent commits (warnings don't)
  • Lightning fast - Only processes staged files
  • 🪶 Tiny - ~ 11.5KB with zero dependencies
  • 🔄 Auto-formats - Formats code and re-stages files automatically

Installation

Quick Start (For You)

npm install --save-dev auto-format-staged
npx auto-format-staged

Done! Now try committing some messy code:

echo "const x=1;const   y=2" > test.js
git add test.js
git commit -m "test"
# ✨ File automatically formatted before commit!

Recommended Setup (For Teams)

The quick start is great, but it only installs the hook for you. Your teammates would have to remember to run npx auto-format-staged after cloning.

For a fully automated setup that works for everyone, add a postinstall script to your project's package.json:

{
    "name": "my-cool-project",
    "scripts": {
        "postinstall": "npx auto-format-staged"
    }
}

Now, every time any developer runs npm install, it will automatically run your setup script and ensure the hook is installed.

Every commit will:

  1. Lint staged files (errors block commit, warnings don't)
  2. Format staged files with Prettier
  3. Re-stage formatted files

Requirements

Your project should have at least one of:

  • prettier (for formatting)
  • eslint (for linting)

Both are optional - the tool works with whatever you have installed.

How It Works

When you commit:

  1. Gets list of staged files
  2. Detects your project's ESLint config (if installed)
  3. Runs linter - only errors block the commit
  4. Detects your project's Prettier config (if installed)
  5. Formats files and re-stages them
  6. Commit proceeds

What Gets Processed

Linting: .js, .jsx, .ts, .tsx, .mjs, .cjs
Formatting: .js, .jsx, .ts, .tsx, .json, .css, .scss, .md, .html, .yml, .yaml

Uninstall

rm .git/hooks/pre-commit
npm uninstall auto-format-staged

🤝 Contributing

Issues and PRs welcome! This is a simple tool, let's keep it that way.

License

MIT © Ahmed Zrouqui