Replace manually maintained types in src/lib/types.ts with auto-generated types from FastAPI's OpenAPI schema using @hey-api/openapi-ts. The bridge file re-exports generated types with renames, Require<> augmentations for fields that are optional in the schema but always present in responses, and manually added relationship fields excluded from OpenAPI. - Add openapi-ts.config.ts and generate:api npm script - Generate types into src/lib/api/generated/types.gen.ts - Rewrite src/lib/types.ts as bridge with re-exports and augmentations - Fix null vs undefined mismatches in consumer components - Remove unused manual type definitions from api.ts - Update AGENTS.md docs with type generation workflow
48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
import js from "@eslint/js";
|
|
import svelte from "eslint-plugin-svelte";
|
|
import ts from "typescript-eslint";
|
|
import globals from "globals";
|
|
|
|
export default [
|
|
{
|
|
ignores: [
|
|
".svelte-kit",
|
|
"node_modules",
|
|
"build",
|
|
"dist",
|
|
"**/paraglide/**",
|
|
"**/lib/paraglide/**",
|
|
"**/api/generated/**",
|
|
],
|
|
},
|
|
js.configs.recommended,
|
|
...ts.configs.recommended,
|
|
...svelte.configs["flat/recommended"],
|
|
{
|
|
languageOptions: {
|
|
ecmaVersion: "latest",
|
|
sourceType: "module",
|
|
globals: {
|
|
...globals.browser,
|
|
},
|
|
},
|
|
rules: {
|
|
"svelte/no-at-html-tags": "off",
|
|
"svelte/require-each-key": "off",
|
|
// TODO: Set ignoreGoto to false when https://github.com/sveltejs/eslint-plugin-svelte/issues/1327 is fixed
|
|
// The rule doesn't detect resolve() when used with string concatenation for query params
|
|
"svelte/no-navigation-without-resolve": [
|
|
"error",
|
|
{ ignoreLinks: true, ignoreGoto: true },
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ["**/*.svelte"],
|
|
languageOptions: {
|
|
parserOptions: {
|
|
parser: ts.parser,
|
|
},
|
|
},
|
|
},
|
|
];
|