chore: add log-tag lint + fix biome errors + pre-push hook
- scripts/lint-log-tags.sh: static check for invalid Crockford Base32 log tags (I/L/O/U) - fix two invalid log tags in ws-client.ts (6CJX2RLP→6CJX2R8P, T9W2KL5H→T9W2K35H) - fix biome errors: unused import, exhaustive deps, cognitive complexity suppression - add pre-push git hook running bun run check - integrate lint-log-tags into bun run check pipeline Refs #244
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# Validate Crockford Base32 log tags in .log("TAG", ...) calls.
|
||||
# Crockford Base32 excludes: I, L, O, U
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
BAD=0
|
||||
|
||||
while IFS= read -r match; do
|
||||
file="${match%%:*}"
|
||||
rest="${match#*:}"
|
||||
line="${rest%%:*}"
|
||||
tag=$(echo "$rest" | grep -oP '\.log\(\s*"\K[A-Za-z0-9]+')
|
||||
if echo "$tag" | grep -qiE '[ILOU]'; then
|
||||
echo " ❌ ${file}:${line} tag \"${tag}\" contains invalid Crockford Base32 char (I/L/O/U)"
|
||||
BAD=1
|
||||
fi
|
||||
done < <(grep -rn '\.log("[A-Za-z0-9]\{8\}"' "$ROOT/packages/" --include='*.ts' \
|
||||
| grep -v node_modules | grep -v '/dist/')
|
||||
|
||||
if [ "$BAD" -eq 0 ]; then
|
||||
echo " ✅ All log tags are valid Crockford Base32"
|
||||
fi
|
||||
exit $BAD
|
||||
Reference in New Issue
Block a user