Files
shumai/eslint.config.js
T
Yiling-J a236cd3a97 feat(provider): add provider and model sync feature with vendored generator (#378)
* feat(provider): vendor and adapt pi model generator

- Vendor generate-models.ts, model-data.ts, and models-dev-reasoning-options.ts from @earendil-works/pi tag v0.82.1
- Adapt imports to use @earendil-works/pi-ai and expose generateModels programmatic function
- Add compare.test.ts to verify vendored generator against original built-in catalog
- Add packages/core/src/provider/generator to eslint ignores

* feat(provider): add provider and model sync api and ui

* feat(webui): add checkbox for existing providers and clean dialog description

* feat(webui): add expand all and collapse all to sync providers dialog

* refactor(provider): remove compare.test.ts and cli overhead from generate-models

* fix(provider): add 30s timeout and strict error handling to sync catalog fetching

* fix(e2e): eliminate drag-and-drop race condition on webkit

Allow requestAnimationFrame collision updates to settle in dragCard helper before releasing pointer, and scope fileCard locator via data-testid to avoid matching sidebar tree items.
2026-09-03 21:01:14 +08:00

115 lines
3.0 KiB
JavaScript

import js from '@eslint/js'
import prettier from 'eslint-config-prettier'
import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js'
import tseslint from 'typescript-eslint'
const baseNamingConvention = [
'error',
{
selector: 'property',
modifiers: ['requiresQuotes'],
format: null,
},
{
selector: 'objectLiteralProperty',
modifiers: ['requiresQuotes'],
format: null,
},
{
selector: ['property'],
format: ['strictCamelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
filter: {
// Allow CSS variables, common HTTP headers, library-specific names, paths, and hyphenated/numeric keys
regex:
'^(Authorization|Content-Type|Accept|--.*|string_contains|disableCSRFCheck|X-Frameio-.*|/.*|field-.*|class-name|icon-.*|[0-9]+|@typescript-eslint/.*|Variables|Read|Edit|Admin|Bucket|Key|Body|ContentLength|ContentType|Prefix|ContinuationToken|Signature)$',
match: false,
},
},
{
selector: ['parameter'],
format: ['strictCamelCase', 'StrictPascalCase'],
leadingUnderscore: 'allow',
},
{
selector: ['accessor'],
format: ['strictCamelCase'],
},
{
selector: ['classProperty'],
format: ['strictCamelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
},
{
selector: ['typeLike'],
format: ['StrictPascalCase'],
},
{
selector: 'typeParameter',
format: ['StrictPascalCase'],
prefix: ['T'],
},
{
selector: ['function'],
format: ['strictCamelCase', 'StrictPascalCase'],
leadingUnderscore: 'allow',
},
{
selector: ['classMethod'],
format: ['strictCamelCase'],
leadingUnderscore: 'allow',
},
{
selector: ['variable'],
format: ['strictCamelCase', 'StrictPascalCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
},
]
export default tseslint.config(
{
ignores: [
'**/dist/**',
'**/node_modules/**',
'**/packages/db/src/generated/**',
'**/packages/core/src/generated/**',
'**/data/**',
'**/packages/core/src/provider/generator/**',
'**/packages/webui/components/ui/**',
'**/packages/webui/paraglide/**',
'**/packages/webui/public/**',
],
},
js.configs.recommended,
...tseslint.configs.recommended,
prettier,
{
...pluginReactConfig,
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/naming-convention': baseNamingConvention,
},
},
{
files: ['**/*.test.ts', '**/*.test.tsx'],
rules: {
'@typescript-eslint/naming-convention': baseNamingConvention.map((q) => {
if (
typeof q === 'object' &&
(q.selector === 'property' ||
(Array.isArray(q.selector) && q.selector.includes('property'))) &&
Array.isArray(q.format)
) {
return {
...q,
format: [...q.format, 'StrictPascalCase'],
}
}
return q
}),
},
},
)