feat: add ESLint and Prettier with pre-commit hook

- Install ESLint 9 with TypeScript and React support
- Install Prettier with custom configuration (no semicolons)
- Add husky and lint-staged for pre-commit hooks
- Configure lint-staged to auto-fix and format on commit
- Relax ESLint rules to avoid large-scale code changes
- Format all existing code with Prettier (no semicolons)

Co-Authored-By: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
Ember
2025-11-05 11:30:27 +08:00
parent c276eba151
commit 4978f9e8b8
44 changed files with 9619 additions and 3482 deletions

View File

@@ -1,28 +1,26 @@
export interface SystemConfig {
admin_mode: boolean;
beta_mode: boolean;
admin_mode: boolean
beta_mode: boolean
}
let configPromise: Promise<SystemConfig> | null = null;
let cachedConfig: SystemConfig | null = null;
let configPromise: Promise<SystemConfig> | null = null
let cachedConfig: SystemConfig | null = null
export function getSystemConfig(): Promise<SystemConfig> {
if (cachedConfig) {
return Promise.resolve(cachedConfig);
return Promise.resolve(cachedConfig)
}
if (configPromise) {
return configPromise;
return configPromise
}
configPromise = fetch('/api/config')
.then((res) => res.json())
.then((data: SystemConfig) => {
cachedConfig = data;
return data;
cachedConfig = data
return data
})
.finally(() => {
// Keep cachedConfig for reuse; allow re-fetch via explicit invalidation if added later
});
return configPromise;
})
return configPromise
}