Add flash alert UX improvements, User_Model fetch security, and SCSS-SCOPE-01 BEM guidance
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -243,6 +243,23 @@ class ScssClassScope_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
}
|
||||
|
||||
if ($matched_filename === null) {
|
||||
// Check if this is a BEM child class (contains __) where the parent is a known component
|
||||
if (strpos($wrapper_class, '__') !== false) {
|
||||
[$parent_class, $child_suffix] = explode('__', $wrapper_class, 2);
|
||||
if (isset($components[$parent_class]) || isset($blade_ids[$parent_class])) {
|
||||
// This is a BEM child class - provide specialized guidance
|
||||
$this->add_violation(
|
||||
$file,
|
||||
1,
|
||||
"BEM child class '.{$wrapper_class}' must be nested within parent component block",
|
||||
".{$wrapper_class} { ... }",
|
||||
$this->build_bem_child_suggestion($parent_class, $child_suffix),
|
||||
'critical'
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->add_violation(
|
||||
$file,
|
||||
1,
|
||||
@@ -345,6 +362,35 @@ class ScssClassScope_CodeQualityRule extends CodeQualityRule_Abstract
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build suggestion for BEM child class at top level
|
||||
*/
|
||||
private function build_bem_child_suggestion(string $parent_class, string $child_suffix): string
|
||||
{
|
||||
$lines = [];
|
||||
$lines[] = "BEM child classes must be nested within their parent component block,";
|
||||
$lines[] = "not declared at the top level of the SCSS file.";
|
||||
$lines[] = "";
|
||||
$lines[] = "INSTEAD OF:";
|
||||
$lines[] = " .{$parent_class}__{$child_suffix} {";
|
||||
$lines[] = " // styles";
|
||||
$lines[] = " }";
|
||||
$lines[] = "";
|
||||
$lines[] = "USE:";
|
||||
$lines[] = " .{$parent_class} {";
|
||||
$lines[] = " &__{$child_suffix} {";
|
||||
$lines[] = " // styles";
|
||||
$lines[] = " }";
|
||||
$lines[] = " }";
|
||||
$lines[] = "";
|
||||
$lines[] = "This compiles to the same CSS (.{$parent_class}__{$child_suffix})";
|
||||
$lines[] = "but maintains proper component scoping in the source files.";
|
||||
$lines[] = "";
|
||||
$lines[] = "See: php artisan rsx:man scss";
|
||||
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build suggestion for filename mismatch
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user