-
Notifications
You must be signed in to change notification settings - Fork 142
feat: implement formatting checks to CI #1153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: implement formatting checks to CI #1153
Conversation
✅ Deploy Preview for endearing-brigadeiros-63f9d0 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1153 +/- ##
=======================================
Coverage 82.80% 82.80%
=======================================
Files 66 66
Lines 2786 2786
Branches 334 334
=======================================
Hits 2307 2307
Misses 432 432
Partials 47 47 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this would be overridden by any local formatting rules. Is the priority configurable on our side? 🤔
Also, is it possible to modify this so that it formats automatically on save? Though a bit annoying, it's probably the best way to help contributors get the formatting right.
Usually a job for lint-staged and husky to apply it in a commit hook: https://prettier.io/docs/install.html#git-hooks Applying on save is harder. I use the prettier-vscode extension which picks up the project's config and applies it on save. Its still worth having a check in on formatting in CI - but make it check ( |
I also use prettier-vscode, which automatically detects the project configuration and applies formatting on save. Having a formatting check in CI ensures that what gets pushed is properly formatted. If you think it would be useful, I can implement lint-staged and husky to format code at commit time. |
Formatting on commit works well on other projects I contribute to @fabiovincenzi. We're already running something via husky on commit - just commitlint I think: https://github.com/finos/git-proxy/blob/main/.husky/commit-msg |
Check seems to work, but needs an |
I’ll run npm run format now. I delayed it earlier to keep the review clearer. |
Fair! Looking good on the check. Have you tested the pre-commit hook without the VSCode plugin running? It should run when you commit to your fork, so you can derive a new branch to test on without affecting the PR. I haven't had a chance to do so. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - pending confirmation that the pre-commit hook is working (without a VsCode plugin applying rules on save) - note it will only apply prettier to files that are changing in a commit (staged files)
I’ve tested it on a separate branch without the VSCode plugin, and I can confirm the pre-commit hook is working as expected. Thanks @kriswest for the review! |
Fixes #1152
Adds formatting checks to CI pipeline, automated formatting via a pre-commit hook and improves npm scripts to enforce consistent code formatting across the codebase, preventing formatting-related merge conflicts.