Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

perf(tsconfig): optimize tsconfig.json (#661)

白熱49a9112f3e2d
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index 5e46c5dd94..0a54c879b9 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -1,35 +1,5 @@
const { resolve } = require('node:path');
-
-const allPackages = [
- 'packages/core',
- 'packages/design',
- 'packages/docs',
- 'packages/docs-ui',
- 'packages/engine-formula',
- 'packages/engine-numfmt',
- 'packages/engine-render',
- 'packages/formula',
- 'packages/image',
- 'packages/network',
- 'packages/rpc',
- 'packages/sheets',
- 'packages/sheets-find',
- 'packages/sheets-formula',
- 'packages/sheets-import-xlsx',
- 'packages/sheets-numfmt',
- 'packages/sheets-ui',
- 'packages/slides',
- 'packages/slides-ui',
- 'packages/ui',
- 'packages/uniscript',
-
- 'examples/data',
- 'examples/docs',
- 'examples/sheets',
- 'examples/slides',
-
- 'apps/docs',
-];
+const tsConfig = require('./tsconfig.json')
/**
* @type {import('eslint').Linter.Config}
@@ -199,12 +169,14 @@ const config = {
},
overrides: [
- ...allPackages.map((pkg) => ({
- files: [`${pkg}/src/**/*.ts`, `${pkg}/src/**/*.tsx`],
- parserOptions: {
- project: resolve(__dirname, './tsconfig.eslint.json'),
- },
- })),
+ ...tsConfig.references.map(({ path }) => {
+ return {
+ files: [`${path}/src/**/*.ts`, `${path}/src/**/*.tsx`],
+ parserOptions: {
+ project: resolve(__dirname, './tsconfig.eslint.json'),
+ },
+ }
+ }),
],
};
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 84a596527c..e16882a79a 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,7 +1,10 @@
+
{
+
"editor.codeActionsOnSave": {
+ "mode": "explicit",
"source.fixAll.eslint": true,
- "source.fixAll.stylelint": true
+ "source.fixAll.stylelint": true,
},
"editor.formatOnSave": false,
"javascript.preferences.importModuleSpecifier": "relative",
@@ -83,5 +86,4 @@
"Xinwei"
],
"vsicons.presets.angular": false,
- "eslint.codeActionsOnSave.mode": "problems"
}
diff --git a/examples/data/tsconfig.json b/examples/data/tsconfig.json
new file mode 100644
index 0000000000..32d857ca72
--- /dev/null
+++ b/examples/data/tsconfig.json
@@ -0,0 +1,10 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "rootDir": "./src",
+ "outDir": "lib",
+ "esModuleInterop": true,
+ "strictPropertyInitialization": false
+ },
+ "include": ["src/**/*"]
+}
diff --git a/packages/image/tsconfig.esbuild.json b/packages/image/tsconfig.esbuild.json
new file mode 100644
index 0000000000..fc1f1714b9
--- /dev/null
+++ b/packages/image/tsconfig.esbuild.json
@@ -0,0 +1,13 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "rootDir": "./src",
+ "outDir": "./lib/types",
+ "declaration": true,
+ "declarationDir": "./lib/types",
+ "declarationMap": true,
+ "emitDeclarationOnly": true,
+ "isolatedModules": false
+ },
+ "exclude": ["**/*.test.ts", "**/*.test.tsx", "**/*.stories.tsx"]
+}
diff --git a/packages/image/tsconfig.json b/packages/image/tsconfig.json
new file mode 100644
index 0000000000..32d857ca72
--- /dev/null
+++ b/packages/image/tsconfig.json
@@ -0,0 +1,10 @@
+{
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "rootDir": "./src",
+ "outDir": "lib",
+ "esModuleInterop": true,
+ "strictPropertyInitialization": false
+ },
+ "include": ["src/**/*"]
+}
diff --git a/tsconfig.json b/tsconfig.json
index 518299e46c..77ef32d88f 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -49,9 +49,9 @@
{
"path": "./packages/formula"
},
- // {
- // "path": "./packages/image"
- // },
+ {
+ "path": "./packages/image"
+ },
{
"path": "./packages/network"
},
@@ -88,14 +88,20 @@
{
"path": "./packages/uniscript"
},
- ],
- "files": [],
- "exclude": ["node_modules", "target", "lib", "test-results"],
- "ts-node": {
- "esm": true,
- "compilerOptions": {
- "module": "ESNext",
- "moduleResolution": "Node"
- }
- }
+ {
+ "path": "./examples/data"
+ },
+ {
+ "path": "./examples/docs"
+ },
+ {
+ "path": "./examples/sheets"
+ },
+ {
+ "path": "./examples/slides"
+ },
+ {
+ "path": "./apps/docs"
+ }
+ ]
}