Enabled lint-staged pre-commit hook on all branches#26792
Conversation
The pre-commit hook only ran lint-staged on the main branch, meaning developers got no linting feedback on feature branches until merge. Removed the branch guard so lint-staged runs on every commit, and expanded the file pattern to include ts, tsx, jsx, and cjs files alongside js.
WalkthroughThis pull request modifies the pre-commit hook and linting configuration. The 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26792 +/- ##
==========================================
- Coverage 73.20% 73.19% -0.01%
==========================================
Files 1534 1534
Lines 121034 121048 +14
Branches 14635 14636 +1
==========================================
+ Hits 88598 88605 +7
- Misses 31405 31413 +8
+ Partials 1031 1030 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
TL;DR
This adds a pre-commit hook that will run eslint on any JS/TS files staged for commit, and prevent the commit from completing if there are any errors.
Motivation
There's nothing more annoying than raising a PR only to see the lint job fail and having to follow up with a "fixed linter" commit. Especially as we are not always typing out the code ourselves in our IDEs anymore, I've been encountering these little annoyances more frequently.
Summary
main-branch-only guard from the pre-commit hook so lint-staged runs on every commit, regardless of branch*.jsto*.{js,ts,tsx,jsx,cjs}to cover TypeScript and CJS files