Skip to content

Commit 418232c

Browse files
author
Nick Sullivan
committed
⬆️ Modernize pre-commit config with Ruff and Prettier
Consolidates Python tooling by replacing Black, isort, and Fixit with Ruff for faster linting and formatting. Adds Prettier for consistent formatting of JS/JSON/YAML/Markdown files. Updates hook versions and adds descriptive names for better developer experience.
1 parent 57b1615 commit 418232c

File tree

1 file changed

+41
-23
lines changed

1 file changed

+41
-23
lines changed

.pre-commit-config.yaml

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,67 @@ exclude: '\.git/|__pycache__/|\.pyc'
55

66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v5.0.0
8+
rev: v6.0.0
99
hooks:
1010
- id: check-added-large-files
11+
name: Block large files
1112
args: [--maxkb=500]
13+
- id: check-ast
14+
name: Validate Python syntax
1215
- id: check-merge-conflict
16+
name: Detect merge conflicts
1317
- id: check-symlinks
18+
name: Validate symlinks
1419
- id: check-toml
20+
name: Validate TOML syntax
1521
- id: check-yaml
22+
name: Validate YAML syntax
1623
- id: file-contents-sorter
24+
name: Sort .gitignore
1725
files: \.gitignore
18-
- id: mixed-line-ending
19-
- id: pretty-format-json
20-
args: [--autofix, --indent=4, --no-sort-keys]
2126
- id: trailing-whitespace
27+
name: Trim whitespace
2228

2329
- repo: https://github.com/Lucas-C/pre-commit-hooks
2430
rev: v1.5.5
2531
hooks:
2632
- id: remove-tabs
33+
name: Replace tabs with spaces
2734

2835
- repo: https://github.com/sirosen/texthooks
29-
rev: 0.6.8
36+
rev: 0.7.1
3037
hooks:
3138
- id: fix-smartquotes
39+
name: Fix smart quotes
40+
- id: forbid-bidi-controls
41+
name: Forbid bidirectional text (security)
3242

33-
- repo: https://github.com/psf/black
34-
rev: 24.10.0
43+
# Ruff replaces flake8, pylint, isort and more
44+
- repo: https://github.com/astral-sh/ruff-pre-commit
45+
rev: v0.12.10
3546
hooks:
36-
- id: black
37-
38-
- repo: https://github.com/PyCQA/isort
39-
rev: 5.13.2
40-
hooks:
41-
- id: isort
42-
args: [--profile=black]
43-
44-
- repo: https://github.com/Instagram/Fixit
45-
rev: v2.1.0
46-
hooks:
47-
- id: fixit-fix
47+
# Run the linter with auto-fix
48+
- id: ruff
49+
name: Fix Python issues (Ruff)
50+
args: [--fix]
51+
# Run the formatter
52+
- id: ruff-format
53+
name: Format Python (Ruff)
4854

49-
# Ruff replaces flake8 and pylint and more
50-
- repo: https://github.com/charliermarsh/ruff-pre-commit
51-
rev: v0.8.2
55+
# Prettier for JS, JSON, YAML, Markdown, etc. No web/agent assumptions
56+
- repo: https://github.com/rbubley/mirrors-prettier
57+
rev: v3.6.2
5258
hooks:
53-
- id: ruff
59+
- id: prettier
60+
name: Format with Prettier
61+
types_or:
62+
["javascript", "jsx", "ts", "tsx", "css", "scss", "json", "yaml", "markdown"]
63+
exclude: |
64+
(?x)^(
65+
.*\.min\.(js|css)|
66+
.*\.next/|
67+
.*migrations/|
68+
.*out/|
69+
.*node_modules/|
70+
pnpm-lock\.yaml
71+
)$

0 commit comments

Comments
 (0)