Skip to content

Commit

Permalink
fix: Improve workspace tsconfig (#5497)
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed May 31, 2023
1 parent 163be78 commit c5d38bc
Show file tree
Hide file tree
Showing 51 changed files with 311 additions and 226 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ const config = {
],
env: {
browser: true,
es2020: true,
},
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.base.json',
project: './tsconfig.json',
sourceType: 'module',
ecmaVersion: 2020,
},
Expand Down
8 changes: 5 additions & 3 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"tasksRunnerOptions": {
"default": {
"runner": "nx-cloud",
Expand All @@ -13,6 +14,7 @@
"build:codemods",
"build:types"
],
"parallel": 5,
"accessToken": "ZDdkNDA4MGEtYjNmYi00MWI4LWE1N2QtYTdlNmYxMGJlZWM2fHJlYWQ="
}
}
Expand All @@ -29,8 +31,7 @@
"{workspaceRoot}/babel.config.js",
"{workspaceRoot}/package.json",
"{workspaceRoot}/scripts/getRollupConfig.mjs",
"{workspaceRoot}/tsconfig.json",
"{workspaceRoot}/tsconfig.base.json"
"{workspaceRoot}/tsconfig.json"
],
"globalNonBuildAffectingConfig": ["{workspaceRoot}/.eslintrc.cjs"],
"default": [
Expand All @@ -54,7 +55,8 @@
"inputs": ["default", "^public"]
},
"test:eslint": {
"inputs": ["default", "^public"]
"inputs": ["default", "^public"],
"dependsOn": ["^build"]
},
"test:types": {
"outputs": [
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
"preinstall": "node -e \"if(process.env.CI == 'true') {console.log('Skipping preinstall...'); process.exit(1)}\" || npx -y only-allow pnpm",
"install:csb": "corepack enable && pnpm install --frozen-lockfile",
"test": "pnpm run test:ci",
"test:ci": "nx affected --targets=test:format,test:lib,test:types,test:eslint --parallel=5",
"test:eslint": "nx affected --target=test:eslint --parallel=5",
"test:ci": "nx affected --targets=test:format,test:lib,test:types,test:eslint",
"test:eslint": "nx affected --target=test:eslint",
"test:format": "pnpm run prettier --check",
"test:lib": "nx affected --target=test:lib --parallel=5",
"test:lib": "nx affected --target=test:lib",
"test:lib:dev": "pnpm --filter \"./packages/**\" run test:lib:dev",
"test:build": "nx run-many --target=test:build --projects=root",
"test:types": "nx affected --target=test:types --parallel=5",
"build": "nx run-many --target=build --projects=root --parallel=5",
"test:types": "nx affected --target=test:types",
"build": "nx run-many --target=build --projects=root",
"watch": "concurrently --kill-others \"pnpm -r build:rollup -w\" \"pnpm -r build:types --watch\"",
"dev": "pnpm run watch",
"prettier": "prettier --plugin-search-dir . \"{packages,examples,scripts}/**/*.{md,js,jsx,cjs,mjs,ts,tsx,json,vue,svelte}\"",
Expand Down Expand Up @@ -79,7 +79,7 @@
"publint": "^0.1.12",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^4.1.2",
"rimraf": "^5.0.1",
"rollup": "^3.23.0",
"rollup-plugin-preserve-directives": "^0.2.0",
"rollup-plugin-size": "^0.3.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/codemods/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"rootDir": "./src",
"outDir": "./build/lib",
"rootDir": "./src",
"tsBuildInfoFile": "./build/.tsbuildinfo"
},
"include": ["src"]
Expand Down
1 change: 1 addition & 0 deletions packages/codemods/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
name: 'codemods',
dir: './src',
watch: false,
globals: true,
coverage: { provider: 'istanbul' },
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"./package.json": "./package.json"
},
"scripts": {
"clean": "rimraf ./build",
"clean": "rimraf ./build && rimraf ./coverage",
"dev": "tsup --watch --sourcemap",
"test:eslint": "eslint --ext .ts,.tsx ./src",
"test:types": "tsc",
"test:types": "tsc --emitDeclarationOnly",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "tsup --minify"
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-plugin-query/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"rootDir": "./src",
"outDir": "./build/lib",
"rootDir": "./src",
"tsBuildInfoFile": "./build/.tsbuildinfo",
"types": ["vitest/globals"]
},
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin-query/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
name: 'eslint-plugin-query',
dir: './src',
watch: false,
globals: true,
coverage: { provider: 'istanbul' },
Expand Down
8 changes: 4 additions & 4 deletions packages/query-async-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
"src"
],
"scripts": {
"clean": "rimraf ./build",
"clean": "rimraf ./build && rimraf ./coverage",
"test:eslint": "eslint --ext .ts,.tsx ./src",
"test:types": "tsc",
"test:types": "pnpm build:types",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
"build:types": "tsc --emitDeclarationOnly"
},
"dependencies": {
"@tanstack/query-persist-client-core": "workspace:*"
"@tanstack/query-persist-client-core": "^5.0.0-alpha.43"
}
}
7 changes: 3 additions & 4 deletions packages/query-async-storage-persister/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"rootDir": "./src",
"outDir": "./build/lib",
"rootDir": "./src",
"tsBuildInfoFile": "./build/.tsbuildinfo",
"types": ["vitest/globals"]
},
"include": ["src"],
"references": [{ "path": "../query-persist-client-core" }]
"include": ["src"]
}
1 change: 1 addition & 0 deletions packages/query-async-storage-persister/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
name: 'query-async-storage-persister',
dir: './src',
watch: false,
globals: true,
coverage: { provider: 'istanbul' },
Expand Down
8 changes: 4 additions & 4 deletions packages/query-broadcast-client-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
"src"
],
"scripts": {
"clean": "rimraf ./build",
"clean": "rimraf ./build && rimraf ./coverage",
"test:eslint": "eslint --ext .ts,.tsx ./src",
"test:types": "tsc",
"test:types": "pnpm build:types",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
"build:types": "tsc --emitDeclarationOnly"
},
"dependencies": {
"@tanstack/query-core": "workspace:*",
"@tanstack/query-core": "^5.0.0-alpha.43",
"broadcast-channel": "^5.1.0"
}
}
7 changes: 3 additions & 4 deletions packages/query-broadcast-client-experimental/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"rootDir": "./src",
"outDir": "./build/lib",
"rootDir": "./src",
"tsBuildInfoFile": "./build/.tsbuildinfo"
},
"include": ["src"],
"references": [{ "path": "../query-core" }]
"include": ["src"]
}
6 changes: 3 additions & 3 deletions packages/query-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"src"
],
"scripts": {
"clean": "rimraf ./build",
"clean": "rimraf ./build && rimraf ./coverage",
"test:eslint": "eslint --ext .ts,.tsx ./src",
"test:types": "tsc",
"test:types": "pnpm build:types",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
"build:types": "tsc --emitDeclarationOnly"
}
}
4 changes: 2 additions & 2 deletions packages/query-core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"rootDir": "./src",
"outDir": "./build/lib",
"rootDir": "./src",
"tsBuildInfoFile": "./build/.tsbuildinfo",
"types": ["vitest/globals"]
},
Expand Down
1 change: 1 addition & 0 deletions packages/query-core/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
name: 'query-core',
dir: './src',
watch: false,
environment: 'jsdom',
globals: true,
Expand Down
10 changes: 5 additions & 5 deletions packages/query-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"./package.json": "./package.json"
},
"scripts": {
"clean": "rimraf ./build",
"clean": "rimraf ./build && rimraf ./coverage",
"test:eslint": "eslint --ext .ts,.tsx ./src",
"test:types": "tsc",
"test:types": "pnpm build:types",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
"build:types": "tsc"
},
"files": [
"build",
Expand All @@ -47,11 +47,11 @@
"superjson": "^1.12.1"
},
"devDependencies": {
"@tanstack/query-core": "workspace:*",
"@tanstack/query-core": "^5.0.0-alpha.43",
"vite-plugin-solid": "^2.5.0"
},
"peerDependencies": {
"@tanstack/query-core": "workspace:*"
"@tanstack/query-core": "^5.0.0-alpha.43"
},
"peerDependenciesMeta": {}
}
13 changes: 5 additions & 8 deletions packages/query-devtools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"rootDir": "./src",
"outDir": "./build/source",
"declarationDir": "./build/types",
"tsBuildInfoFile": "./build/.tsbuildinfo",
"jsx": "preserve",
"jsxImportSource": "solid-js",
"emitDeclarationOnly": false,
"outDir": "./build/source",
"rootDir": "./src",
"tsBuildInfoFile": "./build/.tsbuildinfo",
"types": ["vitest/globals"]
},
"include": ["src"],
"exclude": ["node_modules", "build"],
"references": [{ "path": "../query-core" }]
"include": ["src"]
}
2 changes: 1 addition & 1 deletion packages/query-devtools/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
name: 'solid-query',
dir: './src',
watch: false,
setupFiles: [],
environment: 'jsdom',
globals: true,
dir: 'src/__tests__',
coverage: { provider: 'istanbul' },
},
resolve: {
Expand Down
8 changes: 4 additions & 4 deletions packages/query-persist-client-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
"src"
],
"scripts": {
"clean": "rimraf ./build",
"clean": "rimraf ./build && rimraf ./coverage",
"test:eslint": "eslint --ext .ts,.tsx ./src",
"test:types": "tsc",
"test:types": "pnpm build:types",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
"build:types": "tsc --emitDeclarationOnly"
},
"dependencies": {
"@tanstack/query-core": "workspace:*"
"@tanstack/query-core": "^5.0.0-alpha.43"
}
}
5 changes: 1 addition & 4 deletions packages/query-persist-client-core/src/__tests__/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import type { QueryClientConfig } from '@tanstack/query-core'
import { QueryClient } from '@tanstack/query-core'
import type {
Persister,
PersistedClient,
} from '@tanstack/query-persist-client-core'
import type { Persister, PersistedClient } from '../persist'
import { vi } from 'vitest'

