style(app): apply eslint --fix to Tier 2 (TypeScript plumbing)

WS-3 session 1b-i Tier 2.

Scope: composables, lib, stores, plugins, types, utils, navigation,
main.ts. Mechanical fixes only — predominantly newline-before-return,
arrow-parens, antfu/if-newline, padding-line-between-statements, plus
one unicorn/prefer-includes (.some(p => x === p) → .includes(x))
in router guards.

Excludes (per session prompt):
- apps/app/vite.config.ts (Tier 3)
- apps/app/themeConfig.ts (Tier 3)
- apps/app/vitest.config.ts (Tier 3)
- All .vue files (already in Tier 1)

Hand-reviewed diffs for the three auth/router-critical files before
committing:
- src/lib/axios.ts: reviewed clean. Pure mechanical (quote-props on
  Accept header, curly-strip on single-statement ifs, one blank line
  before impersonationStore.clearState()). No type-import changes,
  no logic touched.
- src/stores/useAuthStore.ts: reviewed clean. curly-strip + padding
  before returns. The initialize()/doInitialize() race-condition guard
  on isInitialized is preserved verbatim.
- src/plugins/1.router/guards.ts: reviewed clean. if-newline reformat
  + one .some() → .includes() rewrite that's behaviorally identical
  for primitive equality on the guestOnlyPaths string array.

Tests + typecheck verified green post-fix:
- apps/app vitest: 49 passed (unchanged)
- apps/app vue-tsc: clean (unchanged)

Lint baseline progression:
- Pre-Tier-2: 422 problems (post-Tier-1)
- Post-Tier-2: 246 problems

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-29 11:06:46 +02:00
parent 47bd533179
commit a7eaf0f948
28 changed files with 189 additions and 97 deletions

View File

@@ -1,7 +1,7 @@
import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
import { apiClient } from '@/lib/axios'
import type { AdminUser, ImpersonationSession, ImpersonationStartResponse, ImpersonationStatusResponse, StartImpersonationPayload } from '@/types/admin'
import type { AdminUser, ImpersonationStartResponse, ImpersonationStatusResponse, StartImpersonationPayload } from '@/types/admin'
const SESSION_STORAGE_KEY = 'crewli_impersonation'
const BROADCAST_CHANNEL_NAME = 'crewli_impersonation_sync'
@@ -27,12 +27,11 @@ export const useImpersonationStore = defineStore('impersonation', () => {
const expiresAt = computed(() => state.value?.expiresAt ? new Date(state.value.expiresAt) : null)
function persistState(): void {
if (state.value) {
if (state.value)
sessionStorage.setItem(SESSION_STORAGE_KEY, JSON.stringify(state.value))
}
else {
else
sessionStorage.removeItem(SESSION_STORAGE_KEY)
}
}
async function start(
@@ -69,12 +68,12 @@ export const useImpersonationStore = defineStore('impersonation', () => {
// Call stop WITHOUT the X-Impersonate-User header
// The interceptor won't add it because we clear state first
const currentState = state.value
state.value = null
persistState()
if (currentState) {
if (currentState)
await apiClient.post('/admin/stop-impersonation')
}
}
catch {
// Even if API call fails, state is already cleared
@@ -130,7 +129,8 @@ export const useImpersonationStore = defineStore('impersonation', () => {
}
function listenForBroadcasts(): void {
if (broadcastChannel) return
if (broadcastChannel)
return
try {
broadcastChannel = new BroadcastChannel(BROADCAST_CHANNEL_NAME)