-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
106 lines (98 loc) · 2.71 KB
/
.pre-commit-config.yaml
File metadata and controls
106 lines (98 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
repos:
# Ruff - Fast Python linter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.15
hooks:
# Run the linter
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
# Run the formatter
- id: ruff-format
# MyPy - Static type checker
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies:
- types-redis
- types-requests
- sqlalchemy[mypy]
args: [--ignore-missing-imports, --no-strict-optional]
exclude: ^(alembic/|tests/)
# General pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
# Trim trailing whitespace
- id: trailing-whitespace
exclude: ^(.*\.md|.*\.txt)
# Ensure files end with newline
- id: end-of-file-fixer
# Check YAML syntax
- id: check-yaml
args: [--safe]
# Check JSON syntax
- id: check-json
# Check for files that would conflict on case-insensitive filesystems
- id: check-case-conflict
# Check for merge conflicts
- id: check-merge-conflict
# Check for added large files (>500KB)
- id: check-added-large-files
args: [--maxkb=500]
# Check Python syntax
- id: check-ast
# Check for debugger imports
- id: debug-statements
# Detect private keys
- id: detect-private-key
# Prettier - Frontend code formatter
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
types_or: [javascript, jsx, ts, tsx, json, css, scss, yaml, markdown]
files: ^frontend/
exclude: ^frontend/(node_modules/|dist/|build/)
# ESLint - Frontend linter
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.0.0-beta.0
hooks:
- id: eslint
files: ^frontend/.*\.[jt]sx?$
types: [file]
additional_dependencies:
- eslint@8.56.0
- eslint-config-react-app@7.0.1
- "@typescript-eslint/parser@6.19.1"
- "@typescript-eslint/eslint-plugin@6.19.1"
# Configuration
default_language_version:
python: python3.11
node: "20.11.0"
# Exclude common directories
exclude: |
(?x)^(
\.git/|
\.venv/|
venv/|
node_modules/|
__pycache__/|
\.pytest_cache/|
\.mypy_cache/|
\.ruff_cache/|
alembic/versions/|
frontend/dist/|
frontend/build/
)
# Only run on specific files
files: |
(?x)^(
backend/.*\.py$|
frontend/.*\.(tsx?|jsx?|css|json|ya?ml)$|
\.pre-commit-config\.yaml$|
pyproject\.toml$|
package\.json$
)
# Fail fast - stop after first failure
fail_fast: false