Sheath rule
blade-no-directive-space
Directive attributes in component tags must not have a space between the directive name and its arguments.
#Why
A space between a directive name and its arguments (e.g., @checked ($val)) causes a Laravel Blade compiler error at runtime. The @ directive syntax requires the name to be immediately followed by the opening parenthesis.
#Examples
#Bad
<!-- Space between directive name and arguments -->
<x-input @checked ($isChecked) />
<x-input @disabled ($isDisabled) />
<x-select @selected ($isSelected) />
<x-input @required ($isRequired) />
#Good
<!-- No space between directive name and arguments -->
<x-input @checked($isChecked) />
<x-input @disabled($isDisabled) />
<x-select @selected($isSelected) />
<x-input @required($isRequired) />
<!-- Directives without arguments are fine -->
<x-input @checked />
<x-input @disabled />
#Auto-fix
Auto-fix removes the space between the directive name and its arguments:
<!-- Before -->
<x-input @checked ($isChecked) />
<!-- After -->
<x-input @checked($isChecked) />
#Related Rules
- blade-component-self-closing - Empty components should use self-closing syntax