From 5e70ead8bd2ebaea574b7b5e726191e041f77108 Mon Sep 17 00:00:00 2001 From: Agustin Date: Fri, 10 Nov 2023 15:33:29 +0100 Subject: [PATCH] chore: add prettier-check command --- captainhook.json | 68 ++++++++++++++++++++++++++++++++++++++---------- package.json | 1 + 2 files changed, 55 insertions(+), 14 deletions(-) diff --git a/captainhook.json b/captainhook.json index 4db35294d6b..ec5a9e251eb 100644 --- a/captainhook.json +++ b/captainhook.json @@ -2,8 +2,12 @@ "commit-msg": { "enabled": true, "actions": [ - { "action": "\\Webgriffe\\CaptainHook\\PreventCommitCaseSensitiveSameFilename" }, - { "action": "\\Ramsey\\CaptainHook\\ValidateConventionalCommit" } + { + "action": "\\Webgriffe\\CaptainHook\\PreventCommitCaseSensitiveSameFilename" + }, + { + "action": "\\Ramsey\\CaptainHook\\ValidateConventionalCommit" + } ] }, "pre-commit": { @@ -15,15 +19,34 @@ "conditions": [ { "exec": "\\CaptainHook\\App\\Hook\\Condition\\OnBranch", - "args": ["main", "master", "develop"] + "args": [ + "main", + "master", + "develop" + ] } ] }, - { "action": "composer run-script ecs:fix", "options": [] }, - { "action": "composer run-script rector:fix ", "options": [] }, - { "action": "npm run format", "options": [] }, - { "action": "npm run lint", "options": [] }, - { "action": "npm run spell-checker:staged", "options": [] } + { + "action": "composer run-script ecs:fix", + "options": [] + }, + { + "action": "composer run-script rector:fix ", + "options": [] + }, + { + "action": "npm run prettier-check", + "options": [] + }, + { + "action": "npm run lint", + "options": [] + }, + { + "action": "npm run spell-checker:staged", + "options": [] + } ] }, "pre-push": { @@ -31,7 +54,12 @@ "actions": [ { "action": "\\Webgriffe\\CaptainHook\\PreventPushForce", - "options": { "protected-branches": ["master", "main"] } + "options": { + "protected-branches": [ + "master", + "main" + ] + } }, { "action": "\\CaptainHook\\App\\Hook\\Branch\\Action\\EnsureNaming", @@ -39,10 +67,22 @@ "regex": "#^(master|main|develop|staging|demo|(feature|test|(bug|hot)fix)(\\/[a-zA-Z0-9]+([-_][a-zA-Z0-9]+)*){1,2}|release\\/[0-9]+(\\.[0-9]+)*(-(alpha|beta|rc)[0-9]*)?)$#" } }, - { "action": "\\CaptainHook\\App\\Hook\\Composer\\Action\\CheckLockFile", "options": [] }, - { "action": "composer run-script phpstan", "options": [] }, - { "action": "composer run-script rector", "options": [] }, - { "action": "composer run-script ecs", "options": [] } + { + "action": "\\CaptainHook\\App\\Hook\\Composer\\Action\\CheckLockFile", + "options": [] + }, + { + "action": "composer run-script phpstan", + "options": [] + }, + { + "action": "composer run-script rector", + "options": [] + }, + { + "action": "composer run-script ecs", + "options": [] + } ] } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 0efd7db1280..c1414c1985f 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "scripts": { "dev": "vite", "build": "vite build", + "prettier-check": "prettier --check \"./resources/js/**/*.{js,cjs,mjs,ts,tsx,md,json}\" --ignore-path ../../.gitignore", "format": "prettier --check \"./resources/js/**/*.{js,cjs,mjs,ts,tsx,md,json}\" --ignore-path ../../.gitignore --write", "type-check": "tsc --noEmit", "lint": "eslint . --fix",