{"id":41416,"library":"lint-staged.sh","title":"lint-staged.sh","description":"A minimal shell script to run linters/formatters against files staged in Git. Version 0.6.9 is the latest stable release, with no scheduled cadence. Unlike the npm lint-staged package, this script has no dependencies, no configuration file, and no automatic backup or reset on failure. It simply evaluates a command with the list of staged files filtered by glob patterns. Designed for users who want a lightweight, transparent alternative to lint-staged. No runtime, no Node.js required; works in any Bourne-compatible shell.","status":"active","version":"0.6.9","language":"javascript","source_language":"en","source_url":"https://github.com/lint-staged/lint-staged.sh","tags":["javascript","commit","git","hook","lint","pre_commit","quality","staged","style"],"install":[{"cmd":"npm install lint-staged.sh","lang":"bash","label":"npm"},{"cmd":"yarn add lint-staged.sh","lang":"bash","label":"yarn"},{"cmd":"pnpm add lint-staged.sh","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Installing via npm is optional; the primary method is via skills.sh or copying the script directly.","wrong":"npm install lint-staged.sh","symbol":"lint-staged.sh","correct":"npx skills install https://github.com/lint-staged/lint-staged.sh"},{"note":"Glob patterns should be quoted to prevent shell expansion before the script sees them.","wrong":"#!/bin/sh\nlint-staged.sh \"command\" \"*.js\" *.json","symbol":"pre-commit hook","correct":"#!/bin/sh\nlint-staged.sh \"command\" \"*.js\" \"*.json\"\ngit update-index --again"},{"note":"The command and globs must be separate arguments. Run as a shell script, not an npm package.","wrong":"lint-staged.sh eslint --fix *.js","symbol":"usage","correct":"lint-staged.sh \"eslint --fix\" \"*.js\""}],"quickstart":{"code":"#!/bin/sh\n# Install lint-staged.sh via skills.sh\nnpx skills install https://github.com/lint-staged/lint-staged.sh\n\n# Example: format staged JavaScript and Markdown files with prettier\n# Run this in a pre-commit hook\nlint-staged.sh \"npx prettier --write\" \"*.js\" \"*.md\"\ngit update-index --again","lang":"javascript","description":"Shows how to install and use lint-staged.sh with npx prettier to format staged files, then update git index."},"warnings":[{"fix":"Always quote glob patterns: \"*.js\" instead of *.js","message":"Glob patterns are not automatically escaped; shell expansion may cause unexpected behavior.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Add 'git update-index --again' after the lint-staged.sh command in your hook.","message":"No automatic staging of changes after linter fixes; you must manually run 'git update-index --again'.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider wrapping in a backup mechanism or use lint-staged npm package if rollback is needed.","message":"The script does not revert changes on failure; files may be partially modified if the linter fails.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.6.9':15 'altern':71 'automat':42 'backup':43 'bourn':85 'bourne-compat':84 'cadenc':24 'command':52 'commit':89,94 'compat':86 'configur':38 'depend':36 'design':63 'evalu':50 'failur':47 'file':10,39,58 'filter':59 'git':13,90 'glob':61 'hook':91 'javascript':88 'latest':18 'lightweight':69 'lint':29,74,92 'lint-stag':28,73 'lint-staged.sh':1 'linters/formatters':8 'list':55 'minim':3 'node.js':79 'npm':27 'packag':31 'pattern':62 'pre':93 'qualiti':95 'releas':20 'requir':80 'reset':45 'run':7 'runtim':77 'schedul':23 'script':5,33 'shell':4,87 'simpli':49 'stabl':19 'stage':11,30,57,75,96 'style':97 'transpar':70 'unlik':25 'user':65 'version':14 'want':67 'work':81","created_at":"2026-06-04T18:52:18.391150+00:00","updated_at":"2026-06-04T18:52:18.391150+00:00","problems":[{"fix":"Install via 'npx skills install https://github.com/lint-staged/lint-staged.sh' or copy the script to a directory in PATH.","cause":"The script is not installed or not in PATH.","error":"lint-staged.sh: not found"},{"fix":"Quote glob patterns: lint-staged.sh \"command\" \"*.js\"","cause":"Glob patterns were expanded by the shell before being passed to the script.","error":"Unexpected file list: the command received too many/too few files"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/lint-staged/lint-staged.sh","github":"https://github.com/lint-staged/lint-staged.sh","docs":null,"changelog":null,"pypi":null,"npm":"lint-staged.sh","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}