export function createQueryClient(config?: QueryClientConfig): QueryClient {
Expand Down
2 changes: 1 addition & 1 deletion packages/query-persist-client-core/src/retryStrategies.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PersistedClient } from '@tanstack/query-persist-client-core'
import type { PersistedClient } from './persist'

export type PersistRetryer = (props: {
persistedClient: PersistedClient
Expand Down
7 changes: 3 additions & 4 deletions packages/query-persist-client-core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"rootDir": "./src",
"outDir": "./build/lib",
"rootDir": "./src",
"tsBuildInfoFile": "./build/.tsbuildinfo",
"types": ["vitest/globals"]
},
"include": ["src"],
"references": [{ "path": "../query-core" }]
"include": ["src"]
}
1 change: 1 addition & 0 deletions packages/query-persist-client-core/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
name: 'query-persist-client-core',
dir: './src',
watch: false,
globals: true,
coverage: { provider: 'istanbul' },
Expand Down
9 changes: 5 additions & 4 deletions packages/query-sync-storage-persister/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@
"src"
],
"scripts": {
"clean": "rimraf ./build",
"clean": "rimraf ./build && rimraf ./coverage",
"test:eslint": "eslint --ext .ts,.tsx ./src",
"test:types": "tsc",
"test:types": "pnpm build:types",
"test:lib": "vitest run --coverage",
"test:lib:dev": "pnpm run test:lib --watch",
"build": "pnpm build:rollup && pnpm build:types",
"build:rollup": "rollup --config rollup.config.mjs",
"build:types": "tsc --build"
"build:types": "tsc --emitDeclarationOnly"
},
"dependencies": {
"@tanstack/query-persist-client-core": "workspace:*"
"@tanstack/query-core": "^5.0.0-alpha.43",
"@tanstack/query-persist-client-core": "^5.0.0-alpha.43"
}
}

0 comments on commit c5d38bc

Please sign in to comment.