From c6a1e07a6c42b503c8ba995a559776c3d094c299 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Sun, 19 Jul 2026 00:03:33 -0400 Subject: [PATCH] ADR-013 Phase 4: lint plugin-frontend imports (self-contained rule) The naming/style check now fails a plugin frontend (plugins//frontend/) that imports with an escaping ../../ or another plugin's path. Plugin frontends must reach core only through the @/ alias and otherwise import only their own tree, so a per-site build can drop a plugin cleanly. All 14 plugin frontends pass. --- scripts/check-naming-and-style.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/check-naming-and-style.sh b/scripts/check-naming-and-style.sh index 7cadfba..bf0cf42 100755 --- a/scripts/check-naming-and-style.sh +++ b/scripts/check-naming-and-style.sh @@ -106,6 +106,23 @@ if [ -n "$SNAKE_FE" ]; then VIOLATIONS=$((VIOLATIONS + 1)) fi +# ADR-013 Phase 4: a plugin frontend (plugins//frontend/) may import core +# via the @/ alias or its own tree (./, ../ within the plugin), never another +# plugin's tree and never an escaping ../../ into src. Keeps plugin frontends +# self-contained so a per-site build can drop one cleanly. +echo "==> Checking for cross-plugin / escaping imports in plugin frontends..." +if [ -d plugins ]; then + PLUGIN_FE_IMPORTS=$(grep -rPn "(import|from)\s+['\"]([^'\"]*\.\./\.\./|[^'\"]*/plugins/)" \ + --include='*.vue' --include='*.js' plugins/*/frontend/ 2>/dev/null || true) + if [ -n "$PLUGIN_FE_IMPORTS" ]; then + echo "FAIL: plugin frontend imports must use the @/ alias for core, not" + echo " an escaping ../../ or another plugin's path:" + echo "$PLUGIN_FE_IMPORTS" + echo + VIOLATIONS=$((VIOLATIONS + 1)) + fi +fi + if [ "$VIOLATIONS" -gt 0 ]; then echo "==================================================" echo "$VIOLATIONS naming/style violation(s) found."