mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 08:36:11 +02:00
Add markdown linting tools and scripts
- Create package.json to manage markdownlint-cli2 as a dev dependency. - Add PowerShell script for linting Markdown files with options for fixing issues. - Update shell script to prefer locally installed markdownlint-cli2 or fallback to npx.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#
|
||||
# Lint all Markdown files in the repository.
|
||||
# Config, globs, and ignores are defined in .markdownlint-cli2.jsonc.
|
||||
# The linter version is pinned in package.json — run `npm install` once,
|
||||
# or just use `npm run lint:md` / `npm run lint:md:fix` directly.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/lint-markdown.sh # check
|
||||
@@ -12,11 +14,12 @@ set -euo pipefail
|
||||
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
# Resolve markdownlint-cli2 binary
|
||||
if command -v markdownlint-cli2 &>/dev/null; then
|
||||
LINT_CMD="markdownlint-cli2"
|
||||
# Prefer the locally installed (version-pinned) linter; fall back to a one-off
|
||||
# npx install of the same version pinned in package.json.
|
||||
if [ -x "node_modules/.bin/markdownlint-cli2" ]; then
|
||||
LINT_CMD="npx --no-install markdownlint-cli2"
|
||||
else
|
||||
LINT_CMD="npx --yes markdownlint-cli2"
|
||||
LINT_CMD="npx --yes markdownlint-cli2@0.23.0"
|
||||
fi
|
||||
|
||||
echo "Linting Markdown files..."
|
||||
|
||||
Reference in New Issue
Block a user