From 2e5b0db17b5975cdf559b1d4fcda28bb85da30ac Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 30 Sep 2026 14:33:59 +0200 Subject: [PATCH 1/2] tools: add cache to `lint-js-and-md` Signed-off-by: Antoine du Hamel --- .github/workflows/linters.yml | 18 +++++++++++++++++- Makefile | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 848fffc117a1..7f3ae4f4bae4 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -93,13 +93,29 @@ jobs: with: persist-credentials: false - name: Use Node.js ${{ env.NODE_VERSION }} + id: setup-node uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: ${{ env.NODE_VERSION }} + cache: npm + cache-dependency-path: | + tools/doc/package-lock.json + tools/eslint/package-lock.json + tools/lint-md/package-lock.json + - name: Cache ESLint results + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + env: + # ESLint only invalidates its cache on config changes, so the key also + # covers the custom rules and the files they read. + cache-prefix: eslint-${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('eslint.config.mjs', '*/eslint.config_partial.mjs', 'tools/eslint/*', 'tools/eslint-rules/**', 'doc/api/errors.md', 'doc/api/deprecations.md') }} + with: + path: .eslintcache + key: ${{ env.cache-prefix }}-${{ github.sha }} + restore-keys: ${{ env.cache-prefix }}- - name: Lint JavaScript files run: | set +e - NODE=$(command -v node) make lint-js + NODE=$(command -v node) make lint-js ESLINT_CACHE_FLAGS='--cache --cache-strategy content' EXIT_CODE="$?" if [ "$EXIT_CODE" != "0" ]; then echo diff --git a/Makefile b/Makefile index 0582e926d1f2..31d7d911c987 100644 --- a/Makefile +++ b/Makefile @@ -1523,10 +1523,10 @@ format-md: tools/lint-md/node_modules/remark-parse/package.json ## Format the ma @$(call available-node,$(run-format-md)) - +ESLINT_CACHE_FLAGS ?= --cache LINT_JS_TARGETS = eslint.config.mjs benchmark doc lib test tools -run-lint-js = tools/eslint/node_modules/eslint/bin/eslint.js --cache \ +run-lint-js = tools/eslint/node_modules/eslint/bin/eslint.js $(ESLINT_CACHE_FLAGS) \ --max-warnings=0 --report-unused-disable-directives \ --concurrency auto $(LINT_JS_TARGETS) run-lint-js-fix = $(run-lint-js) --fix From e4a6cfae1bc56717b797a89e9bd368c56cb86961 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 30 Sep 2026 14:53:35 +0200 Subject: [PATCH 2/2] fixup! tools: add cache to `lint-js-and-md` --- .github/workflows/linters.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 7f3ae4f4bae4..ae8eeef2a66b 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -145,7 +145,7 @@ jobs: - name: Lint markdown files run: | echo "::add-matcher::.github/workflows/remark-lint-problem-matcher.json" - NODE=$(command -v node) make lint-md + NODE=$(command -v node) make lint-md ESLINT_CACHE_FLAGS='--cache --cache-strategy content' env: NODE_RELEASED_VERSIONS: ${{ steps.get-released-versions.outputs.NODE_RELEASED_VERSIONS }}