Registry / devops / fast-staged

fast-staged

JSON →
library1.0.2jsnpmunverified

A drop-in replacement for lint-staged optimized for speed. Version 1.0.2 bundles zero dependencies as a single file (~25KB vs ~300KB), starts up in ~15ms (vs ~180ms), runs tasks concurrently by default, and uses a lightweight index stash strategy. Supports all lint-staged config formats including package.json, JS/JSON/YAML config files, and function-based config. Extends the original with a lean mode that avoids unnecessary git subprocesses. Built primarily with AI assistance, the author advises against using in large projects.

npm install fast-staged
INSTALL
IMPORT
SIG · FAST-STAGED
F
fast-staged
devopsjavascriptv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fastStaged
import { fastStaged } from 'fast-staged'
const fastStaged = require('fast-staged')
Package is ESM-only; CJS require will fail.
default (binary)
npx fast-staged
fast-staged (without npx if not installed globally)
Intended as a drop-in replacement, also registers as 'lint-staged' in node_modules/.bin.
Config (function form)
export default async function (stagedFiles) { return { '*.ts': 'tsc --noEmit' } }
module.exports = async function (stagedFiles) { ... }
ESM config files use export default, not module.exports.

Shows install, config in package.json, husky integration, and programmatic usage.

// Install npm install --save-dev fast-staged // package.json { "lint-staged": { "*.{js,ts}": "eslint --fix", "*.{css,scss}": ["stylelint --fix", "prettier --write"] } } // .husky/pre-commit npx fast-staged // Programmatic API import { fastStaged } from 'fast-staged' const ok = await fastStaged({ cwd: process.cwd(), concurrent: true, stash: true, allowEmpty: false, debug: false }) process.exit(ok ? 0 : 1)
Debug
Known issues
gotchaNot recommended for large projects by the author.
fix
Stick with lint-staged for production large projects.
affects: *
gotchaLean mode skips stashing and re-staging; may leave dirty working tree issues if tools modify files.
fix
Use lean mode only if you understand the tradeoffs.
affects: *
breakingESM-only; no CommonJS support.
fix
Use dynamic import() if necessary in CJS projects.
affects: >=1.0.0
gotchaConfig must be in same format as lint-staged; 'fast-staged' key also supported but not standard.
fix
Use 'lint-staged' key for compatibility.
affects: *
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Package is ESM-only; attempt to require() it in CJS context.
fix
Use dynamic import: const { fastStaged } = await import('fast-staged')
fast-staged: no configuration found
Missing lint-staged or fast-staged config in package.json or config files.
fix
Add a 'lint-staged' key to package.json or create a .lintstagedrc file.
fast-staged: failed to parse config
Config file has syntax errors or uses unsupported format.
fix
Check config file syntax and ensure it's a valid JS/JSON/YAML.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
fast-staged — npm install fast-staged · libregistry