Fix: Configure ESLint for type-aware linting

This commit is contained in:
gpt-engineer-app[bot]
2025-10-29 23:20:52 +00:00
parent 3954a8f975
commit 017879ba21
2 changed files with 43 additions and 2 deletions

17
api/tsconfig.json Normal file
View File

@@ -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"]
}

View File

@@ -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,
}],
},
},
);