Skip to content

Conversation

@azizbecha
Copy link

Summary

This PR significantly improves the development workflow by implementing automated code quality and commit validation. It introduces:

1. Git Hooks (Husky)

  • Pre-commit hook: Automatically formats staged files and builds all packages
  • Pre-push hook: Ensures builds are clean before pushing to remote

2. Automated Code Formatting (Lint-Staged)

  • Runs Biome formatter on staged files
  • Prevents inconsistent code from being committed

3. Commit Message Validation (Commitlint)

  • Enforces conventional commit messages (feat, fix, chore, docs, etc.)
  • Prevents invalid commit messages from being created

4. Enhanced npm Scripts

  • pnpm run build:all - Builds all packages in correct dependency order
  • pnpm run dev - Starts the tester dev server
  • pnpm run preview - Previews the production build

Test plan

  1. Test pre-commit hook:

    # Make a change to a file
    git add .
    git commit -m "chore: test hooks"
    # Verify: Should lint-stage and build all packages
  2. Test commit message validation:

    git commit -m "invalid message"
    # Expected: Rejected with error message
    
    git commit -m "feat: valid message"
    # Expected: Accepted and proceeds
  3. Verify all scripts work:

    pnpm run lint
    pnpm run typecheck
    pnpm run build:all
    pnpm run dev

Copy link
Member

@jbroma jbroma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for the contribution 🎉

most changes look good, left few comments tho 👍

"@changesets/cli": "^2.27.10",
"@commitlint/cli": "^20.3.1",
"@commitlint/config-conventional": "^20.3.1",
"husky": "^9.1.7",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

husky was added but I believe you forgot to create the actual hooks with it

package.json Outdated
"lint": "biome check --write",
"typecheck": "pnpm -r typecheck"
"typecheck": "pnpm -r typecheck",
"lint-staged": "lint-staged"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed, in husky you can just run pnpm lint-staged

"lint-staged": "^16.2.7"
},
"lint-staged": {
"*.{ts,tsx,js,jsx,json,md}": "biome format"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather go with lint which will run everything it can (lint,format,import organizer)

@azizbecha
Copy link
Author

Hey @jbroma, thanks for the review!
I applied all your remarks, can you take a look again and tell me if there's something else that needs to done ?
Thanks.

Copy link
Member

@jbroma jbroma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems that there is still no setup for husky and running lint-staged (which was removed) - lets bring it back and setup husky, I believe it was pnpx husky init to create the precommit hook :)

@azizbecha
Copy link
Author

Yes, you're right. For some reason the husky files weren't pushed to the repo.
Now everything is working well.
Screen Shot 2026-01-23 at 17 03 26 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants