Skip to content

Commit 920acb4

Browse files
committed
Add tooling for prettier
Use prettier to format and to check formatting of non-python files.
1 parent feb59ad commit 920acb4

File tree

6 files changed

+58
-2
lines changed

6 files changed

+58
-2
lines changed

.github/workflows/main.yml

+9
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,17 @@ jobs:
3333
python-version: 3.12
3434
- run: python --version
3535

36+
- name: Setup npm
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 22
40+
cache: npm
41+
3642
- name: Install project
3743
run: uv sync --all-extras --dev
3844

45+
- name: Install npm dev tools
46+
run: uv run poe sync:npm
47+
3948
- name: Run validations
4049
run: uv run poe all

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,7 @@ cython_debug/
162162
# and can be added to the global gitignore or merged into this file. For a more nuclear
163163
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
164164
#.idea/
165+
166+
167+
/node_modules/
168+
/.ruff_cache/

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**.py

package-lock.json

+28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"private": true,
3+
"devDependencies": {
4+
"prettier": "3.4.1"
5+
}
6+
}

pyproject.toml

+10-2
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,30 @@ dependencies = [
1414
adventofcode = "adventofcode.main:app"
1515

1616
[tool.poe.tasks]
17-
sync = "uv sync"
17+
"sync:uv" = "uv sync"
18+
"sync:npm" = "npm install"
19+
sync = ["sync:uv", "sync:npm"]
20+
1821
"check:mypy" = "mypy ."
22+
"check:prettier" = "npx prettier --check ."
1923
"check:pyright" = "pyright"
2024
"check:ruff" = "ruff check"
2125
"check:ruff:format" = "ruff format --check"
2226
"check:pytest" = "pytest"
2327
check = [
2428
"check:ruff",
2529
"check:ruff:format",
30+
"check:prettier",
2631
"check:pyright",
2732
"check:mypy",
2833
"check:pytest"
2934
]
3035

31-
"fix:format" = "ruff format"
36+
"fix:format:prettier" = "npx prettier --write ."
37+
"fix:format:ruff" = "ruff format"
3238
"fix:ruff" = "ruff check --fix-only"
39+
40+
"fix:format" = ["fix:format:prettier", "fix:format:ruff"]
3341
fix = ["fix:format", "fix:ruff"]
3442

3543
all = ["sync", "check", "runall"]

0 commit comments

Comments
 (0)