rustywind icon indicating copy to clipboard operation
rustywind copied to clipboard

Conditional operator in class wrongly formatted

Open apgapg opened this issue 3 years ago • 1 comments

Input: (Vue Html Syntax)

:class="
      activeTab
        ? ' bg-opacity-30 bg-blue-300 rounded text-blue-500 font-medium'
        : 'hover:bg-gray-200 bg-gray-100 font-normal text-gray-700 hover:text-gray-900'
    "

After I run rusty --write .

Output:

 :class="? activeTab'bg-opacity-30 bg-blue-300 rounded text-blue-500 font-medium'
        : 'hover:bg-gray-200 bg-gray-100 font-normal text-gray-700 hover:text-gray-900'
    "

apgapg avatar Jan 20 '22 04:01 apgapg

I have two more examples to add:

input:

x-bind:class="open ? 'rotate-180' : ''" role="decoration">

output:

x-bind:class="open ?'rotate-180' : ''" role="decoration">

input:

:class="submenu == 'hours' ? 'sr-only'">

output:

:class="submenu =='hours' ? 'sr-only'">

(note the lack of space between == and '

maxfenton avatar Feb 01 '22 00:02 maxfenton