feat: enforce lint checks as gate for commits and CI (#54)
All checks were successful
Deploy Feature Branch to Test / PHP Syntax Check (push) Successful in 34s
Deploy Feature Branch to Test / CSS Lint (stylelint) (push) Successful in 1m12s
Deploy Feature Branch to Test / HTML Lint (htmlhint) (push) Successful in 1m10s
Lint / PHP Syntax Check (push) Successful in 32s
Lint / CSS Lint (stylelint) (push) Successful in 1m14s
Lint / HTML Lint (htmlhint) (push) Successful in 1m9s
Lint / PHP Syntax Check (pull_request) Successful in 32s
Lint / CSS Lint (stylelint) (pull_request) Successful in 1m11s
Lint / HTML Lint (htmlhint) (pull_request) Successful in 1m9s
Deploy Feature Branch to Test / Deploy to Test Environment (push) Successful in 24s

- Add PHP syntax check to lint-staged via scripts/lint-php.sh
- Add lint:php script to package.json
- Update lint script to include PHP checks
- Create scripts/safe-commit.sh for AI agent use
- Update deploy-test.yml: lint jobs as gate before deploy
- Add branch protection for main requiring status checks
- Update AGENTS.md with pre-commit hook rules for agents

Also addresses #53: CI requires lint checks before merge

Co-authored-by: Claw <claw@openclaw.local>
This commit is contained in:
Claw
2026-05-22 07:25:57 +00:00
parent 6b605bb961
commit fb646eba85
5 changed files with 157 additions and 8 deletions

View File

@@ -7,12 +7,16 @@
"lint:html": "htmlhint \"**/*.html\"",
"lint:css": "stylelint \"css/**/*.css\" \"fonts/**/*.css\" && echo Stylelint: No errors found",
"lint:js": "eslint \"js/**/*.js\" --ignore-pattern \"**/*.min.js\" && echo ESLint: No errors found",
"lint": "npm run lint:html && npm run lint:css && npm run lint:js",
"lint": "npm run lint:php && npm run lint:html && npm run lint:css && npm run lint:js",
"format": "prettier --write \"**/*.{html,css,js,json,md}\" --ignore-path .prettierignore",
"format:check": "prettier --check \"**/*.{html,css,js,json,md}\" --ignore-path .prettierignore",
"prepare": "husky"
"prepare": "husky",
"lint:php": "find . -name \"*.php\" -not -path \"./vendor/*\" -exec php -l {} \\; > /dev/null 2>&1 && echo \"PHP syntax OK\" || (echo \"PHP lint failed\" && exit 1)"
},
"lint-staged": {
"*.{php}": [
"scripts/lint-php.sh"
],
"*.{html}": [
"htmlhint",
"prettier --write"