refactor: migrate to eslint flat config and format codebase with prettier

- Remove legacy .eslintrc.cjs and .eslintignore
- Add eslint.config.js with flat config, security rules (no-eval, no-implied-eval, no-new-func, no-script-url)
- Add .prettierrc and .prettierignore
- Format entire codebase with prettier
This commit is contained in:
c0mrade
2026-01-27 17:37:31 +03:00
parent 111ccc4e7a
commit bc90ba3779
133 changed files with 19972 additions and 15523 deletions

View File

@@ -1,22 +1,24 @@
// Format setting key from Snake_Case / CamelCase to readable text
export function formatSettingKey(name: string): string {
if (!name) return ''
if (!name) return '';
return name
// CamelCase -> spaces
.replace(/([a-z])([A-Z])/g, '$1 $2')
// snake_case -> spaces
.replace(/_/g, ' ')
// Remove extra spaces
.replace(/\s+/g, ' ')
.trim()
// Capitalize first letter
.replace(/^./, c => c.toUpperCase())
return (
name
// CamelCase -> spaces
.replace(/([a-z])([A-Z])/g, '$1 $2')
// snake_case -> spaces
.replace(/_/g, ' ')
// Remove extra spaces
.replace(/\s+/g, ' ')
.trim()
// Capitalize first letter
.replace(/^./, (c) => c.toUpperCase())
);
}
// Strip HTML tags and template descriptions from setting descriptions
export function stripHtml(html: string): string {
if (!html) return ''
if (!html) return '';
const cleaned = html
.replace(/<[^>]*>/g, '')
.replace(/&nbsp;/g, ' ')
@@ -24,12 +26,12 @@ export function stripHtml(html: string): string {
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&quot;/g, '"')
.trim()
.trim();
// Remove template descriptions like "Параметр X управляет категорией Y"
if (cleaned.match(/^Параметр .+ управляет категорией/)) {
return ''
return '';
}
return cleaned
return cleaned;
}