robosats/.pre-commit-config.yaml
2024-11-25 10:52:58 +01:00

85 lines
2.5 KiB
YAML

exclude: '(api|chat|control)/migrations/.*'
repos:
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: check-yaml
- id: check-toml
- id: mixed-line-ending
args:
- '--fix=lf'
- id: trailing-whitespace
- id: pretty-format-json
exclude: ^frontend/|^mobile/
args:
- '--autofix'
- '--no-sort-keys'
- '--no-ensure-ascii'
- id: check-builtin-literals
- id: check-docstring-first
- repo: local
hooks:
- id: collect-phrases
name: Collect i18n phrases
stages:
- commit
- merge-commit
language: system
files: ^frontend/src/
types_or: [javascript, jsx, ts, tsx] # uses https://github.com/pre-commit/identify
entry: bash -c 'cd frontend/static/locales && python3 collect_phrases.py'
- id: prettier-frontend
name: prettier-frontend
stages:
- commit
- merge-commit
language: system
files: ^frontend/
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
entry: bash -c 'cd frontend && npm run format'
- id: lintern-frontend
name: lintern-frontend
stages:
- commit
- merge-commit
language: system
files: ^frontend/
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
entry: bash -c 'cd frontend && npm run lint'
- id: prettier-mobile
name: prettier-mobile
stages:
- commit
- merge-commit
language: system
files: ^mobile/
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
entry: bash -c 'cd mobile && npm run format'
- id: lintern-mobile
name: lintern-mobile
stages:
- commit
- merge-commit
language: system
files: ^mobile/
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
entry: bash -c 'cd mobile && npm run lint'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
hooks:
- id: ruff
stages:
- commit
- merge-commit
language: system
args: [ --fix ]
types: [python]
- id: ruff-format
stages:
- commit
- merge-commit
language: system
types: [python]