{"id":26095,"library":"pre-commit-with-lint","title":"pre-commit-with-lint","description":"A fork of the pre-commit package (v1.2.5) that adds selective linting of only changed files in a commit. It integrates with stylelint and eslint by default, linting CSS/SCSS/Less and JS/JSX files respectively, with configurable patterns. Designed to speed up commits by avoiding full-project linting. Release cadence is low (last update 2017), and it's effectively unmaintained. Key differentiator vs original pre-commit: automatic linting of only staged changes. Alternative better-maintained packages exist.","status":"deprecated","version":"1.2.5","language":"javascript","source_language":"en","source_url":"git://github.com/dyw934854565/pre-commit","tags":["javascript","git","hooks","npm","pre-commit","precommit","run","test","development"],"install":[{"cmd":"npm install pre-commit-with-lint","lang":"bash","label":"npm"},{"cmd":"yarn add pre-commit-with-lint","lang":"bash","label":"yarn"},{"cmd":"pnpm add pre-commit-with-lint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Requires git hooks; installs .git/hooks/pre-commit","package":"git","optional":false},{"reason":"Relies on npm scripts defined in package.json","package":"npm","optional":false}],"imports":[{"note":"No exports; install as devDependency and configure via package.json.","wrong":"npm install -g pre-commit-with-lint","symbol":"pre-commit-with-lint","correct":"npm install pre-commit-with-lint --save-dev"},{"note":"Use 'pre-commit' key (not 'precommit'). Set lint to false to disable all linters. Version 1.2.5.","wrong":"Using \"precommit\" key (deprecated) or \"lint\": true","symbol":"package.json configuration","correct":"{\n  \"pre-commit\": {\n    \"lint\": {\n      \"stylelint\": \"\\\\.(s?css|less)$\",\n      \"eslint\": \"\\\\.jsx?$\"\n    }\n  }\n}"},{"note":"The 'run' key must be an array of npm script names. Without 'run', defaults to 'npm test'.","wrong":"Using \"pre-commit\": [\"test\"] (works but not with lint config)","symbol":"run configuration","correct":"{\n  \"pre-commit\": {\n    \"run\": [\"test\", \"lint\"]\n  }\n}"}],"quickstart":{"code":"mkdir test-repo && cd test-repo && npm init -y && npm install pre-commit-with-lint --save-dev && echo '{\n  \"name\": \"test\",\n  \"version\": \"1.0.0\",\n  \"scripts\": {\n    \"test\": \"echo \\\"tests pass\\\" && exit 0\",\n    \"lint\": \"echo \\\"linting\\\" && exit 0\"\n  },\n  \"pre-commit\": {\n    \"lint\": {\n      \"eslint\": \".js$\"\n    },\n    \"run\": [\"lint\", \"test\"]\n  }\n}' > package.json && git init && git add . && git commit -m \"test commit\"","lang":"javascript","description":"Shows full setup: install, configure package.json with selective lint and scripts, then commit. Verifies pre-commit hook runs lint and test before allowing commit."},"warnings":[{"fix":"Switch to @commitlint/lint-staged or husky + lint-staged.","message":"Package is a fork of pre-commit from 2017; no updates since then. Use modern alternatives like husky + lint-staged.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure listed linters (eslint, stylelint, tslint, etc.) are installed as devDependencies.","message":"If a linter specified in package.json is not installed, the commit will be prevented with an error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set explicit patterns in package.json: { \"pre-commit\": { \"lint\": { \"eslint\": \".jsx?$\" } } }","message":"The default lint patterns are hardcoded and may not match all file types. Misconfigured patterns can cause no linting or broken commits.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use object syntax with 'lint' and 'run' keys, not an array.","message":"clone: The 'pre-commit' key must be an object for lint config; using an array (original pre-commit style) will be ignored without warning.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Install default linters or disable them via config: { \"pre-commit\": { \"lint\": { \"eslint\": \"false\" } } }","message":"If default linters (stylelint, eslint) are not found in node_modules, a warning is printed but commit proceeds. Non-default linters cause an error.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2017':60 'add':16 'altern':79 'automat':73 'avoid':49 'better':81 'better-maintain':80 'cadenc':55 'chang':21,78 'commit':3,12,25,47,72,91 'configur':41 'css/scss/less':35 'default':33 'design':43 'develop':95 'differenti':67 'effect':64 'eslint':31 'exist':84 'file':22,38 'fork':7 'full':51 'full-project':50 'git':86 'hook':87 'integr':27 'javascript':85 'js/jsx':37 'key':66 'last':58 'lint':5,18,34,53,74 'low':57 'maintain':82 'npm':88 'origin':69 'packag':13,83 'pattern':42 'pre':2,11,71,90 'pre-commit':10,70,89 'pre-commit-with-lint':1 'precommit':92 'project':52 'releas':54 'respect':39 'run':93 'select':17 'speed':45 'stage':77 'stylelint':29 'test':94 'unmaintain':65 'updat':59 'v1.2.5':14 'vs':68","created_at":"2026-05-01T13:48:10.878747+00:00","updated_at":"2026-05-01T13:48:10.878747+00:00","problems":[{"fix":"Run: npm install eslint --save-dev; or disable eslint in package.json: \"eslint\": \"false\"","cause":"eslint is not installed but default linting pattern requires it.","error":"Cannot find module 'eslint'"},{"fix":"Check package.json pre-commit configuration, ensure scripts are valid, and reinstall the package.","cause":"Git hook script failed due to a configuration error or missing dependencies.","error":"Something bad happened with the pre-commit hook. You can force the commit by using --no-verify."},{"fix":"Initialize a git repo: git init","cause":"Command run outside a git repository.","error":"fatal: could not open '.git/HEAD': No such file or directory"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"pre-commit-with-lint","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/dyw934854565/pre-commit","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/pre-commit-with-lint","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-05-01","next_check":"2026-07-30","install_tag":null}}