docs: Add Husky.Net option (#12040)
Co-authored-by: fisker Cheung <lionkay@gmail.com>
This commit is contained in:
1 parent
2e2f2f50e7
commit
7c16d226f1
2 files changed
+44
-4
No files matched your search
+22
-2
@@ -61,7 +61,27 @@ Copy the following config into your `.pre-commit-config.yaml` file:
|
||||
|
||||
Read more at [mirror of prettier package for pre-commit](https://github.com/pre-commit/mirrors-prettier) and the [pre-commit](https://pre-commit.com) website.
|
||||
|
||||
## Option 4. [git-format-staged](https://github.com/hallettj/git-format-staged)
|
||||
## Option 4. [Husky.Net](https://github.com/alirezanet/Husky.Net)
|
||||
|
||||
**Use Case:** A dotnet solution to use Prettier along with other code quality tools (e.g. dotnet-format, ESLint, Stylelint, etc.). It supports multiple file states (staged - last-commit, git-files etc.)
|
||||
|
||||
```bash
|
||||
dotnet tool install husky
|
||||
dotnet husky install
|
||||
dotnet husky add .husky/pre-commit
|
||||
```
|
||||
|
||||
after installation you can add prettier task to the `task-runner.json`.
|
||||
|
||||
```json
|
||||
{
|
||||
"command": "npx",
|
||||
"args": ["prettier", "--ignore-unknown", "--write", "${staged}"],
|
||||
"pathMode": "absolute"
|
||||
}
|
||||
```
|
||||
|
||||
## Option 5. [git-format-staged](https://github.com/hallettj/git-format-staged)
|
||||
|
||||
**Use Case:** Great for when you want to format partially-staged files, and other options do not provide a good fit for your project.
|
||||
|
||||
@@ -97,7 +117,7 @@ Add or remove file extensions to suit your project. Note that regardless of whic
|
||||
|
||||
To read about how git-format-staged works see [Automatic Code Formatting for Partially-Staged Files](https://www.olioapps.com/blog/automatic-code-formatting/).
|
||||
|
||||
## Option 5. Shell script
|
||||
## Option 6. Shell script
|
||||
|
||||
Alternately you can save this script as `.git/hooks/pre-commit` and give it execute permission:
|
||||
|
||||
|
||||
@@ -62,7 +62,27 @@ Copy the following config into your `.pre-commit-config.yaml` file:
|
||||
|
||||
Read more at [mirror of prettier package for pre-commit](https://github.com/pre-commit/mirrors-prettier) and the [pre-commit](https://pre-commit.com) website.
|
||||
|
||||
## Option 4. [git-format-staged](https://github.com/hallettj/git-format-staged)
|
||||
## Option 4. [Husky.Net](https://github.com/alirezanet/Husky.Net)
|
||||
|
||||
**Use Case:** A dotnet solution to use Prettier along with other code quality tools (e.g. dotnet-format, ESLint, Stylelint, etc.). It supports multiple file states (staged - last-commit, git-files etc.)
|
||||
|
||||
```bash
|
||||
dotnet tool install husky
|
||||
dotnet husky install
|
||||
dotnet husky add .husky/pre-commit
|
||||
```
|
||||
|
||||
after installation you can add prettier task to the `task-runner.json`.
|
||||
|
||||
```json
|
||||
{
|
||||
"command": "npx",
|
||||
"args": ["prettier", "--ignore-unknown", "--write", "${staged}"],
|
||||
"pathMode": "absolute"
|
||||
}
|
||||
```
|
||||
|
||||
## Option 5. [git-format-staged](https://github.com/hallettj/git-format-staged)
|
||||
|
||||
**Use Case:** Great for when you want to format partially-staged files, and other options do not provide a good fit for your project.
|
||||
|
||||
@@ -98,7 +118,7 @@ Add or remove file extensions to suit your project. Note that regardless of whic
|
||||
|
||||
To read about how git-format-staged works see [Automatic Code Formatting for Partially-Staged Files](https://www.olioapps.com/blog/automatic-code-formatting/).
|
||||
|
||||
## Option 5. Shell script
|
||||
## Option 6. Shell script
|
||||
|
||||
Alternately you can save this script as `.git/hooks/pre-commit` and give it execute permission:
|
||||
|
||||
|
||||
Reference in new issue
Block a user