Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -129,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 }}

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading