From 71330aa47d0e99b6094df87cf10bace0f11648e6 Mon Sep 17 00:00:00 2001 From: tschumpr Date: Tue, 17 Dec 2024 09:07:37 +0100 Subject: [PATCH] Add typescript to linter --- src/Geopilot.Frontend/package.json | 4 +-- .../src/auth/apiAuthConfigurationContext.tsx | 1 + src/Geopilot.Frontend/tsconfig.json | 35 ++++++++----------- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/Geopilot.Frontend/package.json b/src/Geopilot.Frontend/package.json index 714b466d..01e0a6d5 100644 --- a/src/Geopilot.Frontend/package.json +++ b/src/Geopilot.Frontend/package.json @@ -6,8 +6,8 @@ "scripts": { "dev": "vite", "build": "vite build", - "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", - "lint:fix": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0 --fix", + "lint": "eslint . --ext js,jsx,ts,tsx,json --report-unused-disable-directives --max-warnings 0", + "lint:fix": "eslint . --ext js,jsx,ts,tsx,json --report-unused-disable-directives --max-warnings 0 --fix", "preview": "vite preview", "predev": "node aspnetcore-https.js", "test": "cypress run", diff --git a/src/Geopilot.Frontend/src/auth/apiAuthConfigurationContext.tsx b/src/Geopilot.Frontend/src/auth/apiAuthConfigurationContext.tsx index 25c6a92e..dcd93367 100644 --- a/src/Geopilot.Frontend/src/auth/apiAuthConfigurationContext.tsx +++ b/src/Geopilot.Frontend/src/auth/apiAuthConfigurationContext.tsx @@ -8,6 +8,7 @@ export const ApiAuthConfigurationProvider: FC = ({ children } const [apiAuthSettings, setApiAuthSettings] = useState(); const { fetchApi } = useApi(); + // eslint-disable-next-line react-hooks/exhaustive-deps const loadAuthSettings = () => { fetchApi("/api/v1/user/auth").then(setApiAuthSettings); }; diff --git a/src/Geopilot.Frontend/tsconfig.json b/src/Geopilot.Frontend/tsconfig.json index cecfa1bb..38a24f32 100644 --- a/src/Geopilot.Frontend/tsconfig.json +++ b/src/Geopilot.Frontend/tsconfig.json @@ -1,26 +1,19 @@ { "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ - "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, - "lib": [ - "dom", - "dom.iterable", - "esnext" - ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, - "jsx": "react-jsx" /* Specify what JSX code is generated. */, - "module": "ESNext" /* Specify what module code is generated. */, - "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */, - "types": [ - "vite/client", - ] /* Specify type package names to be included without being referenced in a source file. */, - "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ - "allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */, - "noEmit": true /* Disable emitting files from a compilation. */, - "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */, - "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, - "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, - "strict": true /* Enable all strict type-checking options. */, - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "target": "ESNext", + "lib": ["dom", "dom.iterable", "esnext"], + "jsx": "react-jsx", + "module": "ESNext", + "moduleResolution": "node", + "types": ["vite/client"], + "allowImportingTsExtensions": true, + "allowJs": true, + "noEmit": true, + "isolatedModules": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true }, "exclude": ["src/Geopilot.Frontend/cypress"] }