Fix pattern content inset drift with shared token and guardrail

This commit is contained in:
2026-05-22 07:32:19 +02:00
parent e876ccc8ab
commit 13d0b86221
3 changed files with 40 additions and 5 deletions
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
CSS_FILE="$ROOT_DIR/styleguide.css"
selectors=(
"sg-portal-header"
"sg-options-row"
"sg-card-list-page-drawer__header"
"sg-card-list-page-drawer__content"
)
for selector in "${selectors[@]}"; do
block="$(awk -v selector=".$selector" '
$0 ~ selector"[[:space:]]*\\{" {in_block=1}
in_block {print}
in_block && /}/ {exit}
' "$CSS_FILE")"
if [[ -z "$block" ]]; then
echo "ERROR: selector .$selector not found in styleguide.css"
exit 1
fi
if echo "$block" | rg -n "(padding|padding-inline|padding-left|padding-right|inset|inset-inline)([^\n;]*)([0-9]+px)" >/dev/null; then
echo "ERROR: hardcoded px inset/padding value found in .$selector"
echo "$block"
exit 1
fi
done
echo "OK: no hardcoded px inset values in guarded pattern selectors"