Skip to content

Commit 5832d94

Browse files
authored
Configure VSCode Tailwind extension to work in cva and cn args (#5311)
1 parent 2613730 commit 5832d94

11 files changed

+22
-12
lines changed

.eslintrc.cjs

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ const HIVE_RESTRICTED_SYNTAX = [
3636
},
3737
];
3838

39+
const tailwindCallees = ['clsx', 'cn', 'cva', 'cx'];
40+
3941
module.exports = {
4042
ignorePatterns: [
4143
'scripts',
@@ -195,6 +197,7 @@ module.exports = {
195197
files: ['packages/web/app/**'],
196198
settings: {
197199
tailwindcss: {
200+
callees: tailwindCallees,
198201
config: 'packages/web/app/tailwind.config.cjs',
199202
whitelist: ['drag-none', 'graphiql-toolbar-icon', 'graphiql-toolbar-button'],
200203
},
@@ -214,6 +217,7 @@ module.exports = {
214217
rootDir: 'packages/web/docs',
215218
},
216219
tailwindcss: {
220+
callees: tailwindCallees,
217221
config: 'packages/web/docs/tailwind.config.cjs',
218222
},
219223
},

.vscode/settings.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,11 @@
2222
},
2323
"typescript.tsdk": "node_modules/typescript/lib",
2424
"typescript.enablePromptUseWorkspaceTsdk": true,
25-
"git.mergeEditor": false
25+
"git.mergeEditor": false,
26+
"tailwindCSS.experimental.classRegex": [
27+
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
28+
["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
29+
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
30+
["clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
31+
]
2632
}

packages/web/app/src/components/target/settings/schema-contracts.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ function CreateContractDialogContent(props: {
524524
>
525525
<Check
526526
className={cn(
527-
'mr-2 h-4 w-4',
527+
'mr-2 size-4',
528528
form.values.includeTags.includes(value)
529529
? 'opacity-100'
530530
: 'opacity-0',
@@ -637,7 +637,7 @@ function CreateContractDialogContent(props: {
637637
>
638638
<Check
639639
className={cn(
640-
'mr-2 h-4 w-4',
640+
'mr-2 size-4',
641641
form.values.excludeTags.includes(value)
642642
? 'opacity-100'
643643
: 'opacity-0',

packages/web/app/src/components/ui/calendar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function Calendar({ className, classNames, showOutsideDays = true, ...props }: C
3737
),
3838
day: cn(
3939
buttonVariants({ variant: 'ghost' }),
40-
'h-8 w-8 p-0 font-normal aria-selected:opacity-100',
40+
'size-8 p-0 font-normal aria-selected:opacity-100',
4141
),
4242
day_range_start: 'day-range-start',
4343
day_range_end: 'day-range-end',

packages/web/app/src/components/ui/checkbox.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const Checkbox = React.forwardRef<
1010
<CheckboxPrimitive.Root
1111
ref={ref}
1212
className={cn(
13-
'border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground peer h-4 w-4 shrink-0 rounded-sm border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
13+
'border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground peer size-4 shrink-0 rounded-sm border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
1414
className,
1515
)}
1616
{...props}

packages/web/app/src/components/ui/command.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Command = React.forwardRef<
1414
<CommandPrimitive
1515
ref={ref}
1616
className={cn(
17-
'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
17+
'bg-popover text-popover-foreground flex size-full flex-col overflow-hidden rounded-md',
1818
className,
1919
)}
2020
{...props}

packages/web/app/src/components/ui/dropdown-menu.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const DropdownMenuItem = React.forwardRef<
7575
<DropdownMenuPrimitive.Item
7676
ref={ref}
7777
className={cn(
78-
'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm px-2 py-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
78+
'focus:bg-accent focus:text-accent-foreground relative flex cursor-pointer select-none items-center rounded-sm p-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
7979
inset && 'pl-8',
8080
active && 'bg-accent text-orange-500',
8181
className,
@@ -138,7 +138,7 @@ const DropdownMenuLabel = React.forwardRef<
138138
>(({ className, inset, ...props }, ref) => (
139139
<DropdownMenuPrimitive.Label
140140
ref={ref}
141-
className={cn('px-2 py-2 text-sm font-semibold', inset && 'pl-8', className)}
141+
className={cn('p-2 text-sm font-semibold', inset && 'pl-8', className)}
142142
{...props}
143143
/>
144144
));

packages/web/app/src/components/ui/radio-group.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const RadioGroupItem = React.forwardRef<
2121
<RadioGroupPrimitive.Item
2222
ref={ref}
2323
className={cn(
24-
'border-primary text-primary ring-offset-background focus-visible:ring-ring aspect-square h-4 w-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
24+
'border-primary text-primary ring-offset-background focus-visible:ring-ring aspect-square size-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
2525
className,
2626
)}
2727
{...props}

packages/web/app/src/components/ui/spinner.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const Spinner = ({ className }: { className?: string }): ReactElement =>
66
// Copied from https://chakra-ui.com/docs/components/spinner#usage
77
<div
88
className={cn(
9-
'h-6 w-6 animate-spin rounded-full text-orange-500',
9+
'size-6 animate-spin rounded-full text-orange-500',
1010
'border-2 border-b-transparent border-l-transparent border-r-current border-t-current',
1111
'[animation-duration:0.45s]',
1212
className,

packages/web/app/src/components/ui/switch.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const Switch = React.forwardRef<
1818
>
1919
<SwitchPrimitives.Thumb
2020
className={cn(
21-
'bg-background pointer-events-none block h-5 w-5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0',
21+
'bg-background pointer-events-none block size-5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0',
2222
)}
2323
/>
2424
</SwitchPrimitives.Root>

packages/web/app/src/stories/schema-filter.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const Template = () => {
7979
onSelect={() => handleChange(schema.service)}
8080
>
8181
<Check
82-
className={cn('mr-2 h-4 w-4', term === schema.id ? 'opacity-100' : 'opacity-0')}
82+
className={cn('mr-2 size-4', term === schema.id ? 'opacity-100' : 'opacity-0')}
8383
/>
8484
{schema.service}
8585
</CommandItem>

0 commit comments

Comments
 (0)