From 17d461d57cb38d7cf2cd3a1a9b0a54a6f1d35319 Mon Sep 17 00:00:00 2001 From: Robert-Jan Huijsman <22160949+rjhuijsman@users.noreply.github.com> Date: Mon, 15 Sep 2025 11:35:00 +0000 Subject: [PATCH] Ignore symlinks in style checks Our style checks were adding problems when adding symlinks to directories: * `prettier` will error out if told to format a directory that doesn't contain any files it can format. * `git` will report new symlinks to directories as new files. * `prettier` will interpret symlinks to directories as directories. * Therefore, if adding a symlink to a directory that doesn't have any `prettier`-relevant files, `prettier` will error out. We avoid this (and any other symlink confusion) by excluding symlinks from style checks. By definition they'll point to a real file or directory that will be getting formatted anyway. --- check-style.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/check-style.sh b/check-style.sh index 99df3bb..2d3626d 100755 --- a/check-style.sh +++ b/check-style.sh @@ -41,6 +41,8 @@ case $1 in exit 2 esac +# Filter out symlinks from `affected_files`. We'll check the real files. +affected_files=$(echo "$affected_files" | xargs -r -n1 file | grep -v 'symbolic link' | cut -d: -f1 | tr '\n' ' ') # Unset variable would be a sign of programmer error. We are not using '-e' in # this script as we'd like to handle these cases ourselves where relevant, i.e.,