From 7a99f8395ed0558f649fd5985ec42b2063b57b05 Mon Sep 17 00:00:00 2001 From: Maciej Piotr Balcerzak Date: Sun, 6 Sep 2026 18:27:27 +0200 Subject: [PATCH] perf: speed up monorepo linting and formatting --- .gitignore | 3 +++ apps/api/package.json | 4 ++-- apps/web/package.json | 8 ++++---- package.json | 4 +++- packages/config/eslint.config.mjs | 4 ++-- packages/config/package.json | 1 - .../copy-of-vitnode-app/monorepo/turbo.json | 4 +++- packages/create-vitnode-app/package.json | 4 ++-- .../create-vitnode-app/src/create/create-package-json.ts | 6 ++++-- .../src/plugin/create/create-package-json.ts | 4 ++-- packages/elasticsearch/package.json | 4 ++-- packages/node-cron/package.json | 4 ++-- packages/nodemailer/package.json | 4 ++-- packages/resend/package.json | 4 ++-- packages/s3/package.json | 4 ++-- packages/supabase-storage/package.json | 4 ++-- packages/vitnode/package.json | 4 ++-- plugins/blog/package.json | 4 ++-- plugins/example/package.json | 4 ++-- pnpm-lock.yaml | 3 --- turbo.json | 4 +++- 21 files changed, 46 insertions(+), 39 deletions(-) diff --git a/.gitignore b/.gitignore index 200767ba9..ee1a85408 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,6 @@ yarn-error.log* .vercel # next-agents-md .next-docs/ + +# Tool caches +.cache diff --git a/apps/api/package.json b/apps/api/package.json index 841a47e7e..ea7f0befb 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -12,8 +12,8 @@ "build": "tsc && tsc-alias -p tsconfig.json", "start": "node dist/src/index.js", "drizzle-kit": "drizzle-kit", - "lint": "eslint .", - "lint:fix": "eslint . --fix", + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", "i18n:create": "vitnode i18n:create", "i18n:check": "vitnode i18n:check", "i18n:delete": "vitnode i18n:delete", diff --git a/apps/web/package.json b/apps/web/package.json index e17ed5dfe..14034f826 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -10,12 +10,12 @@ "dev": "pnpm --filter api db:prepare && vite dev --port 3000", "build": "vite build", "preview": "vite preview", - "lint": "eslint .", - "format": "prettier --write . && eslint --fix", - "check": "prettier --check .", + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "format": "prettier --write . --cache --cache-location .cache/prettier && pnpm lint:fix", + "check": "prettier --check . --cache --cache-location .cache/prettier", "start": "node .output/server/index.mjs", "typecheck": "tsc --noEmit", - "lint:fix": "eslint . --fix", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", "docs:check": "node scripts/check-docs.mjs", "postinstall": "fumadocs-mdx" }, diff --git a/package.json b/package.json index 597f274b4..7f818eb1f 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,9 @@ "i18n:check": "turbo i18n:check", "i18n:delete": "turbo i18n:delete", "i18n:update": "turbo i18n:update", - "i18n:update:ai": "turbo i18n:update:ai" + "i18n:update:ai": "turbo i18n:update:ai", + "format": "prettier . --write --cache --cache-location .cache/prettier", + "format:check": "prettier . --check --cache --cache-location .cache/prettier" }, "devDependencies": { "@types/node": "^26.1.1", diff --git a/packages/config/eslint.config.mjs b/packages/config/eslint.config.mjs index b2210f0f9..825aeb06a 100644 --- a/packages/config/eslint.config.mjs +++ b/packages/config/eslint.config.mjs @@ -2,7 +2,7 @@ import eslint from "@eslint/js"; import perfectionist from "eslint-plugin-perfectionist"; -import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; +import eslintConfigPrettier from "eslint-config-prettier/flat"; import tsEslint from "typescript-eslint"; export default [ @@ -24,7 +24,6 @@ export default [ eslint.configs.recommended, ...tsEslint.configs.stylisticTypeChecked, ...tsEslint.configs.strictTypeChecked, - eslintPluginPrettierRecommended, perfectionist.configs["recommended-natural"], { files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"] }, { @@ -121,4 +120,5 @@ export default [ files: ["**/src/routes.ts", "**/src/routes.tsx"], rules: { "@typescript-eslint/promise-function-async": "off" }, }, + eslintConfigPrettier, ]; diff --git a/packages/config/package.json b/packages/config/package.json index 1ed9c0d3f..1c612864e 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -51,7 +51,6 @@ "eslint-config-prettier": "^10.1.8", "eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-perfectionist": "^5.10.0", - "eslint-plugin-prettier": "^5.5.6", "eslint-plugin-react-hooks": "^7.1.1", "eslint-plugin-react-you-might-not-need-an-effect": "^1.0.1", "prettier-plugin-tailwindcss": "^0.8.1", diff --git a/packages/create-vitnode-app/copy-of-vitnode-app/monorepo/turbo.json b/packages/create-vitnode-app/copy-of-vitnode-app/monorepo/turbo.json index c6fa3bcc8..0d156045e 100644 --- a/packages/create-vitnode-app/copy-of-vitnode-app/monorepo/turbo.json +++ b/packages/create-vitnode-app/copy-of-vitnode-app/monorepo/turbo.json @@ -29,9 +29,11 @@ "dependsOn": ["^start"] }, "lint": { - "dependsOn": ["^lint"] + "dependsOn": ["^lint"], + "outputs": [".cache/eslint/**"] }, "lint:fix": { + "cache": false, "dependsOn": ["^lint:fix"] }, "i18n:create": { diff --git a/packages/create-vitnode-app/package.json b/packages/create-vitnode-app/package.json index 1ed55aa7e..323e25ecb 100644 --- a/packages/create-vitnode-app/package.json +++ b/packages/create-vitnode-app/package.json @@ -24,8 +24,8 @@ "scripts": { "build:scripts": "tsc -p tsconfig.build.json && node dist/src/prepare/prepare.js", "start:scripts": "node dist/src/index.js", - "lint": "eslint .", - "lint:fix": "eslint . --fix", + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", "test": "vitest run", "test:watch": "vitest" }, diff --git a/packages/create-vitnode-app/src/create/create-package-json.ts b/packages/create-vitnode-app/src/create/create-package-json.ts index 927706834..10f9421dc 100644 --- a/packages/create-vitnode-app/src/create/create-package-json.ts +++ b/packages/create-vitnode-app/src/create/create-package-json.ts @@ -24,8 +24,8 @@ const paths = (root: string) => ({ * Shared blocks */ const eslintScripts = { - lint: "eslint .", - "lint:fix": "eslint . --fix", + lint: "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", }; const i18nScripts = { "i18n:create": "vitnode i18n:create", @@ -69,6 +69,8 @@ export const rootScripts = ( "i18n:update": "turbo i18n:update", "i18n:update:ai": "turbo i18n:update:ai", ...withIf(enableEslint, { + format: "prettier . --write --cache --cache-location .cache/prettier", + "format:check": "prettier . --check --cache --cache-location .cache/prettier", lint: "turbo lint", "lint:fix": "turbo lint:fix", }), diff --git a/packages/create-vitnode-app/src/plugin/create/create-package-json.ts b/packages/create-vitnode-app/src/plugin/create/create-package-json.ts index c4e2ca2ea..ebf5c9cd0 100644 --- a/packages/create-vitnode-app/src/plugin/create/create-package-json.ts +++ b/packages/create-vitnode-app/src/plugin/create/create-package-json.ts @@ -31,8 +31,8 @@ export const createPluginPackageJSON = async ({ dev: "vitnode dev", "dev:email": "email dev --dir src/emails", ...withIf(eslint, { - lint: "turbo lint", - "lint:fix": "turbo lint:fix", + lint: "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", }), }, exports: pluginPackageExports(), diff --git a/packages/elasticsearch/package.json b/packages/elasticsearch/package.json index 1f138a737..5e555f18e 100644 --- a/packages/elasticsearch/package.json +++ b/packages/elasticsearch/package.json @@ -26,8 +26,8 @@ "scripts": { "build:plugins": "vitnode build", "dev:plugins": "vitnode dev", - "lint": "eslint .", - "lint:fix": "eslint . --fix" + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto" }, "dependencies": { "@elastic/elasticsearch": "^9.4.2" diff --git a/packages/node-cron/package.json b/packages/node-cron/package.json index 13cf21ab1..8d9096ae1 100644 --- a/packages/node-cron/package.json +++ b/packages/node-cron/package.json @@ -27,8 +27,8 @@ "scripts": { "build:plugins": "vitnode build", "dev:plugins": "vitnode dev", - "lint": "eslint .", - "lint:fix": "eslint . --fix" + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto" }, "dependencies": { "node-cron": "^4.6.0" diff --git a/packages/nodemailer/package.json b/packages/nodemailer/package.json index 9870e022a..1931c9c17 100644 --- a/packages/nodemailer/package.json +++ b/packages/nodemailer/package.json @@ -26,8 +26,8 @@ "scripts": { "build:plugins": "vitnode build", "dev:plugins": "vitnode dev", - "lint": "eslint .", - "lint:fix": "eslint . --fix" + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto" }, "dependencies": { "nodemailer": "^9.0.3" diff --git a/packages/resend/package.json b/packages/resend/package.json index ed1a8ab91..21c651f76 100644 --- a/packages/resend/package.json +++ b/packages/resend/package.json @@ -25,8 +25,8 @@ "scripts": { "build:plugins": "vitnode build", "dev:plugins": "vitnode dev", - "lint": "eslint .", - "lint:fix": "eslint . --fix" + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto" }, "dependencies": { "resend": "^6.18.0" diff --git a/packages/s3/package.json b/packages/s3/package.json index 0e318bb58..9d15c2bf0 100644 --- a/packages/s3/package.json +++ b/packages/s3/package.json @@ -27,8 +27,8 @@ "scripts": { "build:plugins": "vitnode build", "dev:plugins": "vitnode dev", - "lint": "eslint .", - "lint:fix": "eslint . --fix" + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto" }, "dependencies": { "@aws-sdk/client-s3": "^3.1092.0" diff --git a/packages/supabase-storage/package.json b/packages/supabase-storage/package.json index 0fd0c1ced..823f1a20b 100644 --- a/packages/supabase-storage/package.json +++ b/packages/supabase-storage/package.json @@ -26,8 +26,8 @@ "scripts": { "build:plugins": "vitnode build", "dev:plugins": "vitnode dev", - "lint": "eslint .", - "lint:fix": "eslint . --fix" + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto" }, "dependencies": { "@supabase/storage-js": "^2.110.8" diff --git a/packages/vitnode/package.json b/packages/vitnode/package.json index 150fad327..63b990ea0 100644 --- a/packages/vitnode/package.json +++ b/packages/vitnode/package.json @@ -174,8 +174,8 @@ "test:watch": "vitest", "test:coverage": "vitest run --coverage", "test:types": "vitest run --typecheck.only", - "lint": "eslint .", - "lint:fix": "eslint . --fix" + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto" }, "type": "module", "dependencies": { diff --git a/plugins/blog/package.json b/plugins/blog/package.json index 832351af6..0de1c0214 100644 --- a/plugins/blog/package.json +++ b/plugins/blog/package.json @@ -30,8 +30,8 @@ "build:plugins": "vitnode build", "dev": "vitnode dev", "dev:email": "email dev --dir src/emails", - "lint": "eslint .", - "lint:fix": "eslint . --fix", + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", "test": "vitest run", "test:watch": "vitest", "test:types": "vitest run --typecheck.only" diff --git a/plugins/example/package.json b/plugins/example/package.json index 97a8e3621..7625ad851 100644 --- a/plugins/example/package.json +++ b/plugins/example/package.json @@ -16,8 +16,8 @@ "scripts": { "build:plugins": "vitnode build", "dev": "vitnode dev", - "lint": "eslint .", - "lint:fix": "eslint . --fix", + "lint": "eslint . --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", + "lint:fix": "eslint . --fix --cache --cache-location .cache/eslint --cache-strategy content --concurrency auto", "test": "vitest run", "test:watch": "vitest" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bfcf9a93e..a31abd5cf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -289,9 +289,6 @@ importers: eslint-plugin-perfectionist: specifier: ^5.10.0 version: 5.10.0(eslint@10.7.0(jiti@2.7.0))(typescript@6.0.3) - eslint-plugin-prettier: - specifier: ^5.5.6 - version: 5.5.6(eslint-config-prettier@10.1.8(eslint@10.7.0(jiti@2.7.0)))(eslint@10.7.0(jiti@2.7.0))(prettier@3.9.6) eslint-plugin-react-hooks: specifier: ^7.1.1 version: 7.1.1(eslint@10.7.0(jiti@2.7.0)) diff --git a/turbo.json b/turbo.json index f9282c34a..040c73142 100644 --- a/turbo.json +++ b/turbo.json @@ -59,9 +59,11 @@ "env": ["POSTGRES_URL", "NEXT_PUBLIC_API_URL", "NEXT_PUBLIC_WEB_URL"] }, "lint": { - "dependsOn": ["^lint"] + "dependsOn": ["^lint"], + "outputs": [".cache/eslint/**"] }, "lint:fix": { + "cache": false, "dependsOn": ["^lint:fix"] }, "start": {