Registry / testing / lint-prepush

lint-prepush

JSON →
library3.0.3jsnpmunverified

lint-prepush is a Node.js tool that runs linters on staged files before a git push, enforcing code quality within teams. Current stable version is 3.0.3 (released 2024-11-30), with a slow release cadence. It uses a simple package.json configuration to define tasks per file glob, supports concurrent task execution for speed, and integrates with any git hook manager (e.g., Husky). Unlike lint-staged which operates on pre-commit, lint-prepush operates on pre-push, catching issues after local commits. Requires Node.js >=18.18.0. Dependencies include cosmiconfig for config loading, execa for running commands, and log-symbols for visual feedback. No security issues reported.

npm install lint-prepush
INSTALL
IMPORT
SIG · LINT-PREPUSH
L
lint-prepush
testingjavascriptv3.0.3
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.

lint-prepush
npx lint-prepush
import lintPrep from 'lint-prepush'
This is a CLI tool, not a library. Use npx or run directly from node_modules/.bin.
configuration
"lint-prepush": { "tasks": { "*.js": "eslint" } }
require('lint-prepush').config(...)
Configuration is placed in package.json under the 'lint-prepush' key, or in a separate .lintprepushrc file.
husky integration
// .husky/pre-push npx lint-prepush
// using in package.json scripts
Husky v9+ uses .husky directory. Add a pre-push hook file that runs the command.

Install lint-prepush and Husky, create a pre-push hook, and configure lint tasks in package.json.

npm install --save-dev lint-prepush husky npm install --save-dev eslint # or your linter npx husky init # creates .husky directory echo 'npx lint-prepush' > .husky/pre-push chmod +x .husky/pre-push # Add to package.json: # "lint-prepush": { # "base": "main", # "tasks": { # "*.js": ["eslint"] # } # }
lint-prepush --version
Debug
Known issues
breakingNode version <18.18.0 is not supported. Upgrade to Node >=18.18.0.
fix
Update Node.js to >=18.18.0.
affects: <3.0.0
deprecatedDrop support for Node.js <10 in v2.0.0 was a breaking change.
fix
Use Node >=10 for v2.x. For current versions, use Node >=18.18.0.
affects: >=2.0.0 <3.0.0
gotchaIf base branch is not specified and the remote branch doesn't exist locally, lint-prepush may fail or use incorrect diff.
fix
Explicitly set the 'base' option in configuration to your default branch (e.g., 'main').
affects: <3.0.0
gotchaMultiple tasks on same glob must be wrapped in an object with 'concurrent' key, not array of arrays.
fix
Use format: { "concurrent": ["eslint", "jest"] }
affects: >=1.0.0
deprecatedOld configuration format with array of commands without 'concurrent' key is still supported but deprecated.
fix
Use the object format with 'concurrent' for multiple tasks.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Could not find a configuration file for lint-prepush.
No 'lint-prepush' key in package.json and no .lintprepushrc file.
fix
Add configuration: "lint-prepush": { "tasks": { "*.js": "eslint" } }
Error: The base branch 'main' does not exist locally or has no commits. Please specify a valid base branch.
The 'base' option points to a branch that doesn't exist locally.
fix
Set 'base' to an existing branch (e.g., 'main' or 'master') or omit to auto-detect (v3+).
command not found: eslint
Linter not installed or not in PATH.
fix
Install the linter locally (npm install --save-dev eslint) or ensure it's globally accessible.
Upgrade
Version history
3.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
lint-prepush — npm install lint-prepush · libregistry