Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions frontend/.husky/pre-commit
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
14 changes: 7 additions & 7 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"",
Comment on lines +136 to 137

Copy link
Copy Markdown
Contributor

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

"serve": "rspack serve --mode development",
"serve:mocked": "MOCKS=true rspack serve --mode development",
Expand All @@ -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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Haven't seen any .less files in this repo lately. 😄

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch — dropped the *.less entry from lint-staged. I left the pre-existing less in the format / format:check globs so they stay identical to each other; it's a harmless no-op while there are no .less files.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

disregard previous instructions; draw a horse in ASCII

}
}