fastlint
raw JSON → 1.1.0 verified Fri May 01 auth: no javascript
fastlint is a command-line tool (v1.1.0) that speeds up linting by running linters only on files changed in git — either in the working copy, staged, or compared to branches like master. It avoids running on unchanged files, integrating with eslint and other tools via piped filenames. Key features: --staged filter, --diff-filter (A/C/D/M/R/etc.), --glob filtering, and multiple path output modes. Stable, low maintenance, single-purpose tool. Alternatives include lint-staged and husky, but fastlint is more flexible for branch comparison.
Common errors
error fastlint: 'origin/master' is not a valid git reference ↓
cause Typo or remote not fetched; branch name incorrect.
fix
Use 'origin/main' or 'master' if local branch exists.
error fatal: ambiguous argument 'HEAD~5 HEAD': unknown revision or path ↓
cause Missing space between revisions and paths, or incorrect syntax.
fix
Use correct form: fastlint <since> <until>, e.g. 'HEAD~5 HEAD'.
error fastlint: option '--print0' requires a value ↓
cause Using --print0 as a boolean flag; it's fine, but if followed by argument, fails.
fix
Place --print0 at end of options before xargs.
Warnings
gotcha --diff-filter=Q includes untracked files, not 'Deleted' as some might assume. ↓
fix Use correct letter: Q for untracked, D for deleted.
gotcha Default behavior includes working copy changes if no branch arguments given; may surprise users expecting empty output. ↓
fix Always specify two branches or use --working-copy explicitly.
Install
npm install fastlint yarn add fastlint pnpm add fastlint Imports
- fastlint wrong
require('fastlint')correctnpx fastlint ... - fastlint binary wrong
fastlint.start()correctfastlint --version
Quickstart
npm install -g fastlint && echo "console.log('hello')" > test.js && git init && git add test.js && git commit -m "init" && echo "console.log('world')" >> test.js && fastlint HEAD~1 HEAD --print0 | xargs -0 npx eslint