hackforla / hackforla/VRMS

Add pre-commit hook to reject lock files from non-project package managers

Đang mở
#2,139 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
complexity: small Dependency - Icebox feature: Package Update role: devops size: 1pt
Ngôn ngữ chính
JavaScript
Star
61
Fork
101
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách kiểm tra cấu hình package của repository, các Git hook hiện có và .gitignore; xem PR #2134 để nắm ngữ cảnh của lock-file. Kiểm tra các hướng dẫn về Husky và lint-staged được liên kết trong issue, sau đó xác minh rằng các tệp package-lock.json hoặc pnpm-lock.yaml đã được stage bị từ chối kèm hướng dẫn của Yarn và rằng thiết lập hook liên quan hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
git, javascript
Lĩnh vực
tooling
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
64/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.