ADR-013 Phase 4: lint plugin-frontend imports (self-contained rule)
The naming/style check now fails a plugin frontend (plugins/<name>/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.
This commit is contained in:
@@ -106,6 +106,23 @@ if [ -n "$SNAKE_FE" ]; then
|
||||
VIOLATIONS=$((VIOLATIONS + 1))
|
||||
fi
|
||||
|
||||
# ADR-013 Phase 4: a plugin frontend (plugins/<name>/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."
|
||||
|
||||
Reference in New Issue
Block a user