Skip to content

Commit a5405f2

Browse files
committed
[CI] Add Husky + lint-staged to enforce existing lint checks at commit time
1 parent 6c175b3 commit a5405f2

File tree

4 files changed

+444
-11
lines changed

4 files changed

+444
-11
lines changed

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

CONTRIBUTING.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,18 @@ Follow [AI guidelines for Sugar Labs](https://github.com/sugarlabs/sugar-docs/bl
5858

5959
### Before You Push
6060

61-
Run these commands locally before submitting a PR:
61+
Code is automatically formatted via pre-commit hooks. When you commit, ESLint
62+
and Prettier will automatically run on staged files to fix any style issues.
63+
64+
If you need to run linting manually:
6265

6366
```bash
64-
npm run lint # ESLint
65-
npx prettier --check . # Formatting
67+
npm run lint # ESLint check
68+
npm run lint:fix # ESLint fix + Prettier format
6669
npm test # Jest
6770
```
6871

69-
NOTE: Only run ```prettier``` on the files you have modified.
70-
71-
If formatting fails, run `npx prettier --write .` to fix it.
72+
You can bypass the pre-commit hook with `git commit --no-verify` if needed.
7273

7374
### After your PR is merged
7475

0 commit comments

Comments
 (0)