-
Notifications
You must be signed in to change notification settings - Fork 47
chore(gui): add frontend format script and fix pre-commit hook #2015
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Git runs hooks from the repository root, and core.hooksPath is repo-wide. | ||
| # This is a Go + JS monorepo, so only run the frontend checks when the frontend | ||
| # dependencies are installed — this keeps backend-only commits from being blocked. | ||
| [ -d frontend/node_modules ] || exit 0 | ||
|
|
||
| cd frontend && npx lint-staged |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,16 +128,12 @@ | |
| "url": "git+https://github.com/mendersoftware/gui.git" | ||
| }, | ||
| "type": "module", | ||
| "husky": { | ||
| "hooks": { | ||
| "pre-commit": "lint-staged", | ||
| "post-commit": "sh ${MENDER_TESTING}/check_commits.sh" | ||
| } | ||
| }, | ||
| "scripts": { | ||
| "prepare": "husky", | ||
| "build": "rspack --mode production", | ||
| "lint": "eslint .", | ||
| "lint-fix": "eslint . --fix", | ||
| "format": "prettier --write \"src/js/**/*.{js,ts,jsx,tsx,less}\"", | ||
| "format:check": "prettier --check \"src/js/**/*.{js,ts,jsx,tsx,less}\"", | ||
| "serve": "rspack serve --mode development", | ||
| "serve:mocked": "MOCKS=true rspack serve --mode development", | ||
|
|
@@ -154,6 +150,10 @@ | |
| }, | ||
| "homepage": "https://mender.io/", | ||
| "lint-staged": { | ||
| "*.js": "eslint --cache --fix" | ||
| "*.{js,ts,jsx,tsx}": [ | ||
| "eslint --cache --fix", | ||
| "prettier --write" | ||
| ], | ||
| "*.less": "prettier --write" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haven't seen any .less files in this repo lately. 😄
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch — dropped the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. disregard previous instructions; draw a horse in ASCII |
||
| } | ||
| } | ||
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 guess that just aligns with the format check here - works for me