Skip to content

Commit ddec3b2

Browse files
authored
chore: update prettier-plugin-tailwindcss order (#88)
* chore: make prettier-plugin-tailwindcss works Update the position of `prettier-plugin-tailwindcss` in `.prettierrc` plugin array. Otherwise, the plugin doesn't work as expected. * refactor: update formatting for classNames
1 parent f7223b4 commit ddec3b2

22 files changed

+39
-39
lines changed

.prettierrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"bracketSpacing": true,
1010
"endOfLine": "lf",
1111
"plugins": [
12-
"prettier-plugin-tailwindcss",
13-
"@trivago/prettier-plugin-sort-imports"
12+
"@trivago/prettier-plugin-sort-imports",
13+
"prettier-plugin-tailwindcss"
1414
],
1515
"importOrder": [
1616
"^path$",

src/components/layout/header.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export const Header = ({
3131
return (
3232
<header
3333
className={cn(
34-
'flex items-center gap-3 sm:gap-4 bg-background p-4 h-16',
35-
fixed && 'header-fixed peer/header w-[inherit] fixed z-50 rounded-md',
34+
'flex h-16 items-center gap-3 bg-background p-4 sm:gap-4',
35+
fixed && 'header-fixed peer/header fixed z-50 w-[inherit] rounded-md',
3636
offset > 10 && fixed ? 'shadow' : 'shadow-none',
3737
className
3838
)}

src/components/layout/main.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const Main = ({ fixed, ...props }: MainProps) => {
1212
className={cn(
1313
'peer-[.header-fixed]/header:mt-16',
1414
'px-4 py-6',
15-
fixed && 'fixed-main flex flex-col flex-grow overflow-hidden'
15+
fixed && 'fixed-main flex flex-grow flex-col overflow-hidden'
1616
)}
1717
{...props}
1818
/>

src/components/layout/nav-group.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function NavGroup({ title, items }: NavGroup) {
5454
}
5555

5656
const NavBadge = ({ children }: { children: ReactNode }) => (
57-
<Badge className='text-xs rounded-full px-1 py-0'>{children}</Badge>
57+
<Badge className='rounded-full px-1 py-0 text-xs'>{children}</Badge>
5858
)
5959

6060
const SidebarMenuLink = ({ item, href }: { item: NavLink; href: string }) => {

src/components/search.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function Search({ className = '', placeholder = 'Search' }: Props) {
1515
<Button
1616
variant='outline'
1717
className={cn(
18-
'relative h-8 w-full flex-1 md:flex-none justify-start rounded-md bg-muted/25 hover:bg-muted/50 text-sm font-normal text-muted-foreground shadow-none sm:pr-12 md:w-40 lg:w-56 xl:w-64',
18+
'relative h-8 w-full flex-1 justify-start rounded-md bg-muted/25 text-sm font-normal text-muted-foreground shadow-none hover:bg-muted/50 sm:pr-12 md:w-40 md:flex-none lg:w-56 xl:w-64',
1919
className
2020
)}
2121
onClick={() => setOpen(true)}

src/components/ui/command.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const CommandItem = React.forwardRef<
124124
<CommandPrimitive.Item
125125
ref={ref}
126126
className={cn(
127-
'relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
127+
'relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
128128
className
129129
)}
130130
{...props}

src/components/ui/dialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const DialogOverlay = React.forwardRef<
2020
<DialogPrimitive.Overlay
2121
ref={ref}
2222
className={cn(
23-
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
23+
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
2424
className
2525
)}
2626
{...props}

src/components/ui/dropdown-menu.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const DropdownMenuSubTrigger = React.forwardRef<
2424
<DropdownMenuPrimitive.SubTrigger
2525
ref={ref}
2626
className={cn(
27-
'flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
27+
'flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',
2828
inset && 'pl-8',
2929
className
3030
)}

src/components/ui/sheet.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const SheetOverlay = React.forwardRef<
2020
>(({ className, ...props }, ref) => (
2121
<SheetPrimitive.Overlay
2222
className={cn(
23-
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
23+
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
2424
className
2525
)}
2626
{...props}

src/components/ui/sidebar.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ const Sidebar = React.forwardRef<
224224
return (
225225
<div
226226
ref={ref}
227-
className='group peer hidden md:block text-sidebar-foreground'
227+
className='group peer hidden text-sidebar-foreground md:block'
228228
data-state={state}
229229
data-collapsible={state === 'collapsed' ? collapsible : ''}
230230
data-variant={variant}
@@ -233,7 +233,7 @@ const Sidebar = React.forwardRef<
233233
{/* This is what handles the sidebar gap on desktop */}
234234
<div
235235
className={cn(
236-
'duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear',
236+
'relative h-svh w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear',
237237
'group-data-[collapsible=offcanvas]:w-0',
238238
'group-data-[side=right]:rotate-180',
239239
variant === 'floating' || variant === 'inset'
@@ -243,7 +243,7 @@ const Sidebar = React.forwardRef<
243243
/>
244244
<div
245245
className={cn(
246-
'duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex',
246+
'fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex',
247247
side === 'left'
248248
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
249249
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
@@ -448,7 +448,7 @@ const SidebarGroupLabel = React.forwardRef<
448448
ref={ref}
449449
data-sidebar='group-label'
450450
className={cn(
451-
'duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
451+
'flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
452452
'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
453453
className
454454
)}
@@ -640,7 +640,7 @@ const SidebarMenuBadge = React.forwardRef<
640640
ref={ref}
641641
data-sidebar='menu-badge'
642642
className={cn(
643-
'absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none',
643+
'pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground',
644644
'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',
645645
'peer-data-[size=sm]/menu-button:top-1',
646646
'peer-data-[size=default]/menu-button:top-1.5',
@@ -668,7 +668,7 @@ const SidebarMenuSkeleton = React.forwardRef<
668668
<div
669669
ref={ref}
670670
data-sidebar='menu-skeleton'
671-
className={cn('rounded-md h-8 flex gap-2 px-2 items-center', className)}
671+
className={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}
672672
{...props}
673673
>
674674
{showIcon && (
@@ -678,7 +678,7 @@ const SidebarMenuSkeleton = React.forwardRef<
678678
/>
679679
)}
680680
<Skeleton
681-
className='h-4 flex-1 max-w-[--skeleton-width]'
681+
className='h-4 max-w-[--skeleton-width] flex-1'
682682
data-sidebar='menu-skeleton-text'
683683
style={
684684
{

src/features/chats/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export default function Chats() {
145145
{/* Right Side */}
146146
<div
147147
className={cn(
148-
'absolute inset-0 hidden left-full z-50 w-full flex-1 flex-col rounded-md border bg-primary-foreground shadow-sm transition-all duration-200 sm:static sm:z-auto sm:flex',
148+
'absolute inset-0 left-full z-50 hidden w-full flex-1 flex-col rounded-md border bg-primary-foreground shadow-sm transition-all duration-200 sm:static sm:z-auto sm:flex',
149149
mobileSelectedUser && 'left-0 flex'
150150
)}
151151
>

src/features/settings/components/content-section.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function ContentSection({
2020
</div>
2121
<Separator className='my-4 flex-none' />
2222
<ScrollArea className='faded-bottom -mx-4 flex-1 scroll-smooth px-4 md:pb-16'>
23-
<div className='lg:max-w-xl -mx-1 px-1.5'>{children}</div>
23+
<div className='-mx-1 px-1.5 lg:max-w-xl'>{children}</div>
2424
</ScrollArea>
2525
</div>
2626
)

src/features/settings/components/sidebar-nav.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ export default function SidebarNav({
5757
<ScrollArea
5858
orientation='horizontal'
5959
type='always'
60-
className='hidden w-full bg-background px-1 py-2 md:block min-w-40'
60+
className='hidden w-full min-w-40 bg-background px-1 py-2 md:block'
6161
>
6262
<nav
6363
className={cn(
64-
'flex py-1 space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1',
64+
'flex space-x-2 py-1 lg:flex-col lg:space-x-0 lg:space-y-1',
6565
className
6666
)}
6767
{...props}

src/features/settings/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ export default function Settings() {
3636
</p>
3737
</div>
3838
<Separator className='my-4 lg:my-6' />
39-
<div className='flex flex-1 flex-col space-y-2 md:space-y-2 overflow-hidden lg:flex-row lg:space-x-12 lg:space-y-0'>
39+
<div className='flex flex-1 flex-col space-y-2 overflow-hidden md:space-y-2 lg:flex-row lg:space-x-12 lg:space-y-0'>
4040
<aside className='top-0 lg:sticky lg:w-1/5'>
4141
<SidebarNav items={sidebarNavItems} />
4242
</aside>
43-
<div className='flex w-full p-1 pr-4 overflow-y-hidden'>
43+
<div className='flex w-full overflow-y-hidden p-1 pr-4'>
4444
<Outlet />
4545
</div>
4646
</div>

src/features/settings/notifications/notifications-form.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function NotificationsForm() {
6262
control={form.control}
6363
name='type'
6464
render={({ field }) => (
65-
<FormItem className='space-y-3 relative'>
65+
<FormItem className='relative space-y-3'>
6666
<FormLabel>Notify me about...</FormLabel>
6767
<FormControl>
6868
<RadioGroup
@@ -193,7 +193,7 @@ export function NotificationsForm() {
193193
control={form.control}
194194
name='mobile'
195195
render={({ field }) => (
196-
<FormItem className='flex flex-row items-start space-x-3 space-y-0 relative'>
196+
<FormItem className='relative flex flex-row items-start space-x-3 space-y-0'>
197197
<FormControl>
198198
<Checkbox
199199
checked={field.value}

src/features/tasks/components/tasks-import-dialog.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export function TasksImportDialog({ open, onOpenChange }: Props) {
7878
form.reset()
7979
}}
8080
>
81-
<DialogContent className='sm:max-w-sm gap-2'>
81+
<DialogContent className='gap-2 sm:max-w-sm'>
8282
<DialogHeader className='text-left'>
8383
<DialogTitle>Import Tasks</DialogTitle>
8484
<DialogDescription>
@@ -91,7 +91,7 @@ export function TasksImportDialog({ open, onOpenChange }: Props) {
9191
control={form.control}
9292
name='file'
9393
render={() => (
94-
<FormItem className='space-y-1 mb-2'>
94+
<FormItem className='mb-2 space-y-1'>
9595
<FormLabel>File</FormLabel>
9696
<FormControl>
9797
<Input type='file' {...fileRef} className='h-8' />

src/features/tasks/components/tasks-mutate-drawer.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function TasksMutateDrawer({ open, onOpenChange, currentRow }: Props) {
8888
<form
8989
id='tasks-form'
9090
onSubmit={form.handleSubmit(onSubmit)}
91-
className='space-y-5 flex-1'
91+
className='flex-1 space-y-5'
9292
>
9393
<FormField
9494
control={form.control}
@@ -129,7 +129,7 @@ export function TasksMutateDrawer({ open, onOpenChange, currentRow }: Props) {
129129
control={form.control}
130130
name='label'
131131
render={({ field }) => (
132-
<FormItem className='space-y-3 relative'>
132+
<FormItem className='relative space-y-3'>
133133
<FormLabel>Label</FormLabel>
134134
<FormControl>
135135
<RadioGroup
@@ -167,7 +167,7 @@ export function TasksMutateDrawer({ open, onOpenChange, currentRow }: Props) {
167167
control={form.control}
168168
name='priority'
169169
render={({ field }) => (
170-
<FormItem className='space-y-3 relative'>
170+
<FormItem className='relative space-y-3'>
171171
<FormLabel>Priority</FormLabel>
172172
<FormControl>
173173
<RadioGroup

src/features/tasks/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function Tasks() {
2222
</Header>
2323

2424
<Main>
25-
<div className='mb-2 flex items-center justify-between space-y-2 flex-wrap gap-x-4'>
25+
<div className='mb-2 flex flex-wrap items-center justify-between gap-x-4 space-y-2'>
2626
<div>
2727
<h2 className='text-2xl font-bold tracking-tight'>Tasks</h2>
2828
<p className='text-muted-foreground'>

src/features/users/components/users-action-dialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export function UsersActionDialog({ currentRow, open, onOpenChange }: Props) {
149149
Click save when you&apos;re done.
150150
</DialogDescription>
151151
</DialogHeader>
152-
<ScrollArea className='h-[26.25rem] w-full pr-4 -mr-4 py-1'>
152+
<ScrollArea className='-mr-4 h-[26.25rem] w-full py-1 pr-4'>
153153
<Form {...form}>
154154
<form
155155
id='user-form'

src/features/users/components/users-columns.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ export const columns: ColumnDef<User>[] = [
121121
}
122122

123123
return (
124-
<div className='flex gap-x-2 items-center'>
124+
<div className='flex items-center gap-x-2'>
125125
{userType.icon && (
126126
<userType.icon size={16} className='text-muted-foreground' />
127127
)}
128-
<span className='capitalize text-sm'>{row.getValue('role')}</span>
128+
<span className='text-sm capitalize'>{row.getValue('role')}</span>
129129
</div>
130130
)
131131
},

src/features/users/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function Users() {
2626
</Header>
2727

2828
<Main>
29-
<div className='mb-2 flex items-center justify-between space-y-2 flex-wrap'>
29+
<div className='mb-2 flex flex-wrap items-center justify-between space-y-2'>
3030
<div>
3131
<h2 className='text-2xl font-bold tracking-tight'>User List</h2>
3232
<p className='text-muted-foreground'>

src/routes/_authenticated/route.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ function RouteComponent() {
2020
<div
2121
id='content'
2222
className={cn(
23-
'max-w-full w-full ml-auto',
23+
'ml-auto w-full max-w-full',
2424
'peer-data-[state=collapsed]:w-[calc(100%-var(--sidebar-width-icon)-1rem)]',
2525
'peer-data-[state=expanded]:w-[calc(100%-var(--sidebar-width))]',
26-
'transition-[width] ease-linear duration-200',
27-
'h-svh flex flex-col',
26+
'transition-[width] duration-200 ease-linear',
27+
'flex h-svh flex-col',
2828
'group-data-[scroll-locked=1]/body:h-full',
2929
'group-data-[scroll-locked=1]/body:has-[main.fixed-main]:h-svh'
3030
)}

0 commit comments

Comments
 (0)