Skip to content

Commit 5e1bbed

Browse files
authored
Merge pull request #737 from Nickatak/next-rewrite-deps-bump
Bump dependencies + replace lint stack
2 parents 60db51e + 52bc925 commit 5e1bbed

118 files changed

Lines changed: 4252 additions & 3542 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/jest-react-test.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Lint
2+
3+
# Backend (ruff + mypy + bandit) and frontend (eslint + stylelint + knip +
4+
# tsc + prettier) lint suites run as separate parallel jobs. Each fails the
5+
# build on errors so pull requests cannot merge with a broken lint state.
6+
#
7+
# Pre-commit hooks (.pre-commit-config.yaml) run the same tools locally for
8+
# fast feedback; this workflow is the authoritative gate.
9+
10+
on:
11+
push:
12+
branches-ignore: [master, main]
13+
pull_request:
14+
branches: [master, main]
15+
workflow_dispatch:
16+
17+
jobs:
18+
backend:
19+
name: Backend lint (ruff + mypy + bandit)
20+
runs-on: ubuntu-latest
21+
defaults:
22+
run:
23+
working-directory: backend
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Setup Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.13"
31+
32+
- name: Install Poetry
33+
run: pipx install poetry
34+
35+
- name: Install dependencies
36+
run: poetry install --no-interaction --no-ansi --no-root
37+
38+
- name: ruff check
39+
run: poetry run ruff check .
40+
41+
- name: ruff format --check
42+
run: poetry run ruff format --check .
43+
44+
- name: mypy
45+
# `backend.settings` reads required env vars via python-decouple at
46+
# import time. The django-stubs mypy plugin imports settings to walk
47+
# the model graph, so it needs values present even though no real
48+
# I/O happens. Dummy values are fine; they're never used.
49+
env:
50+
SECRET_KEY: lint-only-not-real
51+
DJANGO_ALLOWED_HOSTS: localhost
52+
SQL_ENGINE: django.db.backends.postgresql
53+
SQL_DATABASE: lint
54+
SQL_USER: lint
55+
SQL_PASSWORD: lint
56+
SQL_HOST: localhost
57+
SQL_PORT: "5432"
58+
run: poetry run mypy ctj_api backend
59+
60+
- name: bandit
61+
run: poetry run bandit -r ctj_api backend -c pyproject.toml -q
62+
63+
frontend:
64+
name: Frontend lint (eslint + stylelint + knip + tsc + prettier)
65+
runs-on: ubuntu-latest
66+
defaults:
67+
run:
68+
working-directory: frontend
69+
steps:
70+
- uses: actions/checkout@v4
71+
72+
- name: Setup Node
73+
uses: actions/setup-node@v4
74+
with:
75+
node-version: "24"
76+
cache: npm
77+
cache-dependency-path: frontend/package-lock.json
78+
79+
- name: Install dependencies
80+
run: npm ci
81+
82+
- name: prettier --check
83+
run: npm run format:check
84+
85+
- name: eslint
86+
run: npm run lint
87+
88+
- name: stylelint
89+
run: npm run lint:css
90+
91+
- name: tsc --noEmit
92+
run: npm run lint:types
93+
94+
- name: knip
95+
run: npm run lint:dead

.github/workflows/linter.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

.github/workflows/vitest-test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Vitest
2+
3+
on:
4+
push:
5+
branches-ignore: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
jobs:
10+
test:
11+
name: Vitest
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
working-directory: frontend
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "24"
23+
cache: npm
24+
cache-dependency-path: frontend/package-lock.json
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run tests
30+
run: npm test

.pre-commit-config.yaml

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,66 @@
1+
# Pre-commit hooks for fast local feedback. CI is the authoritative gate
2+
# (see .github/workflows/lint.yml); these hooks run the same tools so issues
3+
# surface at commit time instead of on PR.
4+
#
5+
# Setup (one-time, on the host):
6+
# pip install pre-commit
7+
# pre-commit install
8+
#
9+
# After that, every `git commit` runs the hooks below against staged files.
10+
# To run all hooks against the entire tree manually: `pre-commit run -a`.
11+
112
default_language_version:
2-
# default language version for each language used in the repository
3-
python: python3.9
13+
python: python3.13
14+
node: "24"
15+
416
repos:
17+
# File-shape hygiene. These are pre-commit's own hooks, applied to every
18+
# text file regardless of language.
519
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v4.2.0
20+
rev: v6.0.0
721
hooks:
8-
# See https://pre-commit.com/hooks.html for more hooks
9-
- id: check-ast
10-
- id: check-case-conflict
11-
- id: check-executables-have-shebangs
1222
- id: check-merge-conflict
13-
- id: debug-statements
23+
- id: check-yaml
24+
exclude: ^\.github/
25+
- id: check-toml
26+
- id: check-json
1427
- id: end-of-file-fixer
15-
- id: name-tests-test
16-
args: ["--django"]
1728
- id: trailing-whitespace
18-
- repo: https://github.com/pycqa/isort
19-
rev: 5.12.0
29+
- id: mixed-line-ending
30+
args: [--fix=lf]
31+
32+
# Backend: ruff replaces black + flake8 + isort. Two separate hooks so the
33+
# check (lint) and format passes show as distinct commit-blockers.
34+
- repo: https://github.com/astral-sh/ruff-pre-commit
35+
rev: v0.15.12
2036
hooks:
21-
- id: isort
22-
args: ["--settings-file", "app/setup.cfg"]
23-
- repo: https://github.com/psf/black
24-
rev: 22.12.0
37+
- id: ruff-check
38+
args: [--fix]
39+
files: ^backend/.*\.py$
40+
- id: ruff-format
41+
files: ^backend/.*\.py$
42+
43+
# Frontend: prettier handles formatting (TS/TSX/JS/JSON/CSS).
44+
- repo: https://github.com/rbubley/mirrors-prettier
45+
rev: v3.8.3
2546
hooks:
26-
- id: black
27-
args: []
28-
- repo: https://github.com/PyCQA/flake8
29-
rev: 6.0.0
47+
- id: prettier
48+
files: ^frontend/.*\.(ts|tsx|js|jsx|json|css)$
49+
50+
# Frontend: eslint and stylelint use local hooks so they pick up the
51+
# project's installed versions (not a frozen pre-commit mirror that would
52+
# drift from package.json).
53+
- repo: local
3054
hooks:
31-
- id: flake8
32-
args: ["--config", "app/setup.cfg"]
33-
additional_dependencies:
34-
[
35-
"flake8-bugbear",
36-
"flake8-comprehensions",
37-
"flake8-mutable",
38-
"flake8-print",
39-
"flake8-simplify",
40-
]
41-
- repo: https://github.com/pycqa/pylint
42-
rev: "v2.15.10"
43-
hooks:
44-
- id: pylint
45-
exclude: "[a-zA-Z]*/(migrations)/(.)*|(mkdocs)/(.)*"
46-
args:
47-
[
48-
"--load-plugins=pylint_django",
49-
"--disable=C0114,C0115,C0116",
50-
"--django-settings-module=config.settings",
51-
"--rcfile=app/setup.cfg",
52-
]
53-
additional_dependencies: [django, djangorestframework, pylint_django]
54-
- repo: https://github.com/pre-commit/mirrors-prettier
55-
rev: "v2.7.1"
56-
hooks:
57-
- id: prettier
55+
- id: eslint
56+
name: eslint
57+
language: node
58+
entry: bash -c 'cd frontend && npx eslint .'
59+
files: ^frontend/.*\.(ts|tsx|js|jsx|mjs)$
60+
pass_filenames: false
61+
- id: stylelint
62+
name: stylelint
63+
language: node
64+
entry: bash -c 'cd frontend && npx stylelint "src/**/*.{css,module.css}"'
65+
files: ^frontend/src/.*\.(css|module\.css)$
66+
pass_filenames: false

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ Filing the issue first (before writing code) lets feedback shape scope before im
2929

3030
Frontend styling uses **CSS Modules**: co-locate a `Component.module.css` next to each component's `.tsx` file. No Tailwind, no styled-components, no CSS-in-JS runtime. See the [design system guide](docs/developer/design-system.md) for the full conventions.
3131

32+
### Type annotations (backend)
33+
34+
The Python codebase has `mypy` running in **gradual mode**`disallow_untyped_defs` is `false`, so missing annotations don't fail CI. The intent is to ratchet stricter over time, not to demand annotations on every change. Concretely:
35+
36+
- **New code**: add type annotations to function signatures (parameters and return types). Inside function bodies, only annotate where the type is non-obvious or the inference is wrong.
37+
- **Existing code you touch**: if you're already editing a function for another reason, adding annotations is welcome but not required.
38+
- **Don't annotate just to silence mypy.** If a type is genuinely ambiguous (`Any` is fine, `# type: ignore[code]` with the specific code is fine when you know why), say so explicitly rather than papering over it.
39+
- **Django models**: `django-stubs` and `djangorestframework-stubs` are installed; mypy can check ORM call sites without per-call annotation.
40+
41+
The goal is that contributors can land work without fighting the type checker, while the typed surface grows incrementally where it pays for itself.
42+
3243
If an issue takes much longer than its size suggested, post an update on the issue with an honest read on whether you can finish; releasing it back to the backlog is fine.
3344

3445
### Frontend vs backend issues

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Developer docs live in [docs/developer/](docs/developer/):
4949
- [DevOps Architecture](docs/developer/devops.md)
5050
- [Deployment & Infrastructure](docs/developer/deployment-infra.md)
5151
- [Design System](docs/developer/design-system.md)
52-
- [ESLint Guide](docs/developer/eslint-guide.md)
52+
- [Frontend Lint Guide](docs/developer/frontend-lint-guide.md)
5353
- [Git Branch Structure](docs/developer/git-branch-structure.md)
5454
- [Installation](docs/developer/installation.md)
5555
- [Quickstart Guide](docs/developer/quickstart-guide.md)

backend/.flake8

Lines changed: 0 additions & 9 deletions
This file was deleted.

backend/backend/settings.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@
115115

116116
AUTH_PASSWORD_VALIDATORS = [
117117
{
118-
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
118+
"NAME": (
119+
"django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
120+
),
119121
},
120122
{
121123
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",

0 commit comments

Comments
 (0)