Skip to content

Commit f25c147

Browse files
fix: add missing typescript test linting in workflows
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 3609aed commit f25c147

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/lint_changed_files.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,43 @@ jobs:
341341
make lint-typescript-declarations-files FILES="${files}"
342342
fi
343343
344+
# Lint TypeScript declarations test files:
345+
- name: 'Lint TypeScript declarations test files'
346+
if: success() || failure()
347+
run: |
348+
# Determine root directory:
349+
root=$(git rev-parse --show-toplevel)
350+
351+
# Define the path to ESLint configuration file for linting TypeScript tests:
352+
eslint_typescript_tests_conf="${root}/etc/eslint/.eslintrc.typescript.tests.js"
353+
354+
# Get changed files:
355+
changed_files=$(echo "${{ steps.changed-files.outputs.files }}" | tr ' ' '\n')
356+
357+
# Get directly changed `test.ts` files:
358+
files=$(echo "${changed_files}" | grep '/docs/types/test\.ts$' | tr '\n' ' ' | sed 's/ $//')
359+
360+
# Also get `test.ts` files corresponding to changed `index.d.ts` files...
361+
declaration_files=$(echo "${changed_files}" | grep '/docs/types/.*\.d\.ts$' | sed 's/ $//')
362+
if [[ -n "${declaration_files}" ]]; then
363+
while IFS= read -r decl_file; do
364+
# Only process index.d.ts files (skip other .d.ts files)
365+
if [[ "${decl_file}" == */index.d.ts ]]; then
366+
# Replace `index.d.ts` with `test.ts` to get the test file path:
367+
test_file="${decl_file%index.d.ts}test.ts"
368+
369+
# Check if the test file exists and isn't already in the list:
370+
if [[ -f "${test_file}" ]] && [[ ! " ${files} " =~ [[:space:]]${test_file}[[:space:]] ]]; then
371+
files="${files} ${test_file}"
372+
fi
373+
fi
374+
done <<< "${declaration_files}"
375+
fi
376+
377+
if [[ -n "${files}" ]]; then
378+
make lint-typescript-declarations-files FILES="${files}" ESLINT_TS_CONF="${eslint_typescript_tests_conf}"
379+
fi
380+
344381
# Lint license headers:
345382
- name: 'Lint license headers'
346383
if: success() || failure()

0 commit comments

Comments
 (0)