Skip to content

Commit

Permalink
Use local pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Hasnep committed Jul 16, 2024
1 parent 0dfcc4e commit 90398d0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/run-pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Install dependencies
run: npm ci
- name: Run Pre-commit
uses: pre-commit/action@v3.0.0
env:
Expand Down
31 changes: 14 additions & 17 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,18 @@ repos:
id: check-shebang-scripts-are-executable

# TypeScript
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
- repo: local
hooks:
- name: Format TypeScript files
id: prettier
language: system
entry: npx prettier --write
types: [ts]
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.44.0
hooks:
- name: Lint TypeScript files
id: eslint
language: system
entry: npx eslint --fix
types: [ts]
additional_dependencies:
- "@typescript-eslint/eslint-plugin@6.0.0"
- "@typescript-eslint/parser@6.0.0"
- eslint@8.44.0
- repo: local
hooks:
- name: Make sure Typescript code has been transpiled
id: check-built
language: system
Expand All @@ -53,11 +47,12 @@ repos:
hooks:
- name: Validate YAML
id: check-yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
- repo: local
hooks:
- name: Format YAML files
id: prettier
language: system
entry: npx prettier --write
types: [yaml]

# JSON
Expand All @@ -66,19 +61,21 @@ repos:
hooks:
- name: Validate JSON
id: check-json
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
- repo: local
hooks:
- name: Format JSON files
id: prettier
language: system
entry: npx prettier --write
types: [json]

# Markdown
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
- repo: local
hooks:
- name: Format markdown files
id: prettier
language: system
entry: npx prettier --write
types: [markdown]

# GitHub Actions
Expand Down

0 comments on commit 90398d0

Please sign in to comment.