-
Notifications
You must be signed in to change notification settings - Fork 187
Chore introduce husky lint staged #19775
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: edge
Are you sure you want to change the base?
Conversation
introduce husky and lint-staged for css modules close AUTH-
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## edge #19775 +/- ##
===========================================
+ Coverage 25.81% 56.29% +30.48%
===========================================
Files 3504 3515 +11
Lines 292024 297633 +5609
Branches 31714 39859 +8145
===========================================
+ Hits 75380 167557 +92177
+ Misses 216622 129802 -86820
- Partials 22 274 +252
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
SyntaxColoring
left a comment
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.
Interesting!
Git hooks aren't really my thing. I have my editor set up to do this kind of thing when I save the file, instead. I heavily rely on rewriting local history with git rebase, and I'm a little worried about Git hooks interfering with that (though it seems OK in my testing so far).
Overall, I'm willing to try it if other people think it'll be helpful!
package.json
Outdated
| }, | ||
| "lint-staged": { | ||
| "**/*.css": "yarn stylelint --fix", | ||
| "*.{js,ts,tsx,json,md,yml}": "prettier --write" |
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.
Heads up that this will also prevent you from committing any files with syntax errors. (Prettier will fail with an error, and that error will be treated as a signal from the Git hook to reject the commit.)
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'm pretty on the fence with this one.
I'm all for failing CI if we have a commit that doesn't confirm to some set linting rules, but I think there are a couple of potential pitfalls we open ourselves up to when we do auto-formatting via github hooks:
- Rebase issues as @SyntaxColoring mentioned. I do a lot of this myself and would not like a git hook to impede my workflow personally.
- It's unexpected behavior to an extent. When committing code, it's nice to know that we write is exactly what is committed for sanity reasons.
- We already have
prettierrc.jsregex rules for CSS files. This hook then is either somewhat redundant or at worst, we have two competing CSS formatting rule sets. - Although it's highly unlikely, I could see some sort of weird instance in which some sort of CSS shadowing that causes correct behavior locally causes some sort of bug on CI that is hard to catch for the reasons stated in #2.
All that said, if people are open to trying it, I am as well. I wouldn't mind discussing this further in the next FE meeting, if we'd rather do that!
| "i18next": "^19.8.3", | ||
| "identity-obj-proxy": "^3.0.0", | ||
| "jsdom": "26.1.0", | ||
| "lint-staged": "^16.2.3", |
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.
| "lint-staged": "^16.2.3", | |
| "lint-staged": "16.2.3", |
|
if you end up running into it when rebasing you can use |
|
I'm neutral on this one (like @mjhuff , very positive on having it in CI of course) because it's nice but it does make commits slower, it makes commits feel more formal when they don't have to be, and the rebase thing might be annoying. |
sfoster1
left a comment
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.
okay, i'm okay with this, but we need to really resist adding more stuff to this it could get really slow
Overview
introduce husky lint staged for CSS format and format with prettier.
this doesn't include anything related to type check and test since we sometimes want to ask questions other engineers and for that case, we will need to share the branch via GitHub.
close AUTH-2386
Test Plan and Hands on Testing
ex
protocol-designer/src/pages/Landing/landing.module.cssrun make lint-css
you will see a linting error
git add and commit
you won't see any css linting error
Changelog
Review requests
Risk assessment
low