Registry / devops / gw-commit-lint

gw-commit-lint

JSON →
library0.0.4jsnpmunverified

A simple and configurable commit message linter for Git, enforcing conventional commits format. Version 0.0.4 last updated in 2019. No release cadence. Integrates with husky for Git hooks. Differentiators: lightweight, supports custom types, exclude patterns, and custom regex formats. Popular in Chinese developer community. Minimal dependencies, but requires Husky for Git hook integration.

npm install gw-commit-lint
INSTALL
IMPORT
SIG · GW-COMMIT-LINT
G
gw-commit-lint
devopsjavascriptv0.0.4
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.

gw-commit-lint
npx gw-commit-lint <HUSKY_GIT_PARAMS>
import gwCommitLint from 'gw-commit-lint'
CLI tool used via npx or script, not imported as module.
configuration
"gw-commit-lint": { "exclude": ["/foo/g"], "types": ["misc"], "formats": ["/regex/"] }
Configure in package.json under 'gw-commit-lint' key.
husky hook
"husky": { "hooks": { "commit-msg": "gw-commit-lint HUSKY_GIT_PARAMS" } }
"husky": { "hooks": { "commit-msg": "gw-commit-lint" } }
Must pass HUSKY_GIT_PARAMS environment variable to read commit message.

Installs gw-commit-lint with husky, configures commit-msg hook, and shows lint rules.

npm install --save-dev gw-commit-lint husky # In package.json: { "husky": { "hooks": { "commit-msg": "gw-commit-lint HUSKY_GIT_PARAMS" } }, "gw-commit-lint": { "types": ["feat", "fix", "docs"], "exclude": ["^Merge"], "formats": ["^\\w+(\\(\\w+\\))?: .+$"] } } # Now try committing: # git commit -m "feat: add new feature" # PASS # git commit -m "bad message" # FAIL
Debug
Known issues
gotchaMust pass HUSKY_GIT_PARAMS to the CLI command in husky hook. Missing this causes 'Error: no commit message provided'.
fix
Use 'gw-commit-lint HUSKY_GIT_PARAMS' in hook script.
affects: >=0.0.1
gotchaConfig must be in package.json under 'gw-commit-lint' key. Other keys are ignored.
fix
Add exact key 'gw-commit-lint' in package.json.
affects: >=0.0.1
deprecatedPackage last updated in 2019; no active maintenance. May not work with latest Git or Husky versions.
fix
Consider alternatives like commitlint or cz-conventional-changelog.
affects: 0.0.4
gotchaExclude patterns are applied as regex and string exact match. String 'bar' matches exactly 'bar', not substring.
fix
Use regex literal '/bar/' to match substring; string 'bar' matches only 'bar'.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Could not read commit message from git
HUSKY_GIT_PARAMS not provided or hook misconfigured.
fix
Ensure husky hook is: 'gw-commit-lint HUSKY_GIT_PARAMS'.
unknown option `--<option>'
Passing unknown flags to CLI. It only accepts .git/COMMIT_EDITMSG path.
fix
Do not pass options; just pass HUSKY_GIT_PARAMS.
Cannot find module 'gw-commit-lint'
Package not installed locally or global.
fix
Run 'npm install --save-dev gw-commit-lint' in project.
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies
huskyoptionalRecommended for Git hook management to trigger linting on commit-msg.
Agent activity
6 hits · last 30 days
node
6
Resources
gw-commit-lint — npm install gw-commit-lint · libregistry