ci: add ESLint flat config with astro + jsx-a11y
ci / build-and-test (push) Canceled after 0s

Pin eslint@9 (jsx-a11y peer) and add eslint-plugin-astro + eslint-plugin-jsx-a11y + typescript-eslint as devDeps.

eslint.config.js wires:
- @eslint/js recommended and typescript-eslint recommended for general .ts/.mjs.
- astro flat/jsx-a11y-recommended for .astro files, registering the jsx-a11y plugin explicitly.
- project-specific tweaks: drop jsx-a11y/anchor-is-valid (noisy on Astro links), warn on click-events-have-key-events and no-static-element-interactions, allow any in scripts/tests, ignore env.d.ts triple-slash ref (Astro convention).

Scripts: lint and lint:fix. prebuild now also runs lint, so the same chain guards a11y regressions as type and build errors.

CI workflow gains a lint step between check and build. 0 errors, 16/16 e2e still pass.
This commit is contained in:
2026-07-26 21:50:42 +02:00
parent e0b812b10d
commit 813246c211
4 changed files with 3495 additions and 3 deletions
+3
View File
@@ -42,6 +42,9 @@ jobs:
- name: Typecheck (astro check)
run: pnpm run check
- name: Lint
run: pnpm run lint
- name: Build
run: pnpm run build
+53
View File
@@ -0,0 +1,53 @@
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import astro from 'eslint-plugin-astro';
import jsxA11y from 'eslint-plugin-jsx-a11y';
export default [
{
ignores: ['dist/**', '.astro/**', 'node_modules/**', 'playwright-report/**', 'test-results/**', 'public/**'],
},
js.configs.recommended,
...tseslint.configs.recommended,
...astro.configs['flat/jsx-a11y-recommended'],
{
files: ['**/*.{ts,tsx,js,jsx,mjs}'],
languageOptions: {
ecmaVersion: 2024,
sourceType: 'module',
},
},
{
files: ['**/*.astro'],
plugins: {
astro,
'jsx-a11y': jsxA11y,
},
rules: {
...astro.configs.recommended.rules,
'jsx-a11y/anchor-is-valid': 'off',
'jsx-a11y/click-events-have-key-events': 'warn',
'jsx-a11y/no-static-element-interactions': 'warn',
},
},
{
files: ['scripts/**/*.{mjs,js}', 'tests/**/*.{ts,mts}'],
languageOptions: {
globals: {
console: 'readonly',
process: 'readonly',
Buffer: 'readonly',
URL: 'readonly',
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
files: ['src/env.d.ts'],
rules: {
'@typescript-eslint/triple-slash-reference': 'off',
},
},
];
+3430 -1
View File
File diff suppressed because it is too large Load Diff
+9 -2
View File
@@ -8,11 +8,13 @@
},
"scripts": {
"dev": "astro dev",
"prebuild": "node scripts/build-og-image.mjs && astro check",
"prebuild": "node scripts/build-og-image.mjs && astro check && eslint .",
"build": "astro build",
"preview": "astro preview",
"check": "astro check",
"check:watch": "astro check --watch",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"pretest:e2e": "astro check && astro build",
"test:e2e": "playwright test",
"test:e2e:install": "playwright install --with-deps chromium"
@@ -29,10 +31,15 @@
"devDependencies": {
"@astrojs/check": "^0.9.4",
"@axe-core/playwright": "^4.12.1",
"@eslint/js": "^10.0.1",
"@playwright/test": "^1.62.0",
"@types/leaflet": "^1.9.12",
"@types/pg": "^8.11.10",
"axe-core": "^4.12.1",
"typescript": "^5.6.3"
"eslint": "^9.39.5",
"eslint-plugin-astro": "^3.0.1",
"eslint-plugin-jsx-a11y": "^6.10.2",
"typescript": "^5.6.3",
"typescript-eslint": "^8.65.0"
}
}