Add pre-commit hook to reject lock files from non-project package managers
- Lenguaje dominante
- JavaScript
- Estrellas
- 61
- Forks
- 101
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
### Overview
PRs occasionally include lock files from package managers the project doesn't use (e.g. `package-lock.json` when the project uses Yarn). This causes confusion and bloats diffs. A pre-commit hook should reject these artifacts automatically.
### Action Items
- [ ] Add a pre-commit hook (e.g. via Husky) that checks for `package-lock.json` and `pnpm-lock.yaml` in staged files
- [ ] If detected, reject the commit with a message explaining the project uses Yarn and to run `yarn install` instead
- [ ] Add the hook setup to the project's dev dependencies if Husky is not already configured
- [ ] Consider adding `package-lock.json` and `pnpm-lock.yaml` to `.gitignore` as a secondary safeguard
### Resources/Instructions
- [Husky - Git hooks](https://typicode.github.io/husky/)
- [lint-staged](https://github.com/lint-staged/lint-staged) for running checks on staged files
- Motivated by PR #2134 where `package-lock.json` was accidentally introduced during the ESM migration
Guía de contribución
Línea de trabajo
Start by inspecting the repository's package configuration, existing Git hooks, and .gitignore; review PR #2134 for the lock-file context. Check the Husky and lint-staged instructions linked in the issue, then verify that staged package-lock.json or pnpm-lock.yaml files are rejected with the Yarn guidance and that the relevant hook setup works.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- git, javascript
- Área
- tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 64/100