mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
Improve linter configuration with stricter rules and pragmatic overrides
- Enhanced eslint config with explicit unsafe-any rules - Added relaxed rules for stub directories (DBAL, hooks, GitHub) - Improved tsconfig with additional strict compiler options - Fixed auth API functions to maintain async for proper testing - Fixed DBAL get function async and conditionals - Progress: 689 → 686 linting problems (497 errors, 189 warnings) - TypeScript compilation: All errors resolved Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -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',
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import type { User } from '@/lib/types/level-types'
|
||||
|
||||
export function fetchSession(): User | null {
|
||||
export async function fetchSession(): Promise<User | null> {
|
||||
// TODO: Implement session fetching
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -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<User> {
|
||||
// TODO: Implement login
|
||||
// For now, throw an error to indicate not implemented
|
||||
throw new Error('Login not implemented')
|
||||
|
||||
@@ -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<User> {
|
||||
// TODO: Implement registration
|
||||
throw new Error('Registration not implemented')
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ interface StoreContext {
|
||||
store: Map<string, { value: JsonValue; expiry?: number }>
|
||||
}
|
||||
|
||||
export async function get(this: StoreContext, key: string, context: TenantContext): Promise<JsonValue | null> {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user