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

v7-formatter

v1.0.4

Published

A lightning-fast, zero-dependency, secure code formatter for JavaScript, TypeScript, HTML, CSS, JSON, and Markdown. Format entire directories or individual files with a single command. Safe formatting that never breaks your code.

Downloads

451

Readme


🌟 Why V7 Formatter?

| Feature | V7 Formatter | Others | |---------|:---:|:---:| | Zero Dependencies | ✅ | ❌ | | Never Breaks Your Code | ✅ | ❌ | | No Network Requests | ✅ | ❌ | | No Code Execution | ✅ | ❌ | | Instant Install | ✅ | ❌ | | Totally Free & Open Source | ✅ | ✅ |


✨ Features

  • Lightning Fast — Zero dependencies, pure Node.js, formats 1000+ files in seconds
  • 🔒 Top-Notch Security — No dependencies, no network, no eval, no code execution
  • 🛡️ Never Breaks Your Code — Safe formatting with graceful error handling
  • 📁 Directory Formatting — Recursively format entire project directories
  • 🔧 Multi-Language — JavaScript, TypeScript, HTML, CSS, JSON, Markdown
  • 🎯 CI/CD Ready — Check mode exits 1 for unformatted files
  • ⚙️ Configurable.v7formatrc for project-specific settings
  • 🚫 Ignore Support.v7ignore file for excluding paths
  • 🖥️ CLI & API — Use from command line or programmatically
  • 📦 Tiny Footprint — ~15 kB package size, instant install
  • 🎨 Beautiful Output — Colored terminal output with IDE-clickable file paths and git diff integration
  • 🆓 100% Free — MIT License, open source forever

🚀 Quick Start

Install Globally

npm install -g v7-formatter

Install as Dev Dependency

npm install --save-dev v7-formatter

Use Without Installing (npx)

npx v7-formatter .

Format Your Project

# Format current directory
v7-formatter .

# Format specific directory
v7-formatter src/

# Format a single file
v7-formatter app.js

# Check if files are formatted (CI-friendly)
v7-formatter --check .

📖 CLI Usage

v7-formatter [options] <files/directories...>

Options

| Flag | Short | Description | |------|-------|-------------| | --help | -h | Show help message | | --version | -v | Show version number | | --check | -c | Check mode — don't write files, exit 1 if unformatted | | --write | -w | Write mode (default) — format and save files | | --init | | Create a .v7formatrc config file | | --config <path> | | Path to custom config file | | --indent-size <n> | | Indentation size (default: 2) | | --use-tabs | | Use tabs instead of spaces | | --single-quote | | Use single quotes (default) | | --double-quote | | Use double quotes | | --semicolons | | Add semicolons (default) | | --no-semicolons | | Remove semicolons | | --ext <exts> | | File extensions to process (comma-separated) |

Examples

# Format with tabs
v7-formatter --use-tabs .

# Format with double quotes, no semicolons
v7-formatter --double-quote --no-semicolons src/

# Format only JavaScript files
v7-formatter --ext js,jsx,ts,tsx .

# Check in CI pipeline (exits 1 if unformatted)
v7-formatter --check . || echo "Code needs formatting!"

# Initialize config
v7-formatter --init

🔌 Programmatic API

const { format, formatFile, formatDirectory, check } = require('v7-formatter');

// Format a string
const formatted = format('function   foo( ){return "hello"  }', {
  parser: 'javascript',
  singleQuote: true,
  semicolons: true,
});
// Output:
// function foo() {
//   return 'hello';
// }

// Format a single file in-place
const result = formatFile('./src/app.js');
console.log(result.changed); // true or false

// Format an entire directory
const dirResult = formatDirectory('./src');
console.log(`Changed: ${dirResult.changed}, Unchanged: ${dirResult.unchanged}`);

// Check if files are formatted (no modifications)
const checkResult = check('./src');
if (!checkResult.isFormatted) {
  console.log('Unformatted files:', checkResult.unformatted);
}

API Reference

| Function | Parameters | Returns | Description | |----------|-----------|---------|-------------| | format(source, options) | source: string, options: { parser, ...config } | string | Format a source code string | | formatFile(path, options?) | path: string, options?: object | { changed, filePath } | Format a file in-place | | formatDirectory(path, options?) | path: string, options?: object | { total, changed, unchanged, errors } | Format all files in directory | | check(path, options?) | path: string, options?: object | { isFormatted, unformatted[] } | Check formatting without changes | | getSupportedExtensions() | none | string[] | List supported file extensions |

Supported Parsers: javascript, typescript, html, css, json, markdown


⚙️ Configuration

Create a .v7formatrc file in your project root:

v7-formatter --init

Or manually:

{
  "indentSize": 2,
  "useTabs": false,
  "singleQuote": true,
  "semicolons": true,
  "trailingNewline": true,
  "maxConsecutiveBlankLines": 1,
  "ignore": [
    "node_modules",
    "dist",
    "build",
    "coverage"
  ]
}

All Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | indentSize | number | 2 | Spaces per indent level | | useTabs | boolean | false | Use tabs instead of spaces | | singleQuote | boolean | true | Single quotes in JS/TS | | semicolons | boolean | true | Trailing semicolons in JS/TS | | trailingNewline | boolean | true | Ensure file ends with newline | | maxConsecutiveBlankLines | number | 1 | Max consecutive blank lines | | sortKeys | boolean | false | Sort JSON object keys | | listMarker | string | "-" | Markdown list marker | | extensions | string[] | ["js","jsx","ts",...] | File extensions to process | | ignore | string[] | ["node_modules",...] | Paths/patterns to ignore |


🚫 Ignore Files

Create a .v7ignore file:

# Dependencies
node_modules/

# Build output
dist/
build/

# Generated files
*.min.js
*.bundle.js

Default ignored paths: node_modules.gitdistbuildcoverage.next.nuxt.cachevendorpackage-lock.jsonyarn.lock


📋 Supported Languages

| Language | Extensions | What V7 Formats | |----------|-----------|-----------------| | JavaScript | .js, .jsx, .mjs, .cjs | Indentation, quotes, semicolons, spacing, braces | | TypeScript | .ts, .tsx | Same as JavaScript | | HTML | .html, .htm | Tag indentation, attribute spacing, self-closing tags | | CSS | .css, .scss, .less | Property indentation, selector formatting, spacing | | JSON | .json | Pretty-print, key sorting, validation | | Markdown | .md, .markdown | Heading spacing, list markers, blank lines |


🔒 Security

V7 Formatter is built with a security-first mindset:

  • 🔐 Zero Dependencies — No supply chain attack surface. Every line is auditable.
  • 🛡️ No Code Execution — V7 never uses eval(), Function(), or child_process
  • 🌐 No Network Access — Never makes HTTP requests or phones home
  • 📁 Sandboxed File Access — Only touches files you explicitly specify
  • 💾 Safe Writes — Files written only after successful formatting
  • ⚠️ Graceful Errors — Invalid/malformed files are skipped, never corrupted

Your code is NEVER executed, evaluated, or transmitted. V7 Formatter treats your code purely as text.

See SECURITY.md for the full security policy and vulnerability reporting.


🔄 CI/CD Integration

GitHub Actions

name: Format Check
on: [push, pull_request]
jobs:
  format:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 18
      - run: npm install -g v7-formatter
      - run: v7-formatter --check .

npm Scripts

{
  "scripts": {
    "format": "v7-formatter .",
    "format:check": "v7-formatter --check ."
  }
}

Pre-commit Hook

# .husky/pre-commit
v7-formatter --check .

🤝 Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

📄 License

MIT — Totally free and open source forever.

👨‍💻 Author

TheVaibhaw