Skip to content

Commit f0ba4d9

Browse files
kleinesfilmroellchennico
authored andcommitted
Meta: Enforce Prettier formatting of Markdown files
We already use the opinionated Prettier formatter for JavaScript (with appropriate configuration), and in general it seems to be one of the best Markdown auto-formatters. Therefore, the choice seems natural to finally enforce Markdown formatting.
1 parent 19163e7 commit f0ba4d9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Meta/lint-prettier.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ if [ "$#" -eq "0" ]; then
1010
git ls-files \
1111
--exclude-from .prettierignore \
1212
-- \
13-
'*.js' '*.mjs'
13+
'*.js' '*.mjs' '*.md'
1414
)
1515
else
1616
files=()
1717
for file in "$@"; do
18-
if [[ "${file}" == *".js" ]] || [[ "${file}" == *".mjs" ]]; then
18+
if [[ "${file}" == *".js" || "${file}" == *".mjs" || "${file}" == *".md" ]]; then
1919
files+=("${file}")
2020
fi
2121
done
2222
fi
2323

2424
if (( ${#files[@]} )); then
2525
if ! command -v prettier >/dev/null 2>&1 ; then
26-
echo "prettier is not available, but JS files need linting! Either skip this script, or install prettier."
26+
echo "prettier is not available, but JS or Markdown files need linting! Either skip this script, or install prettier."
2727
exit 1
2828
fi
2929

@@ -34,5 +34,5 @@ if (( ${#files[@]} )); then
3434

3535
prettier --check "${files[@]}"
3636
else
37-
echo "No .js or .mjs files to check."
37+
echo "No .js, .mjs, or .md files to check."
3838
fi

0 commit comments

Comments
 (0)