-
Notifications
You must be signed in to change notification settings - Fork 138
/
Copy path.cursorrules
63 lines (41 loc) · 1.55 KB
/
.cursorrules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
## Solid.js
When writing code for Solid.js, follow these rules:
- Use `For` when mapping over an array. If it's robust component, consider using `Index` instead.
- Use `Show` to conditionally render a component.
- Use `mergeProps` to merge props from `@zag-js/solid` to merge local props within components.
```ts
const mergedProps = mergeProps(() => api().getControlProps(), controlProps)
```
- When splitting props, use `createSplitProps`
```tsx
import { createSplitProps } from '../../utils/create-split-props'
const [useAvatarProps, localProps] = createSplitProps<UseAvatarProps>()(props, ['id', 'ids', 'onStatusChange'])
```
- When creating stories, use `storybook-solidjs` to create stories.
```tsx
import type { Meta } from 'storybook-solidjs'
const meta: Meta = {
title: 'Components / Avatar',
}
export default meta
```
- DO NOT destructure `props` in components, use `createSplitProps` or `splitProps` instead.
## Vue.js
When writing code for Vue.js, follow these rules:
- Always use the `ark` factory and forward the `asChild` props
- Always add `useForwardExpose()` at the end of the script setup
```vue
<script setup lang="ts">
useForwardExpose()
</script>
```
- For boolean props, always use the `withDefaults` function to define the defaults as `undefined`
```tsx
const props = withDefaults(defineProps<SliderRootProps>(), {
disabled: undefined,
invalid: undefined,
readOnly: undefined,
} satisfies BooleanDefaults<RootProps>)
```
- When writing examples, no need to use `useForwardExpose()`
- All icons should be imported from `lucide-vue-next`