mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 06:30:10 +08:00
* feat: add Zhipu logo and update related images - Introduced a new Zhipu logo component in SVG format. - Updated existing image assets for chatglm, zhipu, and zhipu_dark. - Added a new zhipu image for search functionality. * feat: integrate Cherryin signature generation - Added a new integration for Cherryin, including a signature generation feature. - Updated IPC channels to handle Cherryin requests. - Introduced a new JavaScript file for Cherryin integration. - Modified configuration files to include Cherryin client secrets and paths. - Enhanced the ESLint and TypeScript configurations to accommodate the new integration. * feat: add Zhipu search provider and logo integration - Implemented a new ZhipuProvider for web search functionality. - Added Zhipu logo to the WebSearchButton component. - Updated WebSearchProviderFactory to include Zhipu as a search option. - Enhanced error handling and logging for Zhipu search requests. * feat: add cherryin provider * fix: correct import path for CherryinAPIClient and update paintings state structure in migration * chore: update version number to 1.5.8 in package.json * feat: enhance model filtering in SelectModelPopup - Added support for identifying free trial models in the model filtering logic. - Updated the condition for determining free models to include both free and free trial models. * refactor: update navigation to use query parameters for provider settings - Modified navigation logic in FreeTrialModelTag and related utilities to use query parameters instead of state for provider identification. - Removed unused useLocation hook in ProviderList component to streamline state management. * fix: remove provider ID from search parameters on selection change in ProviderList * refactor: remove free trial model references and update related logic - Eliminated the FreeTrialTag component and its associated logic from ModelTagsWithLabel and SelectModelPopup. - Updated model filtering to only consider free models without the free trial distinction. - Removed translations and utility functions related to free trial models across multiple locales. * fix: prevent mutation of read-only properties in web search provider - Updated the addWebSearchProvider function to clone the provider object before pushing it to the state, preventing mutation of read-only properties. - Enhanced the migration logic to update the apiKey for the zhipu web search provider if it exists. * refactor: streamline provider selection and navigation logic - Updated FreeTrialModelTag to directly navigate to provider settings using query parameters, removing unnecessary provider fetching. - Simplified ProviderList by eliminating the EventEmitter for provider selection and ensuring search parameters are updated correctly.
130 lines
4.5 KiB
JavaScript
130 lines
4.5 KiB
JavaScript
import electronConfigPrettier from '@electron-toolkit/eslint-config-prettier'
|
|
import tseslint from '@electron-toolkit/eslint-config-ts'
|
|
import eslint from '@eslint/js'
|
|
import eslintReact from '@eslint-react/eslint-plugin'
|
|
import { defineConfig } from 'eslint/config'
|
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
import simpleImportSort from 'eslint-plugin-simple-import-sort'
|
|
import unusedImports from 'eslint-plugin-unused-imports'
|
|
|
|
export default defineConfig([
|
|
eslint.configs.recommended,
|
|
tseslint.configs.recommended,
|
|
electronConfigPrettier,
|
|
eslintReact.configs['recommended-typescript'],
|
|
reactHooks.configs['recommended-latest'],
|
|
{
|
|
plugins: {
|
|
'simple-import-sort': simpleImportSort,
|
|
'unused-imports': unusedImports
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
|
|
'simple-import-sort/imports': 'error',
|
|
'simple-import-sort/exports': 'error',
|
|
'unused-imports/no-unused-imports': 'error',
|
|
'@eslint-react/no-prop-types': 'error',
|
|
'prettier/prettier': ['error']
|
|
}
|
|
},
|
|
// Configuration for ensuring compatibility with the original ESLint(8.x) rules
|
|
{
|
|
rules: {
|
|
'@typescript-eslint/no-require-imports': 'off',
|
|
'@typescript-eslint/no-unused-vars': ['error', { caughtErrors: 'none' }],
|
|
'@typescript-eslint/no-unused-expressions': 'off',
|
|
'@typescript-eslint/no-empty-object-type': 'off',
|
|
'@eslint-react/hooks-extra/no-direct-set-state-in-use-effect': 'off',
|
|
'@eslint-react/web-api/no-leaked-event-listener': 'off',
|
|
'@eslint-react/web-api/no-leaked-timeout': 'off',
|
|
'@eslint-react/no-unknown-property': 'off',
|
|
'@eslint-react/no-nested-component-definitions': 'off',
|
|
'@eslint-react/dom/no-dangerously-set-innerhtml': 'off',
|
|
'@eslint-react/no-array-index-key': 'off',
|
|
'@eslint-react/no-unstable-default-props': 'off',
|
|
'@eslint-react/no-unstable-context-value': 'off',
|
|
'@eslint-react/hooks-extra/prefer-use-state-lazy-initialization': 'off',
|
|
'@eslint-react/hooks-extra/no-unnecessary-use-prefix': 'off',
|
|
'@eslint-react/no-children-to-array': 'off'
|
|
}
|
|
},
|
|
{
|
|
// LoggerService Custom Rules - only apply to src directory
|
|
files: ['src/**/*.{ts,tsx,js,jsx}'],
|
|
ignores: ['src/**/__tests__/**', 'src/**/__mocks__/**', 'src/**/*.test.*'],
|
|
rules: {
|
|
'no-restricted-syntax': [
|
|
process.env.PRCI ? 'error' : 'warn',
|
|
{
|
|
selector: 'CallExpression[callee.object.name="console"]',
|
|
message:
|
|
'❗CherryStudio uses unified LoggerService: 📖 docs/technical/how-to-use-logger-en.md\n❗CherryStudio 使用统一的日志服务:📖 docs/technical/how-to-use-logger-zh.md\n\n'
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
files: ['**/*.{ts,tsx,js,jsx}'],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module'
|
|
},
|
|
plugins: {
|
|
i18n: {
|
|
rules: {
|
|
'no-template-in-t': {
|
|
meta: {
|
|
type: 'problem',
|
|
docs: {
|
|
description: '⚠️不建议在 t() 函数中使用模板字符串,这样会导致渲染结果不可预料',
|
|
recommended: true
|
|
},
|
|
messages: {
|
|
noTemplateInT: '⚠️不建议在 t() 函数中使用模板字符串,这样会导致渲染结果不可预料'
|
|
}
|
|
},
|
|
create(context) {
|
|
return {
|
|
CallExpression(node) {
|
|
const { callee, arguments: args } = node
|
|
const isTFunction =
|
|
(callee.type === 'Identifier' && callee.name === 't') ||
|
|
(callee.type === 'MemberExpression' &&
|
|
callee.property.type === 'Identifier' &&
|
|
callee.property.name === 't')
|
|
|
|
if (isTFunction && args[0]?.type === 'TemplateLiteral') {
|
|
context.report({
|
|
node: args[0],
|
|
messageId: 'noTemplateInT'
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
rules: {
|
|
'i18n/no-template-in-t': 'warn'
|
|
}
|
|
},
|
|
{
|
|
ignores: [
|
|
'node_modules/**',
|
|
'build/**',
|
|
'dist/**',
|
|
'out/**',
|
|
'local/**',
|
|
'.yarn/**',
|
|
'.gitignore',
|
|
'scripts/cloudflare-worker.js',
|
|
'src/main/integration/nutstore/sso/lib/**',
|
|
'src/main/integration/cherryin/index.js'
|
|
]
|
|
}
|
|
])
|