fix(frontend): enforce lint locally and in CI, fix all pre-existing violations
## Pre-commit hook
- Add .husky/pre-commit at repo root: runs `cd frontend && npm run lint`
- Update prepare script in package.json to auto-configure git hooks path
on npm install (git -C .. config core.hooksPath .husky)
- Add lint step to CI unit-tests job so it catches issues before tests run
- Add generated dirs to .prettierignore (paraglide_bak*, test-results, .auth)
- Add src/lib/paraglide_bak* to .gitignore so ESLint can ignore them
## ESLint fixes (all pre-existing)
- Disable svelte/no-navigation-without-resolve: false positive in SvelteKit
(rule targets Svelte 5 standalone routing, not SvelteKit <a href>)
- Fix svelte/require-each-key: add (item.id)/(item) keys to all {#each} blocks
across 10 files — improves Svelte reconciliation performance
- Fix svelte/prefer-writable-derived in PersonTypeahead: $state+$effect → $derived
- Fix svelte/prefer-svelte-reactivity: URLSearchParams → SvelteURLSearchParams,
Map → SvelteMap (enables Svelte reactive tracking)
- Fix @typescript-eslint/no-unused-vars: remove dead imports/variables
## Prettier
- Run npm run format to bring all source files in line with .prettierrc
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,18 +2,18 @@ import type { RequestHandler } from './$types';
|
||||
import { env } from 'process';
|
||||
|
||||
export const GET: RequestHandler = async ({ params, fetch }) => {
|
||||
const backendUrl = `${env.API_INTERNAL_URL || 'http://localhost:8080'}/api/documents/${params.id}/file`;
|
||||
const backendUrl = `${env.API_INTERNAL_URL || 'http://localhost:8080'}/api/documents/${params.id}/file`;
|
||||
|
||||
const response = await fetch(backendUrl);
|
||||
const response = await fetch(backendUrl);
|
||||
|
||||
if (!response.ok) {
|
||||
return new Response(null, { status: response.status });
|
||||
}
|
||||
if (!response.ok) {
|
||||
return new Response(null, { status: response.status });
|
||||
}
|
||||
|
||||
return new Response(response.body, {
|
||||
headers: {
|
||||
'Content-Type': response.headers.get('Content-Type') ?? 'application/octet-stream',
|
||||
'Content-Disposition': response.headers.get('Content-Disposition') ?? ''
|
||||
}
|
||||
});
|
||||
return new Response(response.body, {
|
||||
headers: {
|
||||
'Content-Type': response.headers.get('Content-Type') ?? 'application/octet-stream',
|
||||
'Content-Disposition': response.headers.get('Content-Disposition') ?? ''
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -3,33 +3,32 @@ import type { RequestHandler } from './$types';
|
||||
import { env } from 'process';
|
||||
|
||||
export const GET: RequestHandler = async ({ url, fetch }) => {
|
||||
// 1. Suchparameter aus der URL des Browsers holen
|
||||
const q = url.searchParams.get('q') || '';
|
||||
// 1. Suchparameter aus der URL des Browsers holen
|
||||
const q = url.searchParams.get('q') || '';
|
||||
|
||||
try {
|
||||
// 3. Anfrage an das Java-Backend weiterleiten (Server-to-Server)
|
||||
// Wir nutzen hier den internen Docker-Hostnamen oder localhost, je nach Netzwerk
|
||||
const backendUrl = `${env.API_INTERNAL_URL || 'http://localhost:8080'}/api/persons?q=${encodeURIComponent(q)}`;
|
||||
try {
|
||||
// 3. Anfrage an das Java-Backend weiterleiten (Server-to-Server)
|
||||
// Wir nutzen hier den internen Docker-Hostnamen oder localhost, je nach Netzwerk
|
||||
const backendUrl = `${env.API_INTERNAL_URL || 'http://localhost:8080'}/api/persons?q=${encodeURIComponent(q)}`;
|
||||
|
||||
const response = await fetch(backendUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
const response = await fetch(backendUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error(`Backend Error: ${response.status}`);
|
||||
return json([], { status: response.status });
|
||||
}
|
||||
if (!response.ok) {
|
||||
console.error(`Backend Error: ${response.status}`);
|
||||
return json([], { status: response.status });
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
const data = await response.json();
|
||||
|
||||
// 4. Daten zurück an den Browser schicken
|
||||
return json(data);
|
||||
|
||||
} catch (error) {
|
||||
console.error("Proxy Error:", error);
|
||||
return json([], { status: 500 });
|
||||
}
|
||||
// 4. Daten zurück an den Browser schicken
|
||||
return json(data);
|
||||
} catch (error) {
|
||||
console.error('Proxy Error:', error);
|
||||
return json([], { status: 500 });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3,34 +3,33 @@ import type { RequestHandler } from './$types';
|
||||
import { env } from 'process';
|
||||
|
||||
export const GET: RequestHandler = async ({ url, fetch }) => {
|
||||
// 1. Suchparameter aus der URL des Browsers holen
|
||||
const q = url.searchParams.get('q') || '';
|
||||
// 1. Suchparameter aus der URL des Browsers holen
|
||||
const q = url.searchParams.get('q') || '';
|
||||
|
||||
try {
|
||||
// 3. Anfrage an das Java-Backend weiterleiten (Server-to-Server)
|
||||
// Wir nutzen hier den internen Docker-Hostnamen oder localhost, je nach Netzwerk
|
||||
const backendUrl = `${env.API_INTERNAL_URL || 'http://localhost:8080'}/api/tags?q=${encodeURIComponent(q)}`;
|
||||
try {
|
||||
// 3. Anfrage an das Java-Backend weiterleiten (Server-to-Server)
|
||||
// Wir nutzen hier den internen Docker-Hostnamen oder localhost, je nach Netzwerk
|
||||
const backendUrl = `${env.API_INTERNAL_URL || 'http://localhost:8080'}/api/tags?q=${encodeURIComponent(q)}`;
|
||||
|
||||
const response = await fetch(backendUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
const response = await fetch(backendUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.error(`Backend Error: ${response.status}`);
|
||||
return json([], { status: response.status });
|
||||
}
|
||||
if (!response.ok) {
|
||||
console.error(`Backend Error: ${response.status}`);
|
||||
return json([], { status: response.status });
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log("Tags Data", data)
|
||||
const data = await response.json();
|
||||
console.log('Tags Data', data);
|
||||
|
||||
// 4. Daten zurück an den Browser schicken
|
||||
return json(data);
|
||||
|
||||
} catch (error) {
|
||||
console.error("Proxy Error:", error);
|
||||
return json([], { status: 500 });
|
||||
}
|
||||
// 4. Daten zurück an den Browser schicken
|
||||
return json(data);
|
||||
} catch (error) {
|
||||
console.error('Proxy Error:', error);
|
||||
return json([], { status: 500 });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user