From 1506573202382db6c9176b08bcee0c9a5c66cdfc Mon Sep 17 00:00:00 2001 From: root Date: Tue, 30 Dec 2025 03:18:09 +0000 Subject: [PATCH] Add phone-sm/phone-lg breakpoints and improve SCSS scope error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../ScssClassScope_CodeQualityRule.php | 42 +++-- .../phone_breakpoints_12_30.txt | 172 ++++++++++++++++++ docs/CLAUDE.dist.md | 6 +- 3 files changed, 205 insertions(+), 15 deletions(-) create mode 100755 app/RSpade/upstream_changes/phone_breakpoints_12_30.txt diff --git a/app/RSpade/CodeQuality/Rules/Manifest/ScssClassScope_CodeQualityRule.php b/app/RSpade/CodeQuality/Rules/Manifest/ScssClassScope_CodeQualityRule.php index 5ffc96a75..fc448e35f 100644 --- a/app/RSpade/CodeQuality/Rules/Manifest/ScssClassScope_CodeQualityRule.php +++ b/app/RSpade/CodeQuality/Rules/Manifest/ScssClassScope_CodeQualityRule.php @@ -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[] = "