refactor: standardize code formatting and linting configuration

- Replace .eslintrc.js with .eslintrc.cjs for better ES module compatibility
- Add .prettierrc configuration for consistent code formatting
- Update package.json with new lint and format scripts
- Add nodemon.json for development hot reloading configuration
- Standardize code formatting across all JavaScript and Vue files
- Update web admin SPA with improved linting rules and formatting
- Add prettier configuration to web admin SPA

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
千羽
2025-08-07 18:19:31 +09:00
parent 4a0eba117c
commit 8a74bf5afe
124 changed files with 20878 additions and 18757 deletions

View File

@@ -1,8 +1,6 @@
// API 配置
import { APP_CONFIG, getLoginUrl } from './app'
const isDev = import.meta.env.DEV
// 开发环境使用 /webapi 前缀,生产环境不使用前缀
export const API_PREFIX = APP_CONFIG.apiPrefix
@@ -22,11 +20,11 @@ export function getRequestConfig(token) {
'Content-Type': 'application/json'
}
}
if (token) {
config.headers['Authorization'] = `Bearer ${token}`
}
return config
}
@@ -68,7 +66,7 @@ class ApiClient {
// 如果当前已经在登录页面,不要再次跳转
const currentPath = window.location.pathname + window.location.hash
const isLoginPage = currentPath.includes('/login') || currentPath.endsWith('/')
if (!isLoginPage) {
localStorage.removeItem('authToken')
// 使用统一的登录URL
@@ -81,12 +79,12 @@ class ApiClient {
const contentType = response.headers.get('content-type')
if (contentType && contentType.includes('application/json')) {
const data = await response.json()
// 如果响应不成功,抛出错误
if (!response.ok) {
throw new Error(data.message || `HTTP ${response.status}`)
}
return data
}
@@ -170,4 +168,4 @@ class ApiClient {
}
// 导出单例实例
export const apiClient = new ApiClient()
export const apiClient = new ApiClient()