commit-sheriff 1.7.1 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -251,19 +251,19 @@ The default config added by `init` (only if you don't already have one):
251
251
  ```json
252
252
  {
253
253
  "lint-staged": {
254
- "*.{js,jsx,ts,tsx}": ["eslint --fix --max-warnings=0", "prettier --write"],
254
+ "*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
255
255
  "*.{json,md,css,scss,html}": ["prettier --write"]
256
256
  }
257
257
  }
258
258
  ```
259
259
 
260
- `--max-warnings=0` is there on purpose: ESLint only fails (non-zero exit) on errors by default, so
261
- a rule set to `"warn"` (e.g. many "recommended" configs' default severity for unused imports) would
262
- otherwise print in the terminal but still let the commit through looking clean.
260
+ Warnings are printed but never block the commit — only actual errors (ESLint's non-zero exit) do.
261
+ That's the default ESLint behavior (`--fix` alone exits 0 on warning-only results), so a rule set to
262
+ `"warn"` (e.g. an unused import under some "recommended" configs) shows up in the terminal as a
263
+ heads-up but doesn't stop you from committing.
263
264
 
264
- Adjust freely — `commit-sheriff` doesn't overwrite it once present. That also means this default
265
- only lands on **new** setups; if your project already has a `lint-staged` block from before this
266
- change, add `--max-warnings=0` to it by hand to get the same behavior.
265
+ Adjust freely — `commit-sheriff` doesn't overwrite it once present. If you want warnings to block
266
+ the commit too, add `--max-warnings=0` to the `eslint --fix` command by hand.
267
267
 
268
268
  ## Advanced: ESLint module-boundary template (TypeScript/React)
269
269
 
@@ -38,10 +38,9 @@ const DEFAULT_COMMIT_GUARD = {
38
38
  };
39
39
 
40
40
  const DEFAULT_LINT_STAGED = {
41
- // --max-warnings=0: without this, ESLint only fails (non-zero exit) on errors a warning
42
- // (e.g. many "recommended" configs' default severity for unused imports) prints in the
43
- // terminal but still lets `eslint --fix` exit 0, so the commit goes through looking clean.
44
- "*.{js,jsx,ts,tsx}": ["eslint --fix --max-warnings=0", "prettier --write"],
41
+ // No --max-warnings=0 here on purpose: warnings should be visible (ESLint prints them to the
42
+ // terminal either way) but must NOT block the commit only actual errors (non-zero exit) do.
43
+ "*.{js,jsx,ts,tsx}": ["eslint --fix", "prettier --write"],
45
44
  "*.{json,md,css,scss,html}": ["prettier --write"],
46
45
  };
47
46
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commit-sheriff",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Shared husky commit-msg / pre-commit hooks enforcing ticket-based commit messages and branch naming",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -77,7 +77,11 @@ HAS_LINT_CONFIG=$(node -e "
77
77
  " 2>/dev/null)
78
78
  if [ "$HAS_LINT_CONFIG" = "1" ]; then
79
79
  if node -e "require.resolve('lint-staged')" 2>/dev/null; then
80
- npx lint-staged || exit 1
80
+ # --verbose: lint-staged only prints a task's output when it *fails* by default, so a
81
+ # warning-only ESLint result (exit 0, commit still allowed through) would otherwise show
82
+ # nothing at all. --verbose keeps it printing on success too, so warnings stay visible as
83
+ # a heads-up without blocking the commit.
84
+ npx lint-staged --verbose || exit 1
81
85
  else
82
86
  echo ""
83
87
  echo " package.json-da 'lint-staged' konfiqurasiyası var, amma paketin özü"