diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs index 3a5f004..1a2257d 100755 --- a/frontend/eslint.config.mjs +++ b/frontend/eslint.config.mjs @@ -1,27 +1,28 @@ -import { dirname } from "path"; -import { fileURLToPath } from "url"; -import { FlatCompat } from "@eslint/eslintrc"; +import { FlatCompat } from '@eslint/eslintrc'; +import path from 'path'; +import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +const __dirname = path.dirname(__filename); const compat = new FlatCompat({ baseDirectory: __dirname, }); -const eslintConfig = [ - ...compat.extends("next/core-web-vitals", "next/typescript"), +export default [ + ...compat.extends('next/core-web-vitals'), + ...compat.extends('next/typescript'), { ignores: [ - "**/node_modules/**", - "**/.next/**", - "**/out/**", - "**/build/**", - "**/dist/**", - "**/coverage/**", - "**/src/lib/api/generated/**", - "**/*.gen.ts", - "**/*.gen.tsx", + 'node_modules/**', + '.next/**', + 'out/**', + 'build/**', + 'dist/**', + 'coverage/**', + 'src/lib/api/generated/**', + '*.gen.ts', + '*.gen.tsx', ], }, { @@ -30,15 +31,19 @@ const eslintConfig = [ // Components/hooks must use useAuth() from AuthContext, not useAuthStore directly // This ensures testability via DI (E2E mocks, unit test props) // Exception: Non-React contexts (client.ts) use dynamic import + __TEST_AUTH_STORE__ check - "no-restricted-imports": ["error", { - "patterns": [{ - "group": ["**/stores/authStore"], - "importNames": ["useAuthStore"], - "message": "Import useAuth from '@/lib/auth/AuthContext' instead. Direct authStore imports bypass dependency injection and break test mocking." - }] - }] - } - } + 'no-restricted-imports': [ + 'error', + { + patterns: [ + { + group: ['**/stores/authStore'], + importNames: ['useAuthStore'], + message: + "Import useAuth from '@/lib/auth/AuthContext' instead. Direct authStore imports bypass dependency injection and break test mocking.", + }, + ], + }, + ], + }, + }, ]; - -export default eslintConfig; diff --git a/frontend/package.json b/frontend/package.json index 054b6bf..5d70606 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -6,8 +6,8 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint", - "lint:fix": "next lint --fix", + "lint": "eslint .", + "lint:fix": "eslint --fix .", "lint:tests": "eslint tests --max-warnings=0", "type-check": "tsc --noEmit", "format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,css,md}\"", @@ -61,7 +61,6 @@ "zustand": "^4.5.7" }, "devDependencies": { - "@eslint/eslintrc": "^3", "@hey-api/openapi-ts": "^0.86.11", "@next/bundle-analyzer": "^16.0.1", "@peculiar/webcrypto": "^1.5.0",