Skip to content

Commit 5235468

Browse files
committed
chore: add ruff, mypy, ESLint, and astro check quality tooling
- backend: add ruff>=0.4 and mypy>=1.10 to dev optional-dependencies with ruff config (E/W/F/I/UP/B rules, py311 target, 120 char line) and mypy config (ignore_missing_imports, check_untyped_defs) - frontend: add eslint, typescript-eslint, eslint-plugin-astro as devDependencies; add 'check' (astro check) and 'lint' scripts scoped to PR #14 files only ([id]/index.astro, [id]/print.astro, src/lib/label-template.ts) - frontend: create eslint.config.mjs with flat config for TS + Astro - fix: replace @ts-ignore with @ts-expect-error in [id]/index.astro (QRCode UMD global) as required by @typescript-eslint/ban-ts-comment
1 parent cc7e42b commit 5235468

5 files changed

Lines changed: 1841 additions & 87 deletions

File tree

backend/pyproject.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ dependencies = [
2929
dev = [
3030
"pytest>=7.4.0",
3131
"pytest-asyncio>=0.23.0",
32+
"ruff>=0.4.0",
33+
"mypy>=1.10.0",
3234
]
3335

3436
[build-system]
@@ -37,3 +39,23 @@ build-backend = "hatchling.build"
3739

3840
[tool.hatch.build.targets.wheel]
3941
packages = ["app"]
42+
43+
[tool.ruff]
44+
target-version = "py311"
45+
line-length = 120
46+
47+
[tool.ruff.lint]
48+
select = ["E", "W", "F", "I", "UP", "B"]
49+
ignore = [
50+
"B008", # function calls in default args (FastAPI Depends pattern)
51+
"E501", # line too long
52+
]
53+
per-file-ignores = { "tests/**/*.py" = ["B"] }
54+
55+
[tool.ruff.lint.isort]
56+
known-first-party = ["app"]
57+
58+
[tool.mypy]
59+
python_version = "3.11"
60+
ignore_missing_imports = true
61+
check_untyped_defs = true

frontend/eslint.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import tseslint from 'typescript-eslint';
2+
import eslintPluginAstro from 'eslint-plugin-astro';
3+
4+
export default tseslint.config(
5+
...tseslint.configs.recommended,
6+
...eslintPluginAstro.configs['flat/recommended'],
7+
{
8+
rules: {
9+
'@typescript-eslint/no-explicit-any': 'warn',
10+
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
11+
},
12+
},
13+
{
14+
ignores: ['dist/', '.astro/'],
15+
},
16+
);

0 commit comments

Comments
 (0)