From eac0a17473a6bdb0a2b329a9062dbc0255a6bc39 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 1 Oct 2024 22:35:17 +0200 Subject: [PATCH] chore: add husky + prettier/dotnet format pre-commit --- .config/dotnet-tools.json | 13 +++++++++++ .husky/pre-commit | 22 +++++++++++++++++++ .husky/task-runner.json | 21 ++++++++++++++++++ .../.idea/jsLinters/eslint.xml | 1 + .idea/.idea.Foxnouns.NET/.idea/prettier.xml | 2 +- package.json | 3 ++- 6 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 .config/dotnet-tools.json create mode 100755 .husky/pre-commit create mode 100644 .husky/task-runner.json diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..e6df774 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "husky": { + "version": "0.7.1", + "commands": [ + "husky" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..fd85d23 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,22 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +## husky task runner examples ------------------- +## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky' + +## run all tasks +#husky run + +### run all tasks with group: 'group-name' +#husky run --group group-name + +## run task with name: 'task-name' +#husky run --name task-name + +## pass hook arguments to task +#husky run --args "$1" "$2" + +## or put your custom commands ------------------- +#echo 'Husky.Net is awesome!' + +dotnet husky run diff --git a/.husky/task-runner.json b/.husky/task-runner.json new file mode 100644 index 0000000..bb845ca --- /dev/null +++ b/.husky/task-runner.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://alirezanet.github.io/Husky.Net/schema.json", + "tasks": [ + { + "name": "run-prettier", + "command": "yarn", + "args": [ + "format", + "${staged}" + ], + "pathMode": "absolute" + }, + { + "name": "dotnet-format", + "command": "dotnet", + "args": [ + "format" + ] + } + ] +} diff --git a/.idea/.idea.Foxnouns.NET/.idea/jsLinters/eslint.xml b/.idea/.idea.Foxnouns.NET/.idea/jsLinters/eslint.xml index 204acf7..5f8621e 100644 --- a/.idea/.idea.Foxnouns.NET/.idea/jsLinters/eslint.xml +++ b/.idea/.idea.Foxnouns.NET/.idea/jsLinters/eslint.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/.idea/.idea.Foxnouns.NET/.idea/prettier.xml b/.idea/.idea.Foxnouns.NET/.idea/prettier.xml index 653a9e0..ffcf89b 100644 --- a/.idea/.idea.Foxnouns.NET/.idea/prettier.xml +++ b/.idea/.idea.Foxnouns.NET/.idea/prettier.xml @@ -1,7 +1,7 @@ -