Skip to content

Commit 1d9a3b3

Browse files
committed
Align local and pre-commit linting with CI settings
- Backend lint scripts now target `.` instead of `app/` to match CI - Frontend lint scripts use same ESLint flags as `npm run lint` (full dir, --max-warnings 0) - Pre-commit ESLint hook updated to match - Add noqa: E402 to post-settings imports in tests/conftest.py
1 parent 656606b commit 1d9a3b3

5 files changed

Lines changed: 23 additions & 9 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ repos:
1919

2020
- id: ty
2121
name: ty
22-
entry: bash -c 'cd backend && uv run ty check app'
22+
entry: bash -c 'export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" && cd backend && uv run ty check app'
2323
language: system
2424
files: ^backend/.*\.py$
2525
pass_filenames: false
2626

2727
- id: eslint
2828
name: eslint
29-
entry: bash -c 'export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" && cd frontend && node_modules/.bin/eslint src'
29+
entry: bash -c 'export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" && cd frontend && node_modules/.bin/eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0'
3030
language: system
3131
files: ^frontend/src/.*\.(ts|tsx)$
3232
pass_filenames: false

backend/tests/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
# Tests use plain HTTP (base_url="http://test"), so the Secure cookie flag must be off
1717
# or httpx will not send the cookie back on subsequent requests.
1818
settings.cookie_secure = False
19-
from app.database import get_async_session
20-
from app.models import Base
21-
from app.models.user import User, UserRole
19+
from app.database import get_async_session # noqa: E402
20+
from app.models import Base # noqa: E402
21+
from app.models.user import User, UserRole # noqa: E402
2222

2323
# Suppress Prefect logging warnings during tests
2424
os.environ["PREFECT_LOGGING_TO_API_WHEN_MISSING_FLOW"] = "ignore"

backend/tests/test_api/test_health.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,17 @@ async def test_health_endpoint(client: AsyncClient):
77
response = await client.get("/health")
88
assert response.status_code == 200
99
assert response.json() == {"status": "ok"}
10+
11+
12+
@pytest.mark.asyncio
13+
async def test_swagger_ui(client: AsyncClient):
14+
response = await client.get("/swagger")
15+
assert response.status_code == 200
16+
assert "text/html" in response.headers["content-type"]
17+
18+
19+
@pytest.mark.asyncio
20+
async def test_redoc_ui(client: AsyncClient):
21+
response = await client.get("/redoc")
22+
assert response.status_code == 200
23+
assert "text/html" in response.headers["content-type"]

scripts/lint_backend.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
66
cd "$REPO_ROOT/backend"
77
unset VIRTUAL_ENV
88

9-
uv run ruff check --fix app
10-
uv run ruff format app
9+
uv run ruff check --fix .
10+
uv run ruff format .
1111
uv run ty check app

scripts/lint_frontend.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
55

66
cd "$REPO_ROOT/frontend"
77

8-
node_modules/.bin/prettier --write src
9-
node_modules/.bin/eslint src
8+
node_modules/.bin/prettier --write 'src/**/*.{ts,tsx}'
9+
node_modules/.bin/eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0
1010
node_modules/.bin/tsc --noEmit

0 commit comments

Comments
 (0)