diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml index 0cb39cde45c..271e8cc3d9d 100644 --- a/.github/workflows/main-ci.yml +++ b/.github/workflows/main-ci.yml @@ -190,6 +190,7 @@ jobs: - 'package.json' - 'pnpm-lock.yaml' - 'pnpm-workspace.yaml' + - 'tsconfig.json' - 'vite.config.ts' - 'lint.config.ts' - 'eslint.config.mjs' diff --git a/cli/tsconfig.json b/cli/tsconfig.json index 939c74ae5d5..b8f2b9072f5 100644 --- a/cli/tsconfig.json +++ b/cli/tsconfig.json @@ -11,6 +11,6 @@ "outDir": "dist", "sourceMap": true }, - "include": ["src/**/*.ts", "test/**/*.ts", "scripts/**/*.ts"], // tests must be included for typechecking + "include": ["*.ts", "bin/**/*.ts", "src/**/*.ts", "test/**/*.ts", "scripts/**/*.ts"], "exclude": ["node_modules", "dist"] } diff --git a/lint.config.ts b/lint.config.ts index a39467f0f50..64a2c1b11d1 100644 --- a/lint.config.ts +++ b/lint.config.ts @@ -210,7 +210,6 @@ export const lintConfig = { name: 'dify', specifier: './web/plugins/eslint/index.js', }, - 'eslint-plugin-erasable-syntax-only', { name: 'eslint-comments', specifier: '@eslint-community/eslint-plugin-eslint-comments', @@ -523,10 +522,6 @@ export const lintConfig = { 'import/no-duplicates': 'error', 'import/no-mutable-exports': 'error', 'import/no-named-default': 'error', - 'erasable-syntax-only/enums': 'error', - 'erasable-syntax-only/import-aliases': 'error', - 'erasable-syntax-only/namespaces': 'error', - 'erasable-syntax-only/parameter-properties': 'error', 'regexp/confusing-quantifier': 'warn', 'regexp/control-character-escape': 'error', 'regexp/match-any': 'error', @@ -1372,10 +1367,6 @@ export const lintConfig = { 'import/no-duplicates': 'off', 'import/no-mutable-exports': 'off', 'import/no-named-default': 'off', - 'erasable-syntax-only/enums': 'off', - 'erasable-syntax-only/import-aliases': 'off', - 'erasable-syntax-only/namespaces': 'off', - 'erasable-syntax-only/parameter-properties': 'off', 'regexp/confusing-quantifier': 'off', 'regexp/control-character-escape': 'off', 'regexp/match-any': 'off', diff --git a/package.json b/package.json index ab367a7d499..50bd959260d 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "eslint-plugin-antfu": "catalog:", "eslint-plugin-better-tailwindcss": "catalog:", "eslint-plugin-command": "catalog:", - "eslint-plugin-erasable-syntax-only": "catalog:", "eslint-plugin-jsdoc": "catalog:", "eslint-plugin-jsonc": "catalog:", "eslint-plugin-markdown-preferences": "catalog:", diff --git a/packages/iconify-collections/package.json b/packages/iconify-collections/package.json index eeec58e1fab..7c37657dedc 100644 --- a/packages/iconify-collections/package.json +++ b/packages/iconify-collections/package.json @@ -24,9 +24,13 @@ }, "scripts": { "check:dimensions": "tsx ./scripts/check-icon-dimensions.ts", - "generate": "tsx ./scripts/generate-collections.ts" + "generate": "tsx ./scripts/generate-collections.ts", + "type-check": "tsc" }, "devDependencies": { + "@dify/tsconfig": "workspace:*", + "@types/node": "catalog:", + "@typescript/native": "catalog:", "iconify-import-svg": "catalog:", "tsx": "catalog:" } diff --git a/packages/iconify-collections/tsconfig.json b/packages/iconify-collections/tsconfig.json new file mode 100644 index 00000000000..a175752d797 --- /dev/null +++ b/packages/iconify-collections/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "@dify/tsconfig/node.json", + "include": ["scripts/**/*.ts"] +} diff --git a/packages/image-resources/tsconfig.json b/packages/image-resources/tsconfig.json index 56d87a01956..5f575ed507b 100644 --- a/packages/image-resources/tsconfig.json +++ b/packages/image-resources/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "@dify/tsconfig/node.json", "compilerOptions": { - "allowImportingTsExtensions": true, - "erasableSyntaxOnly": true + "allowImportingTsExtensions": true }, "include": ["*.ts"] } diff --git a/packages/tsconfig/base.json b/packages/tsconfig/base.json index 707f1aff567..24818a9a3b9 100644 --- a/packages/tsconfig/base.json +++ b/packages/tsconfig/base.json @@ -8,6 +8,7 @@ "moduleDetection": "force", "isolatedModules": true, "verbatimModuleSyntax": true, + "erasableSyntaxOnly": true, "strict": true, "noUncheckedIndexedAccess": true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 79d001da6e8..4be12271bc0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -491,9 +491,6 @@ catalogs: eslint-plugin-command: specifier: 4.0.0 version: 4.0.0 - eslint-plugin-erasable-syntax-only: - specifier: 0.7.1 - version: 0.7.1 eslint-plugin-jsdoc: specifier: 64.5.2 version: 64.5.2 @@ -867,9 +864,6 @@ importers: eslint-plugin-command: specifier: 'catalog:' version: 4.0.0(@typescript-eslint/typescript-estree@8.70.0(@typescript/typescript6@6.0.2)(supports-color@11.0.0))(@typescript-eslint/utils@8.70.0(@typescript/typescript6@6.0.2)(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0))(supports-color@11.0.0))(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0)) - eslint-plugin-erasable-syntax-only: - specifier: 'catalog:' - version: 0.7.1(@typescript-eslint/parser@8.70.0(@typescript/typescript6@6.0.2)(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0))(supports-color@11.0.0))(@typescript/typescript6@6.0.2)(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0))(supports-color@11.0.0) eslint-plugin-jsdoc: specifier: 'catalog:' version: 64.5.2(@typescript/typescript6@6.0.2)(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0))(supports-color@11.0.0) @@ -1237,6 +1231,15 @@ importers: packages/iconify-collections: devDependencies: + '@dify/tsconfig': + specifier: workspace:* + version: link:../tsconfig + '@types/node': + specifier: 'catalog:' + version: 25.9.7 + '@typescript/native': + specifier: 'catalog:' + version: typescript@7.0.2 iconify-import-svg: specifier: 'catalog:' version: 0.2.0(supports-color@11.0.0) @@ -5769,10 +5772,6 @@ packages: cacheable@2.5.0: resolution: {integrity: sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==} - cached-factory@0.3.0: - resolution: {integrity: sha512-8PWf78SYJg9kGpUNlqOlg2iE4nu/iW7FidBVdvEZPy0GJRUyN91X7q0VzX/oyJE6bGrgr/bR0VhcGF87vgeQaw==} - engines: {node: '>=18'} - camelize@1.0.1: resolution: {integrity: sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==} @@ -6527,14 +6526,6 @@ packages: '@typescript-eslint/utils': '*' eslint: '*' - eslint-plugin-erasable-syntax-only@0.7.1: - resolution: {integrity: sha512-2zpgLgFq/HmIVQU2KNOsuuQdJQAiRdq23xpCamhatbH4ZlzinqXdDmbxGALj7VSiC9GMBHqmu4Cu7KaSqQfNhw==} - engines: {node: '>=20.18.0'} - peerDependencies: - '@typescript-eslint/parser': '>=8' - eslint: '>=9' - typescript: '>=5' - eslint-plugin-es-x@7.8.0: resolution: {integrity: sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ==} engines: {node: ^14.18.0 || >=16.0.0} @@ -13399,8 +13390,6 @@ snapshots: keyv: 5.6.0 qified: 0.10.1 - cached-factory@0.3.0: {} - camelize@1.0.1: {} caniuse-lite@1.0.30001810: {} @@ -14147,16 +14136,6 @@ snapshots: '@typescript-eslint/utils': 8.70.0(@typescript/typescript6@6.0.2)(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0))(supports-color@11.0.0) eslint: 10.10.0(jiti@2.7.0)(supports-color@11.0.0) - eslint-plugin-erasable-syntax-only@0.7.1(@typescript-eslint/parser@8.70.0(@typescript/typescript6@6.0.2)(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0))(supports-color@11.0.0))(@typescript/typescript6@6.0.2)(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0))(supports-color@11.0.0): - dependencies: - '@typescript-eslint/parser': 8.70.0(@typescript/typescript6@6.0.2)(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0))(supports-color@11.0.0) - '@typescript-eslint/utils': 8.70.0(@typescript/typescript6@6.0.2)(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0))(supports-color@11.0.0) - cached-factory: 0.3.0 - eslint: 10.10.0(jiti@2.7.0)(supports-color@11.0.0) - typescript: '@typescript/typescript6@6.0.2' - transitivePeerDependencies: - - supports-color - eslint-plugin-es-x@7.8.0(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0)): dependencies: '@eslint-community/eslint-utils': 4.9.1(eslint@10.10.0(jiti@2.7.0)(supports-color@11.0.0)) @@ -18362,7 +18341,6 @@ time: eslint-plugin-antfu@3.2.3: '2026-05-11T02:24:38.348Z' eslint-plugin-better-tailwindcss@4.7.0: '2026-07-19T13:26:01.366Z' eslint-plugin-command@4.0.0: '2026-07-31T04:38:09.766Z' - eslint-plugin-erasable-syntax-only@0.7.1: '2026-08-19T04:46:35.017Z' eslint-plugin-jsdoc@64.5.2: '2026-09-16T13:00:55.286Z' eslint-plugin-jsonc@3.4.2: '2026-08-22T12:13:35.450Z' eslint-plugin-markdown-preferences@0.42.0: '2026-07-14T00:58:47.572Z' diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index bc31659fea8..e8f329dd70c 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -171,7 +171,6 @@ catalog: eslint-plugin-antfu: 3.2.3 eslint-plugin-better-tailwindcss: 4.7.0 eslint-plugin-command: 4.0.0 - eslint-plugin-erasable-syntax-only: 0.7.1 eslint-plugin-jsdoc: 64.5.2 eslint-plugin-jsonc: 3.4.2 eslint-plugin-markdown-preferences: 0.42.0 diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000000..eaf148e2600 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "./packages/tsconfig/node.json", + "include": ["*.ts"] +} diff --git a/web/docs/lint.md b/web/docs/lint.md index a002b885895..86bf2ab8e72 100644 --- a/web/docs/lint.md +++ b/web/docs/lint.md @@ -63,6 +63,11 @@ The non-code baseline and its repository-wide file scope live in `eslint.config. The root configuration enables both `typeAware` and `typeCheck`, so `vp check` runs type-aware rules and full diagnostics through the repository's `@typescript/native` compiler. +The shared `packages/tsconfig/base.json` enforces erasable TypeScript syntax through +`erasableSyntaxOnly`. Root tooling and TypeScript packages inherit this contract; enum +declarations, runtime namespaces, parameter properties, and import assignments are checked +by the compiler without a separate lint plugin. + The web package still runs its existing TSSLint rule separately: ```sh