Compare commits

..

14 Commits

Author SHA1 Message Date
819370dffe update 2026-01-20 19:23:14 +08:00
3cfd737f57 fix lint 2026-01-20 19:12:07 +08:00
5b5881beb3 Fix ESLint selector - use simpler selector with runtime filtering instead of dynamic regex
Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
2026-01-20 10:57:48 +00:00
397c5eef7d Merge branch 'main' into copilot/refactor-package-json-version 2026-01-20 18:49:20 +08:00
2f01541710 Extract dependency keys and version prefixes as constants in ESLint rule
Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
2026-01-20 10:39:53 +00:00
4d550faaaa Improve ESLint rule to report errors at specific dependency locations
Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
2026-01-20 10:33:00 +00:00
d4b10eeaae Remove auto-fix functionality from no-version-prefix ESLint rule
Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
2026-01-20 10:27:22 +00:00
6c19f19dd6 Fix lockfile mismatch - update @typescript/native-preview to exact version and regenerate pnpm-lock.yaml
Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
2026-01-20 10:07:12 +00:00
9557d47116 Revert changes to sdks directory
Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
2026-01-20 09:59:54 +00:00
7a81558a55 Fix ESLint rule to avoid duplicate error reports
Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
2026-01-20 09:53:39 +00:00
13fc934ca7 Fix ESLint rule to use underscore prefix for unused parameter
Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
2026-01-20 09:48:10 +00:00
8bade7b0bf Remove version prefixes from package.json files
Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
2026-01-20 09:44:56 +00:00
bab1b87017 Add .npmrc and ESLint rule for version prefix validation
Co-authored-by: hyoban <38493346+hyoban@users.noreply.github.com>
2026-01-20 09:42:10 +00:00
20b53464ba Initial plan 2026-01-20 09:38:49 +00:00
6 changed files with 579 additions and 510 deletions

1
web/.npmrc Normal file
View File

@ -0,0 +1 @@
save-exact=true

View File

@ -1,6 +1,7 @@
import noAsAnyInT from './rules/no-as-any-in-t.js'
import noExtraKeys from './rules/no-extra-keys.js'
import noLegacyNamespacePrefix from './rules/no-legacy-namespace-prefix.js'
import noVersionPrefix from './rules/no-version-prefix.js'
import requireNsOption from './rules/require-ns-option.js'
import validI18nKeys from './rules/valid-i18n-keys.js'
@ -14,6 +15,7 @@ const plugin = {
'no-as-any-in-t': noAsAnyInT,
'no-extra-keys': noExtraKeys,
'no-legacy-namespace-prefix': noLegacyNamespacePrefix,
'no-version-prefix': noVersionPrefix,
'require-ns-option': requireNsOption,
'valid-i18n-keys': validI18nKeys,
},

View File

@ -0,0 +1,45 @@
const DEPENDENCY_KEYS = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']
const VERSION_PREFIXES = ['^', '~']
/** @type {import('eslint').Rule.RuleModule} */
export default {
meta: {
type: 'problem',
docs: {
description: `Ensure package.json dependencies do not use version prefixes (${VERSION_PREFIXES.join(' or ')})`,
},
fixable: 'code',
},
create(context) {
const { filename } = context
if (!filename.endsWith('package.json'))
return {}
const selector = `JSONProperty:matches(${DEPENDENCY_KEYS.map(k => `[key.value="${k}"]`).join(', ')}) > JSONObjectExpression > JSONProperty`
return {
[selector](node) {
const versionNode = node.value
if (versionNode && versionNode.type === 'JSONLiteral' && typeof versionNode.value === 'string') {
const version = versionNode.value
const foundPrefix = VERSION_PREFIXES.find(prefix => version.startsWith(prefix))
if (foundPrefix) {
const packageName = node.key.value || node.key.name
const cleanVersion = version.substring(1)
const canAutoFix = /^\d+\.\d+\.\d+$/.test(cleanVersion)
context.report({
node: versionNode,
message: `Dependency "${packageName}" has version prefix "${foundPrefix}" that should be removed (found: "${version}", expected: "${cleanVersion}")`,
fix: canAutoFix
? fixer => fixer.replaceText(versionNode, `"${cleanVersion}"`)
: undefined,
})
}
}
},
}
},
}

View File

@ -133,4 +133,14 @@ export default antfu(
'dify-i18n/no-extra-keys': 'error',
},
},
// package.json version prefix validation
{
files: ['**/package.json'],
plugins: {
'dify-i18n': difyI18n,
},
rules: {
'dify-i18n/no-version-prefix': 'error',
},
},
)

View File

@ -52,181 +52,181 @@
"knip": "knip"
},
"dependencies": {
"@amplitude/analytics-browser": "^2.33.1",
"@amplitude/plugin-session-replay-browser": "^1.23.6",
"@emoji-mart/data": "^1.2.1",
"@floating-ui/react": "^0.26.28",
"@formatjs/intl-localematcher": "^0.5.10",
"@amplitude/analytics-browser": "2.33.1",
"@amplitude/plugin-session-replay-browser": "1.23.6",
"@emoji-mart/data": "1.2.1",
"@floating-ui/react": "0.26.28",
"@formatjs/intl-localematcher": "0.5.10",
"@headlessui/react": "2.2.1",
"@heroicons/react": "^2.2.0",
"@lexical/code": "^0.38.2",
"@lexical/link": "^0.38.2",
"@lexical/list": "^0.38.2",
"@lexical/react": "^0.38.2",
"@lexical/selection": "^0.38.2",
"@lexical/text": "^0.38.2",
"@lexical/utils": "^0.38.2",
"@monaco-editor/react": "^4.7.0",
"@octokit/core": "^6.1.6",
"@octokit/request-error": "^6.1.8",
"@orpc/client": "^1.13.4",
"@orpc/contract": "^1.13.4",
"@orpc/openapi-client": "^1.13.4",
"@orpc/tanstack-query": "^1.13.4",
"@remixicon/react": "^4.7.0",
"@sentry/react": "^8.55.0",
"@svgdotjs/svg.js": "^3.2.5",
"@tailwindcss/typography": "^0.5.19",
"@tanstack/react-form": "^1.23.7",
"@tanstack/react-query": "^5.90.5",
"abcjs": "^6.5.2",
"ahooks": "^3.9.5",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"copy-to-clipboard": "^3.3.3",
"cron-parser": "^5.4.0",
"dayjs": "^1.11.19",
"decimal.js": "^10.6.0",
"dompurify": "^3.3.0",
"echarts": "^5.6.0",
"echarts-for-react": "^3.0.5",
"elkjs": "^0.9.3",
"emoji-mart": "^5.6.0",
"es-toolkit": "^1.43.0",
"fast-deep-equal": "^3.1.3",
"html-entities": "^2.6.0",
"@heroicons/react": "2.2.0",
"@lexical/code": "0.38.2",
"@lexical/link": "0.38.2",
"@lexical/list": "0.38.2",
"@lexical/react": "0.38.2",
"@lexical/selection": "0.38.2",
"@lexical/text": "0.38.2",
"@lexical/utils": "0.38.2",
"@monaco-editor/react": "4.7.0",
"@octokit/core": "6.1.6",
"@octokit/request-error": "6.1.8",
"@orpc/client": "1.13.4",
"@orpc/contract": "1.13.4",
"@orpc/openapi-client": "1.13.4",
"@orpc/tanstack-query": "1.13.4",
"@remixicon/react": "4.7.0",
"@sentry/react": "8.55.0",
"@svgdotjs/svg.js": "3.2.5",
"@tailwindcss/typography": "0.5.19",
"@tanstack/react-form": "1.23.7",
"@tanstack/react-query": "5.90.5",
"abcjs": "6.5.2",
"ahooks": "3.9.5",
"class-variance-authority": "0.7.1",
"clsx": "2.1.1",
"cmdk": "1.1.1",
"copy-to-clipboard": "3.3.3",
"cron-parser": "5.4.0",
"dayjs": "1.11.19",
"decimal.js": "10.6.0",
"dompurify": "3.3.0",
"echarts": "5.6.0",
"echarts-for-react": "3.0.5",
"elkjs": "0.9.3",
"emoji-mart": "5.6.0",
"es-toolkit": "1.43.0",
"fast-deep-equal": "3.1.3",
"html-entities": "2.6.0",
"html-to-image": "1.11.13",
"i18next": "^25.7.3",
"i18next-resources-to-backend": "^1.2.1",
"immer": "^11.1.0",
"jotai": "^2.16.1",
"js-audio-recorder": "^1.0.7",
"js-cookie": "^3.0.5",
"js-yaml": "^4.1.0",
"jsonschema": "^1.5.0",
"katex": "^0.16.25",
"ky": "^1.12.0",
"lamejs": "^1.2.1",
"lexical": "^0.38.2",
"line-clamp": "^1.0.0",
"mermaid": "~11.11.0",
"mime": "^4.1.0",
"mitt": "^3.0.1",
"negotiator": "^1.0.0",
"next": "~15.5.9",
"next-themes": "^0.4.6",
"nuqs": "^2.8.6",
"pinyin-pro": "^3.27.0",
"qrcode.react": "^4.2.0",
"qs": "^6.14.1",
"i18next": "25.7.3",
"i18next-resources-to-backend": "1.2.1",
"immer": "11.1.0",
"jotai": "2.16.1",
"js-audio-recorder": "1.0.7",
"js-cookie": "3.0.5",
"js-yaml": "4.1.0",
"jsonschema": "1.5.0",
"katex": "0.16.25",
"ky": "1.12.0",
"lamejs": "1.2.1",
"lexical": "0.38.2",
"line-clamp": "1.0.0",
"mermaid": "11.11.0",
"mime": "4.1.0",
"mitt": "3.0.1",
"negotiator": "1.0.0",
"next": "15.5.9",
"next-themes": "0.4.6",
"nuqs": "2.8.6",
"pinyin-pro": "3.27.0",
"qrcode.react": "4.2.0",
"qs": "6.14.1",
"react": "19.2.3",
"react-18-input-autosize": "^3.0.0",
"react-18-input-autosize": "3.0.0",
"react-dom": "19.2.3",
"react-easy-crop": "^5.5.3",
"react-hotkeys-hook": "^4.6.2",
"react-i18next": "^16.5.0",
"react-markdown": "^9.1.0",
"react-multi-email": "^1.0.25",
"react-papaparse": "^4.4.0",
"react-easy-crop": "5.5.3",
"react-hotkeys-hook": "4.6.2",
"react-i18next": "16.5.0",
"react-markdown": "9.1.0",
"react-multi-email": "1.0.25",
"react-papaparse": "4.4.0",
"react-pdf-highlighter": "8.0.0-rc.0",
"react-slider": "^2.0.6",
"react-sortablejs": "^6.1.4",
"react-syntax-highlighter": "^15.6.6",
"react-textarea-autosize": "^8.5.9",
"react-window": "^1.8.11",
"reactflow": "^11.11.4",
"rehype-katex": "^7.0.1",
"rehype-raw": "^7.0.0",
"remark-breaks": "^4.0.0",
"remark-gfm": "^4.0.1",
"remark-math": "^6.0.0",
"scheduler": "^0.27.0",
"semver": "^7.7.3",
"sharp": "^0.33.5",
"sortablejs": "^1.15.6",
"string-ts": "^2.3.1",
"tailwind-merge": "^2.6.0",
"tldts": "^7.0.17",
"use-context-selector": "^2.0.0",
"uuid": "^10.0.0",
"zod": "^3.25.76",
"zundo": "^2.3.0",
"zustand": "^5.0.9"
"react-slider": "2.0.6",
"react-sortablejs": "6.1.4",
"react-syntax-highlighter": "15.6.6",
"react-textarea-autosize": "8.5.9",
"react-window": "1.8.11",
"reactflow": "11.11.4",
"rehype-katex": "7.0.1",
"rehype-raw": "7.0.0",
"remark-breaks": "4.0.0",
"remark-gfm": "4.0.1",
"remark-math": "6.0.0",
"scheduler": "0.27.0",
"semver": "7.7.3",
"sharp": "0.33.5",
"sortablejs": "1.15.6",
"string-ts": "2.3.1",
"tailwind-merge": "2.6.0",
"tldts": "7.0.17",
"use-context-selector": "2.0.0",
"uuid": "10.0.0",
"zod": "3.25.76",
"zundo": "2.3.0",
"zustand": "5.0.9"
},
"devDependencies": {
"@antfu/eslint-config": "^7.0.1",
"@chromatic-com/storybook": "^4.1.1",
"@eslint-react/eslint-plugin": "^2.7.0",
"@mdx-js/loader": "^3.1.1",
"@mdx-js/react": "^3.1.1",
"@antfu/eslint-config": "7.0.1",
"@chromatic-com/storybook": "4.1.1",
"@eslint-react/eslint-plugin": "2.7.0",
"@mdx-js/loader": "3.1.1",
"@mdx-js/react": "3.1.1",
"@next/bundle-analyzer": "15.5.9",
"@next/eslint-plugin-next": "15.5.9",
"@next/mdx": "15.5.9",
"@rgrove/parse-xml": "^4.2.0",
"@serwist/turbopack": "^9.5.0",
"@rgrove/parse-xml": "4.2.0",
"@serwist/turbopack": "9.5.0",
"@storybook/addon-docs": "9.1.13",
"@storybook/addon-links": "9.1.13",
"@storybook/addon-onboarding": "9.1.13",
"@storybook/addon-themes": "9.1.13",
"@storybook/nextjs": "9.1.13",
"@storybook/react": "9.1.17",
"@tanstack/eslint-plugin-query": "^5.91.2",
"@tanstack/react-devtools": "^0.9.0",
"@tanstack/react-form-devtools": "^0.2.9",
"@tanstack/react-query-devtools": "^5.90.2",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
"@tsslint/cli": "^3.0.1",
"@tsslint/compat-eslint": "^3.0.1",
"@tsslint/config": "^3.0.1",
"@types/js-cookie": "^3.0.6",
"@types/js-yaml": "^4.0.9",
"@types/negotiator": "^0.6.4",
"@tanstack/eslint-plugin-query": "5.91.2",
"@tanstack/react-devtools": "0.9.0",
"@tanstack/react-form-devtools": "0.2.9",
"@tanstack/react-query-devtools": "5.90.2",
"@testing-library/dom": "10.4.1",
"@testing-library/jest-dom": "6.9.1",
"@testing-library/react": "16.3.0",
"@testing-library/user-event": "14.6.1",
"@tsslint/cli": "3.0.1",
"@tsslint/compat-eslint": "3.0.1",
"@tsslint/config": "3.0.1",
"@types/js-cookie": "3.0.6",
"@types/js-yaml": "4.0.9",
"@types/negotiator": "0.6.4",
"@types/node": "18.15.0",
"@types/qs": "^6.14.0",
"@types/react": "~19.2.7",
"@types/react-dom": "~19.2.3",
"@types/react-slider": "^1.3.6",
"@types/react-syntax-highlighter": "^15.5.13",
"@types/react-window": "^1.8.8",
"@types/semver": "^7.7.1",
"@types/sortablejs": "^1.15.8",
"@types/uuid": "^10.0.0",
"@typescript-eslint/parser": "^8.53.0",
"@typescript/native-preview": "^7.0.0-dev",
"@vitejs/plugin-react": "^5.1.2",
"@vitest/coverage-v8": "^4.0.17",
"autoprefixer": "^10.4.21",
"@types/qs": "6.14.0",
"@types/react": "19.2.7",
"@types/react-dom": "19.2.3",
"@types/react-slider": "1.3.6",
"@types/react-syntax-highlighter": "15.5.13",
"@types/react-window": "1.8.8",
"@types/semver": "7.7.1",
"@types/sortablejs": "1.15.8",
"@types/uuid": "10.0.0",
"@typescript-eslint/parser": "8.53.0",
"@typescript/native-preview": "7.0.0-dev.20251209.1",
"@vitejs/plugin-react": "5.1.2",
"@vitest/coverage-v8": "4.0.17",
"autoprefixer": "10.4.21",
"code-inspector-plugin": "1.2.9",
"cross-env": "^10.1.0",
"esbuild-wasm": "^0.27.2",
"eslint": "^9.39.2",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.4.26",
"eslint-plugin-sonarjs": "^3.0.5",
"eslint-plugin-storybook": "^10.1.11",
"eslint-plugin-tailwindcss": "^3.18.2",
"husky": "^9.1.7",
"jsdom": "^27.3.0",
"jsdom-testing-mocks": "^1.16.0",
"knip": "^5.78.0",
"lint-staged": "^15.5.2",
"nock": "^14.0.10",
"postcss": "^8.5.6",
"react-scan": "^0.4.3",
"sass": "^1.93.2",
"serwist": "^9.5.0",
"cross-env": "10.1.0",
"esbuild-wasm": "0.27.2",
"eslint": "9.39.2",
"eslint-plugin-react-hooks": "7.0.1",
"eslint-plugin-react-refresh": "0.4.26",
"eslint-plugin-sonarjs": "3.0.5",
"eslint-plugin-storybook": "10.1.11",
"eslint-plugin-tailwindcss": "3.18.2",
"husky": "9.1.7",
"jsdom": "27.3.0",
"jsdom-testing-mocks": "1.16.0",
"knip": "5.78.0",
"lint-staged": "15.5.2",
"nock": "14.0.10",
"postcss": "8.5.6",
"react-scan": "0.4.3",
"sass": "1.93.2",
"serwist": "9.5.0",
"storybook": "9.1.17",
"tailwindcss": "^3.4.18",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"uglify-js": "^3.19.3",
"vite": "^7.3.1",
"vite-tsconfig-paths": "^6.0.4",
"vitest": "^4.0.17"
"tailwindcss": "3.4.18",
"tsx": "4.21.0",
"typescript": "5.9.3",
"uglify-js": "3.19.3",
"vite": "7.3.1",
"vite-tsconfig-paths": "6.0.4",
"vitest": "4.0.17"
},
"pnpm": {
"overrides": {

719
web/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff