From fd647002f5ede65410808957e066c86b2b8e94b8 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 5 Feb 2026 14:31:12 +0100 Subject: [PATCH] [monorepo] enable caching for eslint and prettier (#30967) * [monorepo] enable caching for eslint/prettier/stylelint * [monorepo] speed up prettier by swapping --list-different for --check --list-different will print each file that it processes. We have a lot of files in the monorepo. Using --check only prints mismatching files. Co-authored-by: Rebeka * [monorepo] explicitly configure prettier cache-location This is the default location. Prettier will only discover that location if the top level node_modules folder is writable, which is not the case in CI. We create the .cache folder outside of docker, writable to node inside docker. The proper fix would be in prettier, to only check for write access in the cache folder. Something to raise/upstream another day. * [monorepo] run top-level format/format_fix in a single container With the cache in place, it is much faster to use a single container. As there is a single shared cache file, concurrent processes may see a partially (re-)written cache file and bail out. - all in a single container: 24s - previous with -j4: 41s - previous with -j8: failed due to corrupted cache file --------- Co-authored-by: Rebeka GitOrigin-RevId: 7850a3a980ae6c836393d97fe56a6316ffc3fa18 --- libraries/access-token-encryptor/package.json | 4 +-- libraries/fetch-utils/package.json | 4 +-- libraries/logger/package.json | 4 +-- libraries/metrics/package.json | 4 +-- libraries/mongo-utils/package.json | 4 +-- libraries/o-error/package.json | 4 +-- libraries/object-persistor/package.json | 4 +-- libraries/overleaf-editor-core/package.json | 4 +-- libraries/promise-utils/package.json | 4 +-- libraries/ranges-tracker/package.json | 4 +-- libraries/redis-wrapper/package.json | 4 +-- libraries/settings/package.json | 4 +-- libraries/stream-utils/package.json | 4 +-- libraries/validation-tools/package.json | 4 +-- package.json | 20 ++++++------ server-ce/test/package.json | 4 +-- services/chat/Makefile | 26 +++++++++++++--- services/chat/package.json | 4 +-- services/clsi/Makefile | 26 +++++++++++++--- services/clsi/package.json | 4 +-- services/contacts/Makefile | 26 +++++++++++++--- services/contacts/package.json | 4 +-- services/docstore/Makefile | 26 +++++++++++++--- services/docstore/package.json | 4 +-- services/document-updater/Makefile | 26 +++++++++++++--- services/document-updater/package.json | 4 +-- services/filestore/Makefile | 26 +++++++++++++--- services/filestore/package.json | 4 +-- services/history-v1/Makefile | 26 +++++++++++++--- services/history-v1/package.json | 4 +-- services/notifications/Makefile | 26 +++++++++++++--- services/notifications/package.json | 4 +-- services/project-history/Makefile | 26 +++++++++++++--- services/project-history/package.json | 4 +-- services/real-time/Makefile | 26 +++++++++++++--- services/real-time/package.json | 4 +-- services/web/Makefile | 31 +++++++++++++++++-- services/web/package.json | 8 ++--- tools/migrations/package.json | 4 +-- 39 files changed, 315 insertions(+), 108 deletions(-) diff --git a/libraries/access-token-encryptor/package.json b/libraries/access-token-encryptor/package.json index 8589ce6136..f16ee9982e 100644 --- a/libraries/access-token-encryptor/package.json +++ b/libraries/access-token-encryptor/package.json @@ -5,8 +5,8 @@ "main": "index.js", "scripts": { "test": "npm run lint && npm run types:check && npm run test:unit", - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "types:check": "tsc --noEmit" diff --git a/libraries/fetch-utils/package.json b/libraries/fetch-utils/package.json index 22f9ac81d0..252c036e8b 100644 --- a/libraries/fetch-utils/package.json +++ b/libraries/fetch-utils/package.json @@ -5,8 +5,8 @@ "main": "index.js", "scripts": { "test": "npm run lint && npm run types:check && npm run test:unit", - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "types:check": "tsc --noEmit" diff --git a/libraries/logger/package.json b/libraries/logger/package.json index d600db7a44..ef7180e0b3 100644 --- a/libraries/logger/package.json +++ b/libraries/logger/package.json @@ -11,8 +11,8 @@ "version": "3.1.1", "scripts": { "test": "npm run lint && npm run types:check && npm run test:unit", - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "types:check": "tsc --noEmit" diff --git a/libraries/metrics/package.json b/libraries/metrics/package.json index 28d0e24f0f..fe0dbb04a0 100644 --- a/libraries/metrics/package.json +++ b/libraries/metrics/package.json @@ -31,8 +31,8 @@ "typescript": "^5.0.4" }, "scripts": { - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:unit": "mocha --exit test/**/*.{js,cjs}", "test:acceptance": "mocha --recursive --exit --grep=$MOCHA_GREP test/acceptance", "test": "npm run lint && npm run types:check && npm run test:unit", diff --git a/libraries/mongo-utils/package.json b/libraries/mongo-utils/package.json index 642f835dd9..0284879b9a 100644 --- a/libraries/mongo-utils/package.json +++ b/libraries/mongo-utils/package.json @@ -6,8 +6,8 @@ "scripts": { "test": "npm run lint && npm run types:check && npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", "types:check": "tsc --noEmit" }, diff --git a/libraries/o-error/package.json b/libraries/o-error/package.json index 1eef934afb..c250f6430e 100644 --- a/libraries/o-error/package.json +++ b/libraries/o-error/package.json @@ -18,8 +18,8 @@ ], "scripts": { "build": "npm run --silent test", - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test": "npm run lint && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", diff --git a/libraries/object-persistor/package.json b/libraries/object-persistor/package.json index cacc2f034d..13128219d0 100644 --- a/libraries/object-persistor/package.json +++ b/libraries/object-persistor/package.json @@ -6,8 +6,8 @@ "scripts": { "test": "npm run lint && npm run types:check && npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", "types:check": "tsc --noEmit" }, diff --git a/libraries/overleaf-editor-core/package.json b/libraries/overleaf-editor-core/package.json index cfae70d3f1..72569e23fb 100644 --- a/libraries/overleaf-editor-core/package.json +++ b/libraries/overleaf-editor-core/package.json @@ -5,8 +5,8 @@ "main": "index.js", "scripts": { "test": "npm run lint && npm run types:check && npm run test:unit", - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", "types:check": "tsc --noEmit" diff --git a/libraries/promise-utils/package.json b/libraries/promise-utils/package.json index e1286de130..fcd5a59a39 100644 --- a/libraries/promise-utils/package.json +++ b/libraries/promise-utils/package.json @@ -6,8 +6,8 @@ "scripts": { "test": "npm run lint && npm run types:check && npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", "types:check": "tsc --noEmit" }, diff --git a/libraries/ranges-tracker/package.json b/libraries/ranges-tracker/package.json index 0d67387cf0..23d7b8dae1 100644 --- a/libraries/ranges-tracker/package.json +++ b/libraries/ranges-tracker/package.json @@ -9,8 +9,8 @@ "author": "Overleaf (https://www.overleaf.com)", "private": true, "scripts": { - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test": "npm run lint && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", diff --git a/libraries/redis-wrapper/package.json b/libraries/redis-wrapper/package.json index d45c46ae23..93aee0b1f9 100644 --- a/libraries/redis-wrapper/package.json +++ b/libraries/redis-wrapper/package.json @@ -13,8 +13,8 @@ "repository": "github:overleaf/redis-wrapper", "license": "ISC", "scripts": { - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test": "npm run lint && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", diff --git a/libraries/settings/package.json b/libraries/settings/package.json index f21a32c313..d17325df3a 100644 --- a/libraries/settings/package.json +++ b/libraries/settings/package.json @@ -5,8 +5,8 @@ "repository": "overleaf/settings-module", "main": "index.js", "scripts": { - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test": "npm run lint && npm run types:check && npm run test:unit", "test:ci": "npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", diff --git a/libraries/stream-utils/package.json b/libraries/stream-utils/package.json index 7a4437e198..c87c131561 100644 --- a/libraries/stream-utils/package.json +++ b/libraries/stream-utils/package.json @@ -6,8 +6,8 @@ "scripts": { "test": "npm run lint && npm run types:check && npm run test:unit", "test:unit": "mocha --exit test/**/*.{js,cjs}", - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", "types:check": "tsc --noEmit" }, diff --git a/libraries/validation-tools/package.json b/libraries/validation-tools/package.json index 15906a84d7..afa55cc076 100644 --- a/libraries/validation-tools/package.json +++ b/libraries/validation-tools/package.json @@ -11,8 +11,8 @@ "version": "1.0.0", "scripts": { "test": "npm run lint && npm run types:check && npm run test:unit", - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts .", "test:ci": "npm run test:unit", "test:unit": "vitest --config vitest.config.ts", "types:check": "tsc --noEmit" diff --git a/package.json b/package.json index 025177595f..256646086f 100644 --- a/package.json +++ b/package.json @@ -42,16 +42,16 @@ } }, "scripts": { - "format": "prettier --list-different", - "format:fix": "prettier --write --list-different", - "format:styles": "prettier --list-different '**/*.{css,scss}'", - "format:styles:fix": "prettier --write --list-different '**/*.{css,scss}'", - "format:pug": "prettier --list-different '**/*.pug'", - "format:pug:fix": "prettier --write --list-different '**/*.pug'", - "format:jenkins": "prettier --list-different '**/Jenkinsfile'", - "format:jenkins:fix": "prettier --write --list-different '**/Jenkinsfile'", - "lint": "eslint --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix .", + "format": "prettier --cache --cache-location ./node_modules/.cache/prettier/.prettier-cache --check", + "format:fix": "prettier --cache --cache-location ./node_modules/.cache/prettier/.prettier-cache --write --check", + "format:styles": "prettier --cache --cache-location ./node_modules/.cache/prettier/.prettier-cache --check '**/*.{css,scss}'", + "format:styles:fix": "prettier --cache --cache-location ./node_modules/.cache/prettier/.prettier-cache --write --check '**/*.{css,scss}'", + "format:pug": "prettier --cache --cache-location ./node_modules/.cache/prettier/.prettier-cache --check '**/*.pug'", + "format:pug:fix": "prettier --cache --cache-location ./node_modules/.cache/prettier/.prettier-cache --write --check '**/*.pug'", + "format:jenkins": "prettier --cache --cache-location ./node_modules/.cache/prettier/.prettier-cache --check '**/Jenkinsfile'", + "format:jenkins:fix": "prettier --cache --cache-location ./node_modules/.cache/prettier/.prettier-cache --write --check '**/Jenkinsfile'", + "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint/ --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ./node_modules/.cache/eslint/ --fix .", "postinstall": "patch-package" }, "workspaces": [ diff --git a/server-ce/test/package.json b/server-ce/test/package.json index fc8b907fcc..8b5df8b839 100644 --- a/server-ce/test/package.json +++ b/server-ce/test/package.json @@ -6,8 +6,8 @@ "scripts": { "cypress:open": "cypress open --e2e --browser chrome", "cypress:run": "cypress run --e2e --browser chrome", - "lint": "eslint --max-warnings 0 --format unix --ext .js,.jsx,.mjs,.ts,.tsx .", - "lint:fix": "eslint --fix --ext .js,.jsx,.mjs,.ts,.tsx ." + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix --ext .js,.jsx,.mjs,.ts,.tsx .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .js,.jsx,.mjs,.ts,.tsx ." }, "devDependencies": { "@isomorphic-git/lightning-fs": "^4.6.0", diff --git a/services/chat/Makefile b/services/chat/Makefile index debd91a181..353c26f0b0 100644 --- a/services/chat/Makefile +++ b/services/chat/Makefile @@ -51,11 +51,11 @@ clean: # Run the linting commands in the scope of the monorepo. # Eslint and prettier (plus some configs) are on the root. -RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:24.13.0 npm run --silent -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 npm run --silent +RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) --user node node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) --user node node:24.13.0 npm run --silent -RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/chat/reports:/overleaf/services/chat/reports $(IMAGE_CI) npm run --silent -RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/chat/reports:/overleaf/services/chat/reports -w /overleaf $(IMAGE_CI) npm run --silent +RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/chat/reports:/overleaf/services/chat/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) npm run --silent +RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/chat/reports:/overleaf/services/chat/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -75,6 +75,24 @@ shellcheck_fix: else echo "\033[2m$$file\033[0m"; fi \ done +WITH_CACHE_FOLDER = \ + lint \ + lint_ci \ + lint_fix \ + format \ + format_ci \ + format_fix \ + typecheck \ + typecheck_ci \ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/ +../../node_modules/.cache/prettier/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/ +../../node_modules/.cache/eslint/: + mkdir -p $@ + format: $(RUN_LINTING_MONOREPO) format -- services/chat diff --git a/services/chat/package.json b/services/chat/package.json index 262215bf8c..e8d7a3e58d 100644 --- a/services/chat/package.json +++ b/services/chat/package.json @@ -11,8 +11,8 @@ "nodemon": "node --watch app.js", "test:acceptance:_run": "mocha --recursive --timeout 15000 --exit $@ test/acceptance/js", "test:unit:_run": "mocha --recursive --exit $@ test/unit/js", - "lint": "eslint --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix .", "types:check": "tsc --noEmit" }, "dependencies": { diff --git a/services/clsi/Makefile b/services/clsi/Makefile index 62121851e2..202ec397c3 100644 --- a/services/clsi/Makefile +++ b/services/clsi/Makefile @@ -51,11 +51,11 @@ clean: # Run the linting commands in the scope of the monorepo. # Eslint and prettier (plus some configs) are on the root. -RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:24.13.0 npm run --silent -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 npm run --silent +RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) --user node node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) --user node node:24.13.0 npm run --silent -RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/clsi/reports:/overleaf/services/clsi/reports $(IMAGE_CI) npm run --silent -RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/clsi/reports:/overleaf/services/clsi/reports -w /overleaf $(IMAGE_CI) npm run --silent +RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/clsi/reports:/overleaf/services/clsi/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) npm run --silent +RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/clsi/reports:/overleaf/services/clsi/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -75,6 +75,24 @@ shellcheck_fix: else echo "\033[2m$$file\033[0m"; fi \ done +WITH_CACHE_FOLDER = \ + lint \ + lint_ci \ + lint_fix \ + format \ + format_ci \ + format_fix \ + typecheck \ + typecheck_ci \ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/ +../../node_modules/.cache/prettier/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/ +../../node_modules/.cache/eslint/: + mkdir -p $@ + format: $(RUN_LINTING_MONOREPO) format -- services/clsi diff --git a/services/clsi/package.json b/services/clsi/package.json index 3f1868ec8e..06d7062786 100644 --- a/services/clsi/package.json +++ b/services/clsi/package.json @@ -11,8 +11,8 @@ "test:unit:_run": "vitest --config ./vitest.config.unit.cjs", "test:unit": "npm run test:unit:_run", "nodemon": "node --watch app.js", - "lint": "eslint --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix .", "types:check": "tsc --noEmit" }, "dependencies": { diff --git a/services/contacts/Makefile b/services/contacts/Makefile index 2dc973da52..cdffce25c4 100644 --- a/services/contacts/Makefile +++ b/services/contacts/Makefile @@ -51,11 +51,11 @@ clean: # Run the linting commands in the scope of the monorepo. # Eslint and prettier (plus some configs) are on the root. -RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:24.13.0 npm run --silent -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 npm run --silent +RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) --user node node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) --user node node:24.13.0 npm run --silent -RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/contacts/reports:/overleaf/services/contacts/reports $(IMAGE_CI) npm run --silent -RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/contacts/reports:/overleaf/services/contacts/reports -w /overleaf $(IMAGE_CI) npm run --silent +RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/contacts/reports:/overleaf/services/contacts/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) npm run --silent +RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/contacts/reports:/overleaf/services/contacts/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -75,6 +75,24 @@ shellcheck_fix: else echo "\033[2m$$file\033[0m"; fi \ done +WITH_CACHE_FOLDER = \ + lint \ + lint_ci \ + lint_fix \ + format \ + format_ci \ + format_fix \ + typecheck \ + typecheck_ci \ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/ +../../node_modules/.cache/prettier/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/ +../../node_modules/.cache/eslint/: + mkdir -p $@ + format: $(RUN_LINTING_MONOREPO) format -- services/contacts diff --git a/services/contacts/package.json b/services/contacts/package.json index 89da0dae5d..39f62e3f0b 100644 --- a/services/contacts/package.json +++ b/services/contacts/package.json @@ -11,8 +11,8 @@ "test:unit:_run": "mocha --loader=esmock --recursive --exit $@ test/unit/js", "test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP", "nodemon": "node --watch app.js", - "lint": "eslint --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix .", "types:check": "tsc --noEmit" }, "dependencies": { diff --git a/services/docstore/Makefile b/services/docstore/Makefile index f17c779aad..fe978193f5 100644 --- a/services/docstore/Makefile +++ b/services/docstore/Makefile @@ -53,11 +53,11 @@ clean: # Run the linting commands in the scope of the monorepo. # Eslint and prettier (plus some configs) are on the root. -RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:24.13.0 npm run --silent -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 npm run --silent +RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) --user node node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) --user node node:24.13.0 npm run --silent -RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/docstore/reports:/overleaf/services/docstore/reports $(IMAGE_CI) npm run --silent -RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/docstore/reports:/overleaf/services/docstore/reports -w /overleaf $(IMAGE_CI) npm run --silent +RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/docstore/reports:/overleaf/services/docstore/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) npm run --silent +RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/docstore/reports:/overleaf/services/docstore/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -77,6 +77,24 @@ shellcheck_fix: else echo "\033[2m$$file\033[0m"; fi \ done +WITH_CACHE_FOLDER = \ + lint \ + lint_ci \ + lint_fix \ + format \ + format_ci \ + format_fix \ + typecheck \ + typecheck_ci \ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/ +../../node_modules/.cache/prettier/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/ +../../node_modules/.cache/eslint/: + mkdir -p $@ + format: $(RUN_LINTING_MONOREPO) format -- services/docstore diff --git a/services/docstore/package.json b/services/docstore/package.json index 5b11ef3941..039c1f1e3e 100644 --- a/services/docstore/package.json +++ b/services/docstore/package.json @@ -11,8 +11,8 @@ "test:unit:_run": "vitest --config ./vitest.config.unit.cjs", "test:unit": "npm run test:unit:_run", "nodemon": "node --watch app.js", - "lint": "eslint --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix .", "types:check": "tsc --noEmit" }, "dependencies": { diff --git a/services/document-updater/Makefile b/services/document-updater/Makefile index 3607a2825c..380a335313 100644 --- a/services/document-updater/Makefile +++ b/services/document-updater/Makefile @@ -54,11 +54,11 @@ clean: # Run the linting commands in the scope of the monorepo. # Eslint and prettier (plus some configs) are on the root. -RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:24.13.0 npm run --silent -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 npm run --silent +RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) --user node node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) --user node node:24.13.0 npm run --silent -RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/document-updater/reports:/overleaf/services/document-updater/reports $(IMAGE_CI) npm run --silent -RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/document-updater/reports:/overleaf/services/document-updater/reports -w /overleaf $(IMAGE_CI) npm run --silent +RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/document-updater/reports:/overleaf/services/document-updater/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) npm run --silent +RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/document-updater/reports:/overleaf/services/document-updater/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -78,6 +78,24 @@ shellcheck_fix: else echo "\033[2m$$file\033[0m"; fi \ done +WITH_CACHE_FOLDER = \ + lint \ + lint_ci \ + lint_fix \ + format \ + format_ci \ + format_fix \ + typecheck \ + typecheck_ci \ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/ +../../node_modules/.cache/prettier/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/ +../../node_modules/.cache/eslint/: + mkdir -p $@ + format: $(RUN_LINTING_MONOREPO) format -- services/document-updater diff --git a/services/document-updater/package.json b/services/document-updater/package.json index f68e43a576..c0c4cf4864 100644 --- a/services/document-updater/package.json +++ b/services/document-updater/package.json @@ -11,8 +11,8 @@ "test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP", "nodemon": "node --watch app.js", "benchmark:apply": "node benchmarks/apply", - "lint": "eslint --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix .", "types:check": "tsc --noEmit" }, "dependencies": { diff --git a/services/filestore/Makefile b/services/filestore/Makefile index b6f79ecd40..4f289f70e6 100644 --- a/services/filestore/Makefile +++ b/services/filestore/Makefile @@ -51,11 +51,11 @@ clean: # Run the linting commands in the scope of the monorepo. # Eslint and prettier (plus some configs) are on the root. -RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:24.13.0 npm run --silent -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 npm run --silent +RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) --user node node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) --user node node:24.13.0 npm run --silent -RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/filestore/reports:/overleaf/services/filestore/reports $(IMAGE_CI) npm run --silent -RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/filestore/reports:/overleaf/services/filestore/reports -w /overleaf $(IMAGE_CI) npm run --silent +RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/filestore/reports:/overleaf/services/filestore/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) npm run --silent +RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/filestore/reports:/overleaf/services/filestore/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -75,6 +75,24 @@ shellcheck_fix: else echo "\033[2m$$file\033[0m"; fi \ done +WITH_CACHE_FOLDER = \ + lint \ + lint_ci \ + lint_fix \ + format \ + format_ci \ + format_fix \ + typecheck \ + typecheck_ci \ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/ +../../node_modules/.cache/prettier/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/ +../../node_modules/.cache/eslint/: + mkdir -p $@ + format: $(RUN_LINTING_MONOREPO) format -- services/filestore diff --git a/services/filestore/package.json b/services/filestore/package.json index 0e825c5254..eb3cde83cd 100644 --- a/services/filestore/package.json +++ b/services/filestore/package.json @@ -11,10 +11,10 @@ "test:unit": "npm run test:unit:_run", "start": "node app.js", "nodemon": "node --watch app.js", - "lint": "eslint --max-warnings 0 --format unix .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .", "test:acceptance:_run": "mocha --recursive --timeout 15000 --exit $@ test/acceptance/js", "test:unit:_run": "vitest --config ./vitest.config.unit.cjs", - "lint:fix": "eslint --fix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix .", "types:check": "tsc --noEmit" }, "dependencies": { diff --git a/services/history-v1/Makefile b/services/history-v1/Makefile index 3690119cf2..4ea994b715 100644 --- a/services/history-v1/Makefile +++ b/services/history-v1/Makefile @@ -56,11 +56,11 @@ clean: # Run the linting commands in the scope of the monorepo. # Eslint and prettier (plus some configs) are on the root. -RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:24.13.0 npm run --silent -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 npm run --silent +RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) --user node node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) --user node node:24.13.0 npm run --silent -RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/history-v1/reports:/overleaf/services/history-v1/reports $(IMAGE_CI) npm run --silent -RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/history-v1/reports:/overleaf/services/history-v1/reports -w /overleaf $(IMAGE_CI) npm run --silent +RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/history-v1/reports:/overleaf/services/history-v1/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) npm run --silent +RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/history-v1/reports:/overleaf/services/history-v1/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -80,6 +80,24 @@ shellcheck_fix: else echo "\033[2m$$file\033[0m"; fi \ done +WITH_CACHE_FOLDER = \ + lint \ + lint_ci \ + lint_fix \ + format \ + format_ci \ + format_fix \ + typecheck \ + typecheck_ci \ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/ +../../node_modules/.cache/prettier/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/ +../../node_modules/.cache/eslint/: + mkdir -p $@ + format: $(RUN_LINTING_MONOREPO) format -- services/history-v1 diff --git a/services/history-v1/package.json b/services/history-v1/package.json index 24809d1efb..7295652d01 100644 --- a/services/history-v1/package.json +++ b/services/history-v1/package.json @@ -62,8 +62,8 @@ }, "scripts": { "start": "node app.js", - "lint": "eslint --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix .", "test:unit": "npm run test:unit:_run -- --grep=$MOCHA_GREP", "test:acceptance": "npm run test:acceptance:_run -- --grep=$MOCHA_GREP", "test:unit:_run": "mocha --recursive --exit $@ test/unit/js", diff --git a/services/notifications/Makefile b/services/notifications/Makefile index 6a55407276..1aa8b898f2 100644 --- a/services/notifications/Makefile +++ b/services/notifications/Makefile @@ -52,11 +52,11 @@ clean: # Run the linting commands in the scope of the monorepo. # Eslint and prettier (plus some configs) are on the root. -RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:24.13.0 npm run --silent -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 npm run --silent +RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) --user node node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) --user node node:24.13.0 npm run --silent -RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/notifications/reports:/overleaf/services/notifications/reports $(IMAGE_CI) npm run --silent -RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/notifications/reports:/overleaf/services/notifications/reports -w /overleaf $(IMAGE_CI) npm run --silent +RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/notifications/reports:/overleaf/services/notifications/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) npm run --silent +RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/notifications/reports:/overleaf/services/notifications/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -76,6 +76,24 @@ shellcheck_fix: else echo "\033[2m$$file\033[0m"; fi \ done +WITH_CACHE_FOLDER = \ + lint \ + lint_ci \ + lint_fix \ + format \ + format_ci \ + format_fix \ + typecheck \ + typecheck_ci \ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/ +../../node_modules/.cache/prettier/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/ +../../node_modules/.cache/eslint/: + mkdir -p $@ + format: $(RUN_LINTING_MONOREPO) format -- services/notifications diff --git a/services/notifications/package.json b/services/notifications/package.json index 61e4f06775..2f950496b6 100644 --- a/services/notifications/package.json +++ b/services/notifications/package.json @@ -10,8 +10,8 @@ "test:acceptance": "npm run test:acceptance:_run", "test:unit:_run": "vitest --config ./vitest.config.unit.cjs", "test:unit": "npm run test:unit:_run", - "lint": "eslint --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix .", "types:check": "tsc --noEmit", "nodemon": "node --watch app.ts" }, diff --git a/services/project-history/Makefile b/services/project-history/Makefile index cd5d1acfb9..0f10570252 100644 --- a/services/project-history/Makefile +++ b/services/project-history/Makefile @@ -55,11 +55,11 @@ clean: # Run the linting commands in the scope of the monorepo. # Eslint and prettier (plus some configs) are on the root. -RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:24.13.0 npm run --silent -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 npm run --silent +RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) --user node node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) --user node node:24.13.0 npm run --silent -RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/document-updater/app/js/types.ts:/overleaf/services/document-updater/app/js/types.ts --volume $(MONOREPO)/services/project-history/reports:/overleaf/services/project-history/reports $(IMAGE_CI) npm run --silent -RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/document-updater/app/js/types.ts:/overleaf/services/document-updater/app/js/types.ts --volume $(MONOREPO)/services/project-history/reports:/overleaf/services/project-history/reports -w /overleaf $(IMAGE_CI) npm run --silent +RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/document-updater/app/js/types.ts:/overleaf/services/document-updater/app/js/types.ts --volume $(MONOREPO)/services/project-history/reports:/overleaf/services/project-history/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) npm run --silent +RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/document-updater/app/js/types.ts:/overleaf/services/document-updater/app/js/types.ts --volume $(MONOREPO)/services/project-history/reports:/overleaf/services/project-history/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -79,6 +79,24 @@ shellcheck_fix: else echo "\033[2m$$file\033[0m"; fi \ done +WITH_CACHE_FOLDER = \ + lint \ + lint_ci \ + lint_fix \ + format \ + format_ci \ + format_fix \ + typecheck \ + typecheck_ci \ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/ +../../node_modules/.cache/prettier/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/ +../../node_modules/.cache/eslint/: + mkdir -p $@ + format: $(RUN_LINTING_MONOREPO) format -- services/project-history diff --git a/services/project-history/package.json b/services/project-history/package.json index 81046a8e0a..ef92f235b8 100644 --- a/services/project-history/package.json +++ b/services/project-history/package.json @@ -11,8 +11,8 @@ "nodemon": "node --watch app.js", "test:acceptance:_run": "mocha --loader=esmock --recursive --timeout 15000 --exit $@ test/acceptance/js", "test:unit:_run": "mocha --loader=esmock --recursive --exit $@ test/unit/js", - "lint": "eslint --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix .", "types:check": "tsc --noEmit" }, "dependencies": { diff --git a/services/real-time/Makefile b/services/real-time/Makefile index 8446c34fab..6878b7c2de 100644 --- a/services/real-time/Makefile +++ b/services/real-time/Makefile @@ -51,11 +51,11 @@ clean: # Run the linting commands in the scope of the monorepo. # Eslint and prettier (plus some configs) are on the root. -RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) node:24.13.0 npm run --silent -RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 npm run --silent +RUN_LINTING = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(HERE) --user node node:24.13.0 npm run --silent +RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) --user node node:24.13.0 npm run --silent -RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/real-time/reports:/overleaf/services/real-time/reports $(IMAGE_CI) npm run --silent -RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/real-time/reports:/overleaf/services/real-time/reports -w /overleaf $(IMAGE_CI) npm run --silent +RUN_LINTING_CI = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/real-time/reports:/overleaf/services/real-time/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache $(IMAGE_CI) npm run --silent +RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/real-time/reports:/overleaf/services/real-time/reports --volume $(MONOREPO)/node_modules/.cache:/overleaf/node_modules/.cache -w /overleaf $(IMAGE_CI) npm run --silent SHELLCHECK_OPTS = \ --shell=bash \ @@ -75,6 +75,24 @@ shellcheck_fix: else echo "\033[2m$$file\033[0m"; fi \ done +WITH_CACHE_FOLDER = \ + lint \ + lint_ci \ + lint_fix \ + format \ + format_ci \ + format_fix \ + typecheck \ + typecheck_ci \ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/ +../../node_modules/.cache/prettier/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/ +../../node_modules/.cache/eslint/: + mkdir -p $@ + format: $(RUN_LINTING_MONOREPO) format -- services/real-time diff --git a/services/real-time/package.json b/services/real-time/package.json index 29b4e92190..283c8ff5fe 100644 --- a/services/real-time/package.json +++ b/services/real-time/package.json @@ -11,8 +11,8 @@ "test:unit:_run": "vitest --config ./vitest.config.unit.cjs", "test:unit": "npm run test:unit:_run", "nodemon": "node --watch app.js", - "lint": "eslint --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix .", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix .", "types:check": "tsc --noEmit" }, "dependencies": { diff --git a/services/web/Makefile b/services/web/Makefile index f4ad0c3219..d348d1bc7e 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -434,12 +434,12 @@ ci: # Run the linting commands in the scope of the monorepo. # Eslint and prettier (plus some configs) are on the root. -RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/web/data/reports:/overleaf/services/web/data/reports -w /overleaf $(IMAGE_CI) npm run --silent +RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/web/data/reports:/overleaf/services/web/data/reports --volume $(MONOREPO)/node_modules/.cache/:/overleaf/node_modules/.cache/ -w /overleaf $(IMAGE_CI) npm run --silent RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) node:24.13.0 npm run --silent ORG_PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin RUN_LINT_FORMAT ?= \ - docker run --rm --env BRANCH_NAME --env CI --env COMMIT_SHA --env MONOREPO --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume ${PWD}/data/reports:/overleaf/services/web/data/reports ${IMAGE_CI} + docker run --rm --env BRANCH_NAME --env CI --env COMMIT_SHA --env MONOREPO --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume ${PWD}/data/reports:/overleaf/services/web/data/reports --volume $(MONOREPO)/node_modules/.cache/:/overleaf/node_modules/.cache/ ${IMAGE_CI} NODE_MODULES_PATH := ${PATH}:${PWD}/node_modules/.bin:/overleaf/services/web/node_modules/.bin WITH_NODE_MODULES_PATH = \ @@ -454,6 +454,33 @@ WITH_NODE_MODULES_PATH = \ $(WITH_NODE_MODULES_PATH): export PATH=$(NODE_MODULES_PATH) +WITH_CACHE_FOLDER = \ + lint_eslint \ + lint_stylelint \ + lint_in_docker \ + format_js \ + format_ci \ + format_fix \ + format_styles \ + format_styles_fix \ + format_pug \ + format_pug_fix \ + format_jenkins \ + format_jenkins_fix \ + format_in_docker \ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/prettier/ +../../node_modules/.cache/prettier/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/eslint/ +../../node_modules/.cache/eslint/: + mkdir -p $@ + +$(WITH_CACHE_FOLDER): ../../node_modules/.cache/stylelint/ +../../node_modules/.cache/stylelint/: + mkdir -p $@ + lint: lint_eslint lint_eslint: ifeq ($(CI),true) diff --git a/services/web/package.json b/services/web/package.json index aa711864a8..089654b8ef 100644 --- a/services/web/package.json +++ b/services/web/package.json @@ -25,10 +25,10 @@ "webpack": "webpack serve --config webpack.config.dev.js", "webpack:production": "webpack --config webpack.config.prod.js", "webpack:profile": "webpack --config webpack.config.prod.js --profile --json > stats.json", - "lint": "eslint --max-warnings 0 --format unix --ext .js,.jsx,.mjs,.ts,.tsx .", - "lint:fix": "eslint --fix --ext .js,.jsx,.mjs,.ts,.tsx .", - "lint:styles": "stylelint '**/*.scss'", - "lint:styles:fix": "stylelint '**/*.scss' --fix", + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --max-warnings 0 --format unix --ext .js,.jsx,.mjs,.ts,.tsx .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .js,.jsx,.mjs,.ts,.tsx .", + "lint:styles": "stylelint --cache --cache-location ../../node_modules/.cache/stylelint/ '**/*.scss'", + "lint:styles:fix": "stylelint --cache --cache-location ../../node_modules/.cache/stylelint/ '**/*.scss' --fix", "type-check": "tsc --noEmit", "type-check:backend": "tsc -p tsconfig.backend.json --noEmit", "extract-translations": "i18next-scanner", diff --git a/tools/migrations/package.json b/tools/migrations/package.json index c54b5b8910..20ee89a539 100644 --- a/tools/migrations/package.json +++ b/tools/migrations/package.json @@ -2,8 +2,8 @@ "name": "@overleaf/migrations", "scripts": { "migrations": "MONGO_SOCKET_TIMEOUT=0 east --es-modules", - "lint": "eslint --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", - "lint:fix": "eslint --fix --ext .cjs,.js,.jsx,.mjs,.ts ." + "lint": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --ext .cjs,.js,.jsx,.mjs,.ts --max-warnings 0 --format unix .", + "lint:fix": "eslint --cache --cache-location ../../node_modules/.cache/eslint/ --fix --ext .cjs,.js,.jsx,.mjs,.ts ." }, "dependencies": { "@overleaf/logger": "*",