fix: components page copyCode Alpine error and add TPL-012 rule

- Fixed copyCode template literal by using single quotes for outer attribute
- Added TPL-012 architecture rule to detect double quotes inside multi-line
  copyCode template literals that break HTML attribute parsing
- Pattern: @click="copyCode(`...`)" with inner double quotes breaks parsing
- Solution: Use @click='copyCode(`...`)' with single quotes for outer attribute

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-31 23:15:07 +01:00
parent 03209eb691
commit 7adf19c04c
2 changed files with 63 additions and 9 deletions

View File

@@ -2199,17 +2199,17 @@ goToPage(n) { if (n !== '...' && n >= 1 && n <= this.totalPages) { this.paginati
<span class="text-xs text-gray-500">(Click Option 1 to see loading state)</span>
</div>
</div>
<button @click="copyCode(`{% raw %}{% from 'shared/macros/dropdowns.html' import action_dropdown, dropdown_item %}
<button @click='copyCode(`{% raw %}{% from "shared/macros/dropdowns.html" import action_dropdown, dropdown_item %}
{% call action_dropdown(
label='Run Scan',
loading_label='Scanning...',
open_var='scanDropdownOpen',
loading_var='scanning',
icon='search'
label="Run Scan",
loading_label="Scanning...",
open_var="scanDropdownOpen",
loading_var="scanning",
icon="search"
) %}
{{ dropdown_item('Run All', "runScan('all'); scanDropdownOpen = false") }}
{{ dropdown_item('Run Selected', "runScan('selected'); scanDropdownOpen = false") }}
{% endcall %}{% endraw %}`)" class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
{{ dropdown_item("Run All", "runScan(\"all\"); scanDropdownOpen = false") }}
{{ dropdown_item("Run Selected", "runScan(\"selected\"); scanDropdownOpen = false") }}
{% endcall %}{% endraw %}`)' class="text-sm text-purple-600 hover:text-purple-700 dark:text-purple-400 flex items-center">
<span x-html="$icon('duplicate', 'w-4 h-4 mr-1')"></span>
Copy Code
</button>