diff --git a/frontends/nextjs/eslint.config.js b/frontends/nextjs/eslint.config.js index 1a0b85c52..27df08d23 100644 --- a/frontends/nextjs/eslint.config.js +++ b/frontends/nextjs/eslint.config.js @@ -40,10 +40,30 @@ export default tseslint.config( '@typescript-eslint/prefer-nullish-coalescing': 'warn', '@typescript-eslint/prefer-optional-chain': 'warn', '@typescript-eslint/no-non-null-assertion': 'error', + '@typescript-eslint/require-await': 'error', + '@typescript-eslint/no-unsafe-assignment': 'error', + '@typescript-eslint/no-unsafe-member-access': 'error', + '@typescript-eslint/no-unsafe-call': 'error', + '@typescript-eslint/no-unsafe-return': 'error', 'no-console': ['warn', { allow: ['warn', 'error'] }], 'no-debugger': 'error', 'prefer-const': 'error', 'no-var': 'error', }, }, + // Relaxed rules for stub/integration files that are placeholders + { + files: [ + 'src/lib/dbal/core/client/dbal-integration/**/*.ts', + 'src/lib/**/functions/**/*.ts', + 'src/hooks/**/*.ts', + 'src/lib/github/**/*.ts', + ], + rules: { + '@typescript-eslint/no-unsafe-assignment': 'warn', + '@typescript-eslint/no-unsafe-member-access': 'warn', + '@typescript-eslint/no-unsafe-call': 'warn', + '@typescript-eslint/no-unsafe-return': 'warn', + }, + }, ) diff --git a/frontends/nextjs/src/lib/auth/api/fetch-session.ts b/frontends/nextjs/src/lib/auth/api/fetch-session.ts index 2994086d5..fea030d20 100644 --- a/frontends/nextjs/src/lib/auth/api/fetch-session.ts +++ b/frontends/nextjs/src/lib/auth/api/fetch-session.ts @@ -4,7 +4,7 @@ import type { User } from '@/lib/types/level-types' -export function fetchSession(): User | null { +export async function fetchSession(): Promise { // TODO: Implement session fetching return null } diff --git a/frontends/nextjs/src/lib/auth/api/login.ts b/frontends/nextjs/src/lib/auth/api/login.ts index 25e8d635e..2e71b5fa2 100644 --- a/frontends/nextjs/src/lib/auth/api/login.ts +++ b/frontends/nextjs/src/lib/auth/api/login.ts @@ -9,7 +9,7 @@ export interface LoginCredentials { password: string } -export function login(_identifier: string, _password: string): never { +export async function login(_identifier: string, _password: string): Promise { // TODO: Implement login // For now, throw an error to indicate not implemented throw new Error('Login not implemented') diff --git a/frontends/nextjs/src/lib/auth/api/register.ts b/frontends/nextjs/src/lib/auth/api/register.ts index 143124e69..f32398614 100644 --- a/frontends/nextjs/src/lib/auth/api/register.ts +++ b/frontends/nextjs/src/lib/auth/api/register.ts @@ -10,7 +10,7 @@ export interface RegisterData { password: string } -export function register(_username: string, _email: string, _password: string): never { +export async function register(_username: string, _email: string, _password: string): Promise { // TODO: Implement registration throw new Error('Registration not implemented') } diff --git a/frontends/nextjs/src/lib/dbal/core/client/dbal-integration/functions/get.ts b/frontends/nextjs/src/lib/dbal/core/client/dbal-integration/functions/get.ts index fd5a5f84b..ae32b0a67 100644 --- a/frontends/nextjs/src/lib/dbal/core/client/dbal-integration/functions/get.ts +++ b/frontends/nextjs/src/lib/dbal/core/client/dbal-integration/functions/get.ts @@ -7,11 +7,11 @@ interface StoreContext { store: Map } -export async function get(this: StoreContext, key: string, context: TenantContext): Promise { +export function get(this: StoreContext, key: string, context: TenantContext): JsonValue | null { const fullKey = this.getKey(key, context) const item = this.store.get(fullKey) - if (!item) return null - if (item.expiry && Date.now() > item.expiry) { + if (item === null || item === undefined) return null + if (item.expiry !== undefined && Date.now() > item.expiry) { this.store.delete(fullKey) return null } diff --git a/frontends/nextjs/tsconfig.json b/frontends/nextjs/tsconfig.json index 6d66d02d2..b7baf2160 100644 --- a/frontends/nextjs/tsconfig.json +++ b/frontends/nextjs/tsconfig.json @@ -14,8 +14,11 @@ "strictNullChecks": true, "strictFunctionTypes": true, "strictBindCallApply": true, + "strictPropertyInitialization": true, + "noImplicitThis": true, "noUncheckedIndexedAccess": true, "noImplicitReturns": true, + "noImplicitOverride": true, "moduleResolution": "bundler", "allowImportingTsExtensions": true, "isolatedModules": true,