prettier-husky-lint-staged-installer

raw JSON →
1.4.1 verified Fri May 01 auth: no javascript

CLI tool that automatically sets up Prettier, Husky, and lint-staged in any project. Running `npx prettier-husky-lint-staged-installer` (v1.4.1) installs Husky v9, creates a `.husky/pre-commit` hook running `npx lint-staged`, and adds a `lint-staged` config in `package.json` to format all staged files with Prettier. Unlike manual setup guides, this tool provides a one-command automated installation with zero configuration. It supports npm, pnpm, and bun. Actively maintained with regular dependency updates and OIDC trust.

error ENOENT: no such file or directory, open '.husky/pre-commit'
cause The installer failed to create the pre-commit hook file, possibly due to insufficient permissions or missing `.husky` directory.
fix
Ensure the .husky/ directory exists and is writable. Run mkdir -p .husky && npx prettier-husky-lint-staged-installer.
error Git commit hangs indefinitely
cause The pre-commit hook is misconfigured, possibly running an invalid `npx lint-staged` command that waits for input.
fix
Check that lint-staged is installed as a devDependency. Run npm install --save-dev lint-staged then test with git commit.
error npx: command not found: prettier-husky-lint-staged-installer
cause npm may be outdated or the package name is misspelled.
fix
Update npm: npm install -g npm@latest. Then run the command again exactly: npx prettier-husky-lint-staged-installer.
breaking v1.3.0 and later require Husky v9, which changed the init command from `husky install` to `husky init`. If you manually set up Husky previously, uninstall it first.
fix Run `npm uninstall husky` and then run `npx prettier-husky-lint-staged-installer` to get the correct Husky v9 setup.
gotcha The script overwrites existing `lint-staged` config in package.json. If you have an existing lint-staged configuration, it will be replaced.
fix Backup your package.json before running the installer, or manually merge after installation.
gotcha The installer runs `npx lint-staged` inside the pre-commit hook. If `lint-staged` or `prettier` are not installed as devDependencies, the hook will fail silently or error.
fix Ensure `lint-staged` and `prettier` are in `devDependencies` before committing.
deprecated v1.2.0 and earlier used Husky v8 style hooks with `.husky/precommit`. Upgrading to v1.3.0+ will change the hook file to `.husky/pre-commit` to match Husky v9.
fix Delete the old `.husky/precommit` file or run the installer again to overwrite with the new format.
npm install prettier-husky-lint-staged-installer
yarn add prettier-husky-lint-staged-installer
pnpm add prettier-husky-lint-staged-installer

Installs and configures Prettier, Husky, and lint-staged with default settings.

cd your-project
npx prettier-husky-lint-staged-installer