Skip to content

Commit a755764

Browse files
authored
chore(treefmt): replace prettier with oxfmt and simplify CI (#73)
* build(treefmt): replace prettier with oxfmt Migrate from prettier to oxfmt for formatting non-Python files. oxfmt is part of the oxc project and provides faster formatting with native Rust implementation. Changes: - Remove prettier configuration from treefmt programs - Add oxfmt as custom formatter with explicit includes - Extend supported file types: md, yml, yaml, json, ts, tsx, js, jsx, html, css - Update flake.lock with latest nixpkgs containing oxfmt * chore(just): consolidate lint and format commands Simplify justfile by combining related operations: - lint: now includes format check (nix fmt --fail-on-change) - format: replaces lint-fix, runs ruff fix and nix fmt together This makes the CI workflow simpler as format checking is now part of the lint command. * refactor(ci): simplify lint by leveraging treefmt treefmt already includes ruff-check and typos, so remove redundant commands from justfile and CI workflow. Changes: - Remove separate `uv run ruff check` from lint (treefmt runs ruff-check) - Remove `typos` and `typos-fix` commands (treefmt runs typos) - Remove typos CI job (covered by lint via treefmt)
1 parent 7404a57 commit a755764

File tree

4 files changed

+33
-46
lines changed

4 files changed

+33
-46
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ jobs:
3030
- name: Run Gitleaks
3131
run: nix develop --command just gitleaks
3232

33-
typos:
34-
runs-on: ubuntu-latest
35-
steps:
36-
- name: Checkout repository
37-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
38-
39-
- name: Setup Nix
40-
uses: ./.github/actions/setup-nix
41-
42-
- name: Run Typo Check
43-
run: nix develop --command just typos
44-
4533
ci:
4634
runs-on: ubuntu-latest
4735
strategy:

flake.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,26 @@
4242
nixfmt.package = pkgs.nixfmt-rfc-style;
4343
ruff-check.enable = true;
4444
ruff-format.enable = true;
45-
prettier = {
46-
enable = true;
47-
includes = [
48-
"*.md"
49-
"*.yml"
50-
"*.yaml"
51-
"*.json"
52-
];
53-
excludes = [
54-
"CHANGELOG.md"
55-
];
56-
};
5745
typos.enable = true;
46+
typos.configFile = "typos.toml";
47+
};
48+
settings.formatter.oxfmt = {
49+
command = "${pkgs.oxfmt}/bin/oxfmt";
50+
includes = [
51+
"*.md"
52+
"*.yml"
53+
"*.yaml"
54+
"*.json"
55+
"*.ts"
56+
"*.tsx"
57+
"*.js"
58+
"*.jsx"
59+
"*.html"
60+
"*.css"
61+
];
62+
excludes = [
63+
"CHANGELOG.md"
64+
];
5865
};
5966
};
6067

justfile

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
install *extras:
33
uv sync {{ extras }}
44

5-
# Run ruff linting
5+
# Run linting and format check (ruff, typos, nixfmt, oxfmt)
66
lint:
7-
uv run ruff check .
7+
nix fmt -- --fail-on-change
88

9-
# Auto-fix linting issues
10-
lint-fix:
11-
uv run ruff check --fix .
9+
# Format and auto-fix linting issues
10+
format:
11+
nix fmt
1212

1313
# Run all tests
1414
test:
@@ -30,18 +30,10 @@ test-examples:
3030
ty:
3131
uv run ty check stackone_ai
3232

33-
# Run typos spell checker
34-
typos:
35-
typos --config typos.toml .
36-
3733
# Run gitleaks secret detection
3834
gitleaks:
3935
gitleaks detect --source . --config .gitleaks.toml
4036

41-
# Fix typos
42-
typos-fix:
43-
typos --config typos.toml --write-changes .
44-
4537
# Update version in __init__.py
4638
update-version:
4739
uv run scripts/update_version.py

0 commit comments

Comments
 (0)