From 34ed1c5435b6668484304fb0dd5c8288abc0fd8b Mon Sep 17 00:00:00 2001 From: Nex Zhu Date: Wed, 20 Dec 2023 11:45:38 +0800 Subject: [PATCH] setup(all): update tsconfigs to run eslint on all files including not src --- apps/desktop/eslint.config.js | 14 +++---------- apps/desktop/tsconfig.json | 11 ++++++---- apps/desktop/tsconfig.root.json | 21 +++++++++++++++++++ .../tsconfig.src.json} | 4 ++-- apps/web/eslint.config.js | 14 +++---------- apps/web/tsconfig.json | 11 ++++++---- apps/web/tsconfig.root.json | 21 +++++++++++++++++++ .../web/tsconfig.src.json | 4 ++-- libs/myutil/tsconfig.json | 5 ++++- libs/myutil/tsconfig.root.json | 21 +++++++++++++++++++ .../myutil/tsconfig.src.json | 0 nx.js | 4 ++-- nx.json | 4 ++-- 13 files changed, 95 insertions(+), 39 deletions(-) create mode 100644 apps/desktop/tsconfig.root.json rename apps/{web/tsconfig.build.json => desktop/tsconfig.src.json} (75%) create mode 100644 apps/web/tsconfig.root.json rename libs/myutil/tsconfig.build.json => apps/web/tsconfig.src.json (75%) create mode 100644 libs/myutil/tsconfig.root.json rename apps/desktop/tsconfig.build.json => libs/myutil/tsconfig.src.json (100%) diff --git a/apps/desktop/eslint.config.js b/apps/desktop/eslint.config.js index 903b44d..c39e4e6 100644 --- a/apps/desktop/eslint.config.js +++ b/apps/desktop/eslint.config.js @@ -5,16 +5,8 @@ export default config( { languageOptions: { parserOptions: { - project: ['tsconfig.build.json'], - } - } - }, - { - files: ["**/*.spec.ts"], - languageOptions: { - parserOptions: { - project: ['tsconfig.spec.json'], - } - } + project: ['tsconfig.root.json', 'tsconfig.src.json', 'tsconfig.spec.json'], + }, + }, }, ) diff --git a/apps/desktop/tsconfig.json b/apps/desktop/tsconfig.json index 0b64490..1e9ec09 100644 --- a/apps/desktop/tsconfig.json +++ b/apps/desktop/tsconfig.json @@ -3,14 +3,17 @@ "compilerOptions": { "baseUrl": "." }, - "files": [], - "include": [], "references": [ { - "path": "./tsconfig.build.json" + "path": "./tsconfig.root.json" + }, + { + "path": "./tsconfig.src.json" }, { "path": "./tsconfig.spec.json" } - ] + ], + "files": [], + "include": [] } diff --git a/apps/desktop/tsconfig.root.json b/apps/desktop/tsconfig.root.json new file mode 100644 index 0000000..5aa220e --- /dev/null +++ b/apps/desktop/tsconfig.root.json @@ -0,0 +1,21 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true + }, + "include": [".*.cjs", "**/*.ts", "**/*.cts", "**/*.tsx", "**/*.js", "**/*.cjs", "**/*.jsx", "**/*.vue"], + "exclude": [ + "src/**/*", + "vite.config.ts", + "vitest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.test.tsx", + "src/**/*.spec.tsx", + "src/**/*.test.js", + "src/**/*.spec.js", + "src/**/*.test.jsx", + "src/**/*.spec.jsx", + "src/**/*.d.ts" + ] +} diff --git a/apps/web/tsconfig.build.json b/apps/desktop/tsconfig.src.json similarity index 75% rename from apps/web/tsconfig.build.json rename to apps/desktop/tsconfig.src.json index 536507b..31f3daf 100644 --- a/apps/web/tsconfig.build.json +++ b/apps/desktop/tsconfig.src.json @@ -1,8 +1,8 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "declaration": true, - "types": ["node"] + "types": ["node"], + "declaration": true }, "include": ["src/**/*.ts"], "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"] diff --git a/apps/web/eslint.config.js b/apps/web/eslint.config.js index 903b44d..c39e4e6 100644 --- a/apps/web/eslint.config.js +++ b/apps/web/eslint.config.js @@ -5,16 +5,8 @@ export default config( { languageOptions: { parserOptions: { - project: ['tsconfig.build.json'], - } - } - }, - { - files: ["**/*.spec.ts"], - languageOptions: { - parserOptions: { - project: ['tsconfig.spec.json'], - } - } + project: ['tsconfig.root.json', 'tsconfig.src.json', 'tsconfig.spec.json'], + }, + }, }, ) diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index 0b64490..1e9ec09 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -3,14 +3,17 @@ "compilerOptions": { "baseUrl": "." }, - "files": [], - "include": [], "references": [ { - "path": "./tsconfig.build.json" + "path": "./tsconfig.root.json" + }, + { + "path": "./tsconfig.src.json" }, { "path": "./tsconfig.spec.json" } - ] + ], + "files": [], + "include": [] } diff --git a/apps/web/tsconfig.root.json b/apps/web/tsconfig.root.json new file mode 100644 index 0000000..5aa220e --- /dev/null +++ b/apps/web/tsconfig.root.json @@ -0,0 +1,21 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true + }, + "include": [".*.cjs", "**/*.ts", "**/*.cts", "**/*.tsx", "**/*.js", "**/*.cjs", "**/*.jsx", "**/*.vue"], + "exclude": [ + "src/**/*", + "vite.config.ts", + "vitest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.test.tsx", + "src/**/*.spec.tsx", + "src/**/*.test.js", + "src/**/*.spec.js", + "src/**/*.test.jsx", + "src/**/*.spec.jsx", + "src/**/*.d.ts" + ] +} diff --git a/libs/myutil/tsconfig.build.json b/apps/web/tsconfig.src.json similarity index 75% rename from libs/myutil/tsconfig.build.json rename to apps/web/tsconfig.src.json index 536507b..31f3daf 100644 --- a/libs/myutil/tsconfig.build.json +++ b/apps/web/tsconfig.src.json @@ -1,8 +1,8 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "declaration": true, - "types": ["node"] + "types": ["node"], + "declaration": true }, "include": ["src/**/*.ts"], "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"] diff --git a/libs/myutil/tsconfig.json b/libs/myutil/tsconfig.json index 0b64490..39e40d9 100644 --- a/libs/myutil/tsconfig.json +++ b/libs/myutil/tsconfig.json @@ -7,7 +7,10 @@ "include": [], "references": [ { - "path": "./tsconfig.build.json" + "path": "./tsconfig.root.json" + }, + { + "path": "./tsconfig.src.json" }, { "path": "./tsconfig.spec.json" diff --git a/libs/myutil/tsconfig.root.json b/libs/myutil/tsconfig.root.json new file mode 100644 index 0000000..67e963b --- /dev/null +++ b/libs/myutil/tsconfig.root.json @@ -0,0 +1,21 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true + }, + "include": [".*.cjs", "**/*.ts", "**/*.cts", "**/*.tsx", "**/*.js", "**/*.cjs", "**/*.jsx","**/*.vue"], + "exclude": [ + "src/**/*", + "vite.config.ts", + "vitest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.test.tsx", + "src/**/*.spec.tsx", + "src/**/*.test.js", + "src/**/*.spec.js", + "src/**/*.test.jsx", + "src/**/*.spec.jsx", + "src/**/*.d.ts" + ], +} diff --git a/apps/desktop/tsconfig.build.json b/libs/myutil/tsconfig.src.json similarity index 100% rename from apps/desktop/tsconfig.build.json rename to libs/myutil/tsconfig.src.json diff --git a/nx.js b/nx.js index f235c67..eb42f89 100644 --- a/nx.js +++ b/nx.js @@ -36,7 +36,7 @@ const config = { options: { clean: false, main: '{projectRoot}/src/index.ts', - tsConfig: '{projectRoot}/tsconfig.build.json', + tsConfig: '{projectRoot}/tsconfig.src.json', }, configurations: { ci: { @@ -111,7 +111,7 @@ const config = { executor: 'nx:run-commands', options: { cwd: '{projectRoot}', - command: 'FIX={args.fix}; eslint src --fix=${FIX:-false}', + command: 'FIX={args.fix}; eslint . --fix=${FIX:-false}', }, }, stylelint: { diff --git a/nx.json b/nx.json index 335cb93..f809893 100644 --- a/nx.json +++ b/nx.json @@ -37,7 +37,7 @@ "options": { "clean": false, "main": "{projectRoot}/src/index.ts", - "tsConfig": "{projectRoot}/tsconfig.build.json" + "tsConfig": "{projectRoot}/tsconfig.src.json" }, "configurations": { "ci": { @@ -164,4 +164,4 @@ ] } } -} \ No newline at end of file +}