From 017879ba2159543ad566a6b71ccf51242309cee3 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Wed, 29 Oct 2025 23:20:52 +0000 Subject: [PATCH] Fix: Configure ESLint for type-aware linting --- api/tsconfig.json | 17 +++++++++++++++++ eslint.config.js | 28 ++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 api/tsconfig.json diff --git a/api/tsconfig.json b/api/tsconfig.json new file mode 100644 index 00000000..47058661 --- /dev/null +++ b/api/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "node16", + "moduleResolution": "node16", + "lib": ["ES2022"], + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "noEmit": true, + "allowJs": true + }, + "include": ["**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/eslint.config.js b/eslint.config.js index db71a928..f6ccffc9 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -6,12 +6,17 @@ import tseslint from "typescript-eslint"; export default tseslint.config( { ignores: ["dist"] }, + // Frontend configuration with type-aware rules { - extends: [js.configs.recommended, ...tseslint.configs.recommended], - files: ["**/*.{ts,tsx}"], + extends: [js.configs.recommended, ...tseslint.configs.recommendedTypeChecked], + files: ["src/**/*.{ts,tsx}"], languageOptions: { ecmaVersion: 2020, globals: globals.browser, + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, }, plugins: { "react-hooks": reactHooks, @@ -35,4 +40,23 @@ export default tseslint.config( }], }, }, + // API configuration without type-aware rules for better performance + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ["api/**/*.ts"], + languageOptions: { + ecmaVersion: 2022, + globals: globals.node, + }, + rules: { + "@typescript-eslint/no-unused-vars": "error", + "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/explicit-function-return-type": ["error", { + allowExpressions: true, + allowTypedFunctionExpressions: true, + allowHigherOrderFunctions: true, + allowDirectConstAssertionInArrowFunctions: true, + }], + }, + }, );