Skip to content

Commit

Permalink
Exclude node_modules subfolder for lint-markdown.sh (#543)
Browse files Browse the repository at this point in the history
## Ticket

Resolves [lint-markdown.sh](https://github.com/navapbc/template-infra/blob/main/bin/lint-markdown.sh)
unnecessarily analyzes `md` files under `node_modules/`.

## Changes

Exclude files under `*/node_modules/` from being analyzed by adding the
arguments `-not -path "*/node_modules/*"`.

## Context for reviewers

The `gaurav-nelson/github-action-markdown-link-check` action [ignores
node_modules
files](https://github.com/navapbc/bid-fed-va-spruce-challenge-practice3/actions/runs/7576561682/job/20635654502?pr=4#step:4:109).

## Testing

- Instantiate the `infra` and `nextjs` templates into a single repo.
- Run `npm install` for the nextjs application so that a `node_modules`
subfolder is populated
- Run `bin/lint-markdown.sh` and ensure the `md` files under the
`node_modules` subfolder are not analyzed
  • Loading branch information
yoomlam authored Jan 19, 2024
1 parent a03da3b commit c9e5672
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/lint-markdown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ cd "${SCRIPT_DIR}/.." >/dev/null || exit 1

LINK_CHECK_CONFIG=".github/workflows/markdownlint-config.json"

# Recursively find all markdown files (*.md) in this directory. Pass them in as args to the lint
# command using the handy `xargs` command.
find . -name \*.md -print0 | xargs -0 -n1 npx markdown-link-check --config $LINK_CHECK_CONFIG
# Recursively find all markdown files (*.md) in the current directory, excluding node_modules subfolders.
# Pass them in as args to the lint command using the handy `xargs` command.
find . -name \*.md -not -path "*/node_modules/*" -print0 | xargs -0 -n1 npx markdown-link-check --config $LINK_CHECK_CONFIG

0 comments on commit c9e5672

Please sign in to comment.