mirror of
https://github.com/langgenius/dify.git
synced 2026-10-16 15:35:32 +08:00
chore: enforce erasable syntax in shared tsconfig (#42735)
This commit is contained in:
@@ -190,6 +190,7 @@ jobs:
|
||||
- 'package.json'
|
||||
- 'pnpm-lock.yaml'
|
||||
- 'pnpm-workspace.yaml'
|
||||
- 'tsconfig.json'
|
||||
- 'vite.config.ts'
|
||||
- 'lint.config.ts'
|
||||
- 'eslint.config.mjs'
|
||||
|
||||
+1
-1
@@ -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"]
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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:",
|
||||
|
||||
@@ -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:"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "@dify/tsconfig/node.json",
|
||||
"include": ["scripts/**/*.ts"]
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"extends": "@dify/tsconfig/node.json",
|
||||
"compilerOptions": {
|
||||
"allowImportingTsExtensions": true,
|
||||
"erasableSyntaxOnly": true
|
||||
"allowImportingTsExtensions": true
|
||||
},
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"moduleDetection": "force",
|
||||
"isolatedModules": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
|
||||
"strict": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
|
||||
Generated
+9
-31
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "./packages/tsconfig/node.json",
|
||||
"include": ["*.ts"]
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user