{"id":25752,"library":"imagemin-lint-staged","title":"imagemin-lint-staged","description":"A CLI wrapper around imagemin designed specifically for use with lint-staged (git pre-commit hooks). Version 0.5.1 is the latest stable release. It compresses PNG, JPEG, GIF, and SVG images automatically during staged file checks, with sensible default plugins (mozjpeg, optipng, svgo, gifsicle). Unlike using imagemin directly, it integrates seamlessly into lint-staged configurations without any configuration overhead. The package is lightweight (no peer dependencies) and runs synchronously to fit lint-staged's workflow.","status":"active","version":"0.5.1","language":"javascript","source_language":"en","source_url":"https://github.com/tomchentw/imagemin-lint-staged","tags":["javascript","imagemin","CLI","git hook","compress images","lint-staged"],"install":[{"cmd":"npm install imagemin-lint-staged","lang":"bash","label":"npm"},{"cmd":"yarn add imagemin-lint-staged","lang":"bash","label":"yarn"},{"cmd":"pnpm add imagemin-lint-staged","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package exports a default function. ESM is not natively supported; use dynamic import if needed.","wrong":"const imageminLintStaged = require('imagemin-lint-staged')","symbol":"default","correct":"import imageminLintStaged from 'imagemin-lint-staged'"}],"quickstart":{"code":"// package.json snippet for lint-staged\n{\n  \"lint-staged\": {\n    \"*.{png,jpeg,jpg,gif,svg}\": [\"imagemin-lint-staged\"]\n  }\n}\n\n// Additionally, ensure imagemin-lint-staged is installed\nnpm install --save-dev imagemin-lint-staged lint-staged husky","lang":"javascript","description":"Shows how to integrate imagemin-lint-staged with lint-staged to automatically compress images on commit."},"warnings":[{"fix":"Ensure image files are valid before committing, or add a fallback to skip compression on error.","message":"imagemin-lint-staged will fail if any image file cannot be processed (e.g., corrupted file) and blocks the commit.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"If custom options are needed, use imagemin directly instead of this package.","message":"The CLI does not accept custom imagemin options; it uses hardcoded default plugins (mozjpeg, optipng, svgo, gifsicle).","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev imagemin-lint-staged' from the project root.","cause":"imagemin-lint-staged is not installed or not in the same directory as the lint-staged config.","error":"Error: Cannot find module 'imagemin-lint-staged'"},{"fix":"Ensure lint-staged is configured to run 'imagemin-lint-staged' as a string (not a function). The binary is provided via the package's bin field.","cause":"imagemin-lint-staged is not in PATH; lint-staged runs scripts from node_modules/.bin, but if configured incorrectly, it may not find the binary.","error":"imagemin-lint-staged: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}