Add phone-sm/phone-lg breakpoints and improve SCSS scope error message

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-12-30 03:18:09 +00:00
parent d41a534744
commit 1506573202
3 changed files with 205 additions and 15 deletions

View File

@@ -346,24 +346,42 @@ class ScssClassScope_CodeQualityRule extends CodeQualityRule_Abstract
*/
private function build_no_match_suggestion(string $file, string $wrapper_class): string
{
// Convert wrapper class to a plausible BEM element name (lowercase with underscores)
$bem_element = strtolower($wrapper_class);
$lines = [];
$lines[] = "The wrapper class '{$wrapper_class}' does not match any known";
$lines[] = "action, layout, component, or Blade view.";
$lines[] = "";
$lines[] = "VALID ASSOCIATIONS:";
$lines[] = " - Spa_Action class (e.g., Frontend_Dashboard extends Spa_Action)";
$lines[] = " - Spa_Layout class (e.g., Frontend_Layout extends Spa_Layout)";
$lines[] = " - Component class (e.g., Sidebar_Nav extends Component)";
$lines[] = " - Blade @rsx_id (e.g., @rsx_id('Login_Index'))";
$lines[] = "OPTION 1 - STANDALONE COMPONENT:";
$lines[] = " If this is a reusable component, create the matching class:";
$lines[] = " - Spa_Action: class {$wrapper_class} extends Spa_Action";
$lines[] = " - Spa_Layout: class {$wrapper_class} extends Spa_Layout";
$lines[] = " - Component: class {$wrapper_class} extends Component";
$lines[] = " - Blade view: @rsx_id('{$wrapper_class}')";
$lines[] = "";
$lines[] = "TO FIX:";
$lines[] = " 1. Rename the wrapper class to match your action/layout/component/view";
$lines[] = " 2. Or create the missing .js or .blade.php file with this class/id";
$lines[] = "OPTION 2 - BEM CHILD ELEMENT (most common):";
$lines[] = " If this is part of a parent component (action, layout, or component),";
$lines[] = " use BEM naming in the PARENT's SCSS file instead of creating a";
$lines[] = " separate file:";
$lines[] = "";
$lines[] = "NO EXEMPTIONS are allowed. If this file provides shared styles that";
$lines[] = "cannot be scoped to a single element, it may need to be moved to";
$lines[] = "rsx/theme/ (outside components/) - but this is rare and requires";
$lines[] = "explicit developer approval.";
$lines[] = " Parent: Frontend_Layout";
$lines[] = " Element: {$bem_element}";
$lines[] = "";
$lines[] = " SCSS (in Frontend_Layout.scss):";
$lines[] = " .Frontend_Layout {";
$lines[] = " &__{$bem_element} { ... }";
$lines[] = " }";
$lines[] = "";
$lines[] = " HTML:";
$lines[] = " <nav class=\"Frontend_Layout__{$bem_element}\">";
$lines[] = "";
$lines[] = " Then DELETE this orphaned SCSS file.";
$lines[] = "";
$lines[] = "OPTION 3 - GLOBAL STYLES (rare):";
$lines[] = " If this provides truly shared styles that cannot be scoped to any";
$lines[] = " component, move to rsx/theme/ (outside components/). This requires";
$lines[] = " explicit developer approval.";
$lines[] = "";
$lines[] = "See: php artisan rsx:man scss";