[CI] Add Husky + lint-staged to enforce existing lint checks at commit time#5867
[CI] Add Husky + lint-staged to enforce existing lint checks at commit time#5867thevanshit wants to merge 3 commits intosugarlabs:masterfrom
Conversation
|
✅ All Jest tests passed! This PR is ready to merge. |
|
Hi @thevanshit , I'm the one who opened this issue and had planned to implement it. I noticed the PR also includes unrelated commits (chore: remove debug console statements, Adding a PERFORMANCE.md file) — it's generally good practice to keep PRs focused on a single change. Happy to collaborate or help review if needed! |
a093104 to
007ab63
Compare
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
|
Hi, @Anshikakalpana I have cleaned the PR so it now contains only the Husky + lint-staged configuration changes. If maintainers prefer, I can:
Happy to refine further |
007ab63 to
a5405f2
Compare
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
- Add MIN_HIGHLIGHT_DURATION_MS to logoconstants test expectations - Remove incorrect console expectation in palette.test.js - Add stage.update mock to logo.test.js - Fix delayExecution mock to handle missing callback Note: These failures existed on upstream/master before this PR. Reduced logo.test.js failures from 11 to 5.
a5405f2 to
3e25648
Compare
|
❌ Some Jest tests failed. Please check the logs and fix the issues before merging. Failed Tests: |
- Fix initMediaDevices: update logo.deps.Tone directly in test - Fix dispatchTurtleSignals tests: update logo.deps.utils.delayExecution - Fix doStopTurtles: update logo.deps.instruments and turtleList - Fix constructor deps test: add missing required fields All 181 tests now pass (logo: 71, palette: 103, logoconstants: 7)
|
✅ All Jest tests passed! This PR is ready to merge. |
|
Hi @Anshikakalpana and maintainers, I’ve addressed the feedback and refined this PR: The goal remains to enforce the existing ESLint + Prettier workflow locally without introducing new rules or changing current contributor workflows. Thanks! |
|
no one is going to review this PR please dont raise such a bulky pr Thanks !! |
Summary
This PR adds Husky and lint-staged to automatically run the existing ESLint and Prettier checks on staged files before each commit.
The goal is to enforce the current linting and formatting workflow at commit time without introducing new rules or modifying the existing developer workflow.
Changes
huskyandlint-stagedas dev dependencies"prepare": "husky install"script to enable hooks automatically afternpm installlint-stagedinsidepackage.jsonto:eslint --fixon*.{js,mjs}filesprettier --writeon staged files.husky/pre-commithook to triggerlint-stagedBehavior
git commitnow runs lint and formatting checks on staged files onlygit commit --no-verifynpm run lintworkflow remains unchangedTesting
Closes #5864