Skip to content

Commit aea3861

Browse files
authored
Fix crash on unit selection (#87)
1 parent 401dcad commit aea3861

22 files changed

Lines changed: 1343 additions & 1017 deletions

.github/workflows/main_kooktime.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,26 @@ on:
1212
- main
1313

1414
jobs:
15+
lint:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: "Checkout Github Action"
20+
uses: actions/checkout@master
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: "22"
26+
cache: "npm"
27+
cache-dependency-path: src/CookTime/client-app/package-lock.json
28+
29+
- name: Install dependencies
30+
run: cd src/CookTime/client-app && npm ci
31+
32+
- name: Lint
33+
run: scripts/test --lint
34+
1535
test:
1636
runs-on: ubuntu-latest
1737
if: github.event_name == 'pull_request'

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## 2026-02-14
99

10+
### Fixed
11+
12+
- Fix crash when switching ingredient units caused by reading the event target inside a deferred React state updater
13+
1014
### Changed
1115

16+
- Add `ESLint` to CI/CD for frontend code
1217
- More prompt tuning
1318

1419
## 2026-02-13

scripts/test

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
#!/bin/bash
22
set -e
33

4+
SCRIPT_DIR="$(dirname "$0")"
5+
REPO_ROOT="$SCRIPT_DIR/.."
6+
7+
# --lint: run frontend linting only, then exit
8+
if [ "$1" = "--lint" ]; then
9+
echo "Running frontend lint..."
10+
cd "$REPO_ROOT/src/CookTime/client-app"
11+
npx eslint src/
12+
echo "Lint passed!"
13+
exit 0
14+
fi
15+
416
API_URL="${API_BASE_URL:-http://localhost:5001}"
517
MAX_WAIT=30
618

@@ -23,6 +35,6 @@ echo "API is healthy!"
2335

2436
echo ""
2537
echo "Running tests..."
26-
cd "$(dirname "$0")/../src/CookTimeTests"
38+
cd "$REPO_ROOT/src/CookTimeTests"
2739
dotnet build -v minimal
2840
dotnet test --verbosity normal --no-build --logger "trx;LogFileName=test-results.trx" -- RunConfiguration.DisableParallelization=true
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import js from "@eslint/js";
2+
import tseslint from "typescript-eslint";
3+
import reactHooks from "eslint-plugin-react-hooks";
4+
import reactRefresh from "eslint-plugin-react-refresh";
5+
6+
export default tseslint.config(
7+
{ ignores: ["build/**", "node_modules/**", ".react-router/**"] },
8+
js.configs.recommended,
9+
...tseslint.configs.recommended,
10+
{
11+
plugins: {
12+
"react-hooks": reactHooks,
13+
"react-refresh": reactRefresh,
14+
},
15+
rules: {
16+
...reactHooks.configs.recommended.rules,
17+
"react-refresh/only-export-components": [
18+
"warn",
19+
{ allowConstantExport: true },
20+
],
21+
// Relaxed for existing codebase — tighten over time
22+
"@typescript-eslint/no-explicit-any": "warn",
23+
"@typescript-eslint/no-unused-vars": [
24+
"warn",
25+
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
26+
],
27+
"@typescript-eslint/no-empty-object-type": "warn",
28+
"react-hooks/static-components": "warn",
29+
"react-hooks/set-state-in-effect": "warn",
30+
},
31+
}
32+
);

0 commit comments

Comments
 (0)