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.
This commit is contained in:
kleines Filmröllchen 2024-09-17 15:59:06 +02:00 committed by Nico Weber
parent 19163e79a3
commit f0ba4d9037

View file

@ -10,12 +10,12 @@ if [ "$#" -eq "0" ]; then
git ls-files \
--exclude-from .prettierignore \
-- \
'*.js' '*.mjs'
'*.js' '*.mjs' '*.md'
)
else
files=()
for file in "$@"; do
if [[ "${file}" == *".js" ]] || [[ "${file}" == *".mjs" ]]; then
if [[ "${file}" == *".js" || "${file}" == *".mjs" || "${file}" == *".md" ]]; then
files+=("${file}")
fi
done
@ -23,7 +23,7 @@ fi
if (( ${#files[@]} )); then
if ! command -v prettier >/dev/null 2>&1 ; then
echo "prettier is not available, but JS files need linting! Either skip this script, or install prettier."
echo "prettier is not available, but JS or Markdown files need linting! Either skip this script, or install prettier."
exit 1
fi
@ -34,5 +34,5 @@ if (( ${#files[@]} )); then
prettier --check "${files[@]}"
else
echo "No .js or .mjs files to check."
echo "No .js, .mjs, or .md files to check."
fi