fix: use correct block name in messages template + add TPL-008 rule
- Fix messages.html: change {% block page_scripts %} to {% block extra_scripts %}
(page_scripts doesn't exist in admin/base.html, causing JS not to load)
- Add TPL-008 architecture rule to catch invalid template block names
This prevents silent failures where content in undefined blocks is ignored
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -243,6 +243,35 @@ template_rules:
|
||||
file_pattern: "app/templates/**/*.html"
|
||||
recommended_pattern: '<template x-if="items.length === 0">No items</template>'
|
||||
|
||||
- id: "TPL-008"
|
||||
name: "Use valid block names from base templates"
|
||||
severity: "error"
|
||||
description: |
|
||||
Templates must use block names that exist in their base template.
|
||||
Using undefined blocks silently fails (content is not rendered).
|
||||
|
||||
Admin base blocks: title, extra_head, alpine_data, content, extra_scripts
|
||||
Vendor base blocks: title, extra_head, alpine_data, content, extra_scripts
|
||||
Shop base blocks: title, description, extra_head, alpine_data, content, extra_scripts
|
||||
|
||||
WRONG: {% block page_scripts %}...{% endblock %} (undefined)
|
||||
RIGHT: {% block extra_scripts %}...{% endblock %}
|
||||
pattern:
|
||||
file_pattern: "app/templates/admin/**/*.html"
|
||||
valid_blocks:
|
||||
- "title"
|
||||
- "extra_head"
|
||||
- "alpine_data"
|
||||
- "content"
|
||||
- "extra_scripts"
|
||||
forbidden_patterns:
|
||||
- "{% block page_scripts %}"
|
||||
- "{% block scripts %}"
|
||||
- "{% block js %}"
|
||||
- "{% block footer_scripts %}"
|
||||
exceptions:
|
||||
- "base.html"
|
||||
|
||||
# ============================================================================
|
||||
# FRONTEND COMPONENT RULES
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user