Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Details
What Gets Checked
Pre-commit hooks (run on staged files):
src/Elastic.Documentation.Site/tsc --noEmit(only if TS files are staged)Pre-push hooks (run on files being pushed):
./build.sh lint(runsdotnet format --verify-no-changes)Installation
Husky.Net is included as a dotnet tool. After cloning the repository, restore the tools:
Then install the git hooks:
That's it! The hooks will now run automatically on every commit and push.
Usage
Once installed, hooks run automatically when you commit or push:
Note: If hooks modify files (prettier, eslint), the commit will fail so you can review the changes. Simply stage the changes and commit again:
git add -u git commit -m "your message"If the dotnet-lint hook fails during push, you need to fix the linting errors and commit the fixes before pushing again.
Manual Execution
You can test hooks without committing or pushing:
Configuration
Hook configuration is defined in
.husky/task-runner.json. See the Husky.Net documentation for more details.