mirror of
https://github.com/TryGhost/Ghost.git
synced 2026-04-04 22:14:35 +00:00
## 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
- Removed the `main`-branch-only guard from the pre-commit hook so
lint-staged runs on every commit, regardless of branch
- Expanded lint-staged file pattern from `*.js` to
`*.{js,ts,tsx,jsx,cjs}` to cover TypeScript and CJS files
- Verified lint-staged catches errors across all 16 monorepo packages
(apps/*, ghost/*, e2e)