Files
dify/vite.config.ts
T
Stephen Zhou cc3f901598 Merge remote-tracking branch 'origin/main' into deploy/konwledge
# Conflicts:
#	api/extensions/ext_celery.py
#	api/tests/unit_tests/controllers/console/auth/test_oauth_server.py
#	lint.config.ts
#	packages/contracts/knowledge-fs-contract.test.mjs
#	vite.config.ts
#	web/features/new-rag/__tests__/document-detail-page.spec.tsx
#	web/features/new-rag/__tests__/knowledge-space-shell.spec.tsx
#	web/features/new-rag/__tests__/processing-task-events.spec.ts
#	web/features/new-rag/create-knowledge-page.tsx
#	web/features/new-rag/document-detail-page.tsx
#	web/features/new-rag/knowledge-space-shell.tsx
2026-08-17 09:50:10 +08:00

82 lines
2.2 KiB
TypeScript

import { defineConfig } from 'vite-plus'
import { lintConfig } from './lint.config'
const lintFiles = '*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'
const eslintFiles = '*.{json,jsonc,json5,md,yml,yaml,toml}'
const formatOnlyFiles = '*.{mdx,css,scss,less,html,vue,svelte,gql,graphql,hbs,handlebars}'
const checkFix = 'vp check --fix --no-error-on-unmatched-pattern'
const formatFix = 'vp fmt --no-error-on-unmatched-pattern'
const eslintFix =
'eslint --fix --pass-on-unpruned-suppressions --no-error-on-unmatched-pattern --no-warn-ignored'
const nonFrontendIgnores = [
'.agents/**',
'.devcontainer/**',
'/*.md',
'api/**',
'codecov.yml',
'depot.json',
'dify-agent/**',
'docker/**',
'docs/**',
'knowledge-fs/**',
'scripts/**/*',
'!scripts/check-web-production-unused-after-knip-fix.mjs',
'sdks/php-client/**',
'sdks/python-client/**',
]
const generatedIgnores = [
'**/.next/**',
'**/.vinext/**',
'**/coverage/**',
'**/dist/**',
'**/storybook-static/**',
'e2e/.auth/**',
'e2e/cucumber-report/**',
'eslint-suppressions.json',
'oxlint-suppressions.json',
'web/next/**',
'web/next-env.d.ts',
'web/public/embed.min.js',
'web/public/pdf.worker.min.mjs',
'web/public/vs/**',
]
const formatterUnstableInputs = ['web/app/components/develop/template/*.mdx']
export default defineConfig({
lint: lintConfig,
staged: {
[lintFiles]: checkFix,
[eslintFiles]: [eslintFix, formatFix],
[formatOnlyFiles]: formatFix,
'.vite-hooks/*': 'sh -n',
},
fmt: {
ignorePatterns: [...nonFrontendIgnores, ...generatedIgnores, ...formatterUnstableInputs],
singleQuote: true,
semi: false,
sortImports: {
groups: [
'type-import',
['type-parent', 'type-sibling', 'type-index', 'type-internal', 'type-subpath'],
'value-builtin',
'value-external',
['value-internal', 'value-subpath'],
['value-parent', 'value-sibling', 'value-index'],
['side_effect_style', 'side_effect'],
'unknown',
],
newlinesBetween: false,
sortSideEffects: false,
},
sortPackageJson: true,
sortTailwindcss: {
functions: ['cn', 'clsx', 'cva', 'tw', 'twMerge'],
preserveDuplicates: false,
stylesheet: 'web/app/styles/globals.css',
},
},
})