Skip to content

Commit 5258ac8

Browse files
committed
chore: migrated to biome.
1 parent 22e3f1e commit 5258ac8

29 files changed

+538
-489
lines changed

.prettierrc

Lines changed: 0 additions & 10 deletions
This file was deleted.

.zed/settings.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"lsp": {
3+
"biome": {
4+
"settings": {
5+
"require_config_file": true
6+
}
7+
}
8+
},
9+
"languages": {
10+
"JavaScript": {
11+
"use_on_type_format": false,
12+
"formatter": { "language_server": { "name": "biome" } },
13+
"code_actions_on_format": {
14+
"source.fixAll.biome": true,
15+
"source.organizeImports.biome": true
16+
}
17+
},
18+
"TypeScript": {
19+
"use_on_type_format": false,
20+
"formatter": { "language_server": { "name": "biome" } },
21+
"code_actions_on_format": {
22+
"source.fixAll.biome": true,
23+
"source.organizeImports.biome": true
24+
}
25+
},
26+
"TSX": {
27+
"use_on_type_format": false,
28+
"formatter": { "language_server": { "name": "biome" } },
29+
"code_actions_on_format": {
30+
"source.fixAll.biome": true,
31+
"source.organizeImports.biome": true
32+
}
33+
},
34+
"CSS": {
35+
"use_on_type_format": false,
36+
"formatter": { "language_server": { "name": "biome" } },
37+
"code_actions_on_format": {
38+
"source.fixAll.biome": true,
39+
"source.organizeImports.biome": true
40+
}
41+
}
42+
}
43+
}

biome.jsonc

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"formatter": {
4+
"enabled": true,
5+
"formatWithErrors": false,
6+
"indentStyle": "space",
7+
"indentWidth": 2,
8+
"lineWidth": 100
9+
},
10+
"files": {
11+
"includes": [
12+
"**",
13+
"!**/dist/**/*",
14+
"!**/*.js",
15+
"!**/*.cjs",
16+
"!**/*.mjs",
17+
"!src/route-tree.gen.ts"
18+
]
19+
},
20+
"linter": {
21+
"enabled": true,
22+
"domains": {
23+
"solid": "recommended"
24+
},
25+
"rules": {
26+
"suspicious": {
27+
"noExplicitAny": "off",
28+
"noUnknownAtRules": "off",
29+
"noAssignInExpressions": "off"
30+
},
31+
"style": {
32+
"noNonNullAssertion": "off"
33+
},
34+
"a11y": {
35+
"useKeyWithClickEvents": "off",
36+
"noStaticElementInteractions": "off",
37+
"useButtonType": "off",
38+
"noSvgWithoutTitle": "off"
39+
},
40+
"correctness": {
41+
"noUnusedVariables": "warn"
42+
},
43+
"complexity": {
44+
"noStaticOnlyClass": "off",
45+
"noUselessFragments": "off"
46+
},
47+
"nursery": {
48+
"useSortedClasses": {
49+
"fix": "safe",
50+
"level": "on",
51+
"options": {
52+
"attributes": ["classList", ".*Class"],
53+
"functions": ["clsx", "cva", "tw", "tw.*"]
54+
}
55+
}
56+
}
57+
}
58+
},
59+
"css": {
60+
"parser": {
61+
"tailwindDirectives": true
62+
}
63+
},
64+
"javascript": {
65+
"formatter": {
66+
"trailingCommas": "es5",
67+
"semicolons": "asNeeded"
68+
}
69+
}
70+
}

bun.lockb

9.45 KB
Binary file not shown.

dev/components/demos/base-demo.tsx

Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import { clsx } from 'clsx';
1+
// Tabs
2+
import { Tabs } from "@kobalte/core/tabs"
3+
import { clsx } from "clsx"
24
import {
5+
type ComponentProps,
36
children,
4-
ComponentProps,
57
createSignal,
6-
FlowProps,
7-
JSX,
8+
type FlowProps,
9+
type JSX,
810
mergeProps,
911
Show,
1012
splitProps,
11-
} from 'solid-js';
12-
13-
// Tabs
14-
import { Tabs } from '@kobalte/core/tabs';
13+
} from "solid-js"
1514

1615
// TODO: Dropdown (use @kobalte)
1716
// Dropdown
@@ -30,84 +29,84 @@ import { Tabs } from '@kobalte/core/tabs';
3029
// type MenuProps
3130
// } from '@headlessui/react'
3231

33-
type TabValue = 'preview' | 'code';
32+
type TabValue = "preview" | "code"
3433

3534
// Switch
36-
import { Switch } from '@kobalte/core/switch';
35+
import { Switch } from "@kobalte/core/switch"
3736

3837
// ===========================================================================
3938
// UI
4039
// ===========================================================================
4140

4241
export type DemoProps = {
43-
ref?: HTMLDivElement;
44-
children: JSX.Element;
45-
class?: string;
46-
defaultValue?: TabValue;
47-
code?: JSX.Element;
48-
minHeight?: string;
49-
title?: JSX.Element;
50-
};
42+
ref?: HTMLDivElement
43+
children: JSX.Element
44+
class?: string
45+
defaultValue?: TabValue
46+
code?: JSX.Element
47+
minHeight?: string
48+
title?: JSX.Element
49+
}
5150

52-
type Props = DemoProps & { onClick?: () => void };
51+
type Props = DemoProps & { onClick?: () => void }
5352

5453
function Demo(props: FlowProps<Props>) {
5554
const _props = mergeProps(
5655
{
57-
defaultValue: 'preview',
58-
minHeight: 'min-h-[20rem]',
56+
defaultValue: "preview",
57+
minHeight: "min-h-[20rem]",
5958
children: undefined,
6059
renderTitle: false,
6160
},
62-
props,
63-
);
61+
props
62+
)
6463

65-
const [knowsToClick, setKnowsToClick] = createSignal(false);
66-
const [active, setActive] = createSignal(_props.defaultValue);
64+
const [knowsToClick, setKnowsToClick] = createSignal(false)
65+
const [active, setActive] = createSignal(_props.defaultValue)
6766

6867
function handleClick() {
69-
if (!_props.onClick) return;
68+
if (!_props.onClick) return
7069

71-
setKnowsToClick(true);
72-
_props?.onClick?.();
70+
setKnowsToClick(true)
71+
_props?.onClick?.()
7372
}
7473

7574
const handleMouseDown: JSX.EventHandler<HTMLElement, MouseEvent> = (event) => {
76-
if (!_props.onClick) return;
75+
if (!_props.onClick) return
7776

7877
// Prevent selection of text:
7978
// https://stackoverflow.com/a/43321596
8079
if (event.detail > 1) {
81-
event.preventDefault();
80+
event.preventDefault()
8281
}
83-
};
82+
}
8483

8584
/** Prevent doublle-render when using it in <Show /> https://github.com/solidjs/solid/issues/2345#issuecomment-2427189199 */
86-
const renderedTitle = children(() => _props.title);
85+
const renderedTitle = children(() => _props.title)
8786

8887
return (
8988
<Tabs
9089
ref={_props.ref}
91-
class={clsx(active() === 'code' && 'dark', 'Demo text-primary not-prose relative isolate')} // reset text color if inside prose
90+
class={clsx(active() === "code" && "dark", "Demo not-prose relative isolate text-primary")} // reset text color if inside prose
9291
value={active()}
9392
onChange={(val) => setActive(val as TabValue)}
9493
// onValueChange={(val) => setActive(val as TabValue)}
9594
>
9695
<Show when={_props.code}>
9796
{/* <MotionConfig transition={{ layout: { type: 'spring', duration: 0.25, bounce: 0 } }}> */}
98-
<Tabs.List class="bg-zinc-150/90 absolute right-3 top-3 z-10 flex gap-1 rounded-full p-1 backdrop-blur-lg dark:bg-black/60">
97+
<Tabs.List class="absolute top-3 right-3 z-10 flex gap-1 rounded-full bg-zinc-150/90 p-1 backdrop-blur-lg dark:bg-black/60">
9998
<Tabs.Trigger
10099
value="preview"
101100
class={clsx(
102-
active() !== 'preview' && 'hover:transition-[color]',
103-
'dark:text-muted hover:text-primary aria-selected:text-primary relative px-2 py-1 text-xs/4 font-medium text-zinc-600',
101+
active() !== "preview" && "hover:transition-[color]",
102+
"relative px-2 py-1 font-medium text-xs/4 text-zinc-600 hover:text-primary aria-selected:text-primary dark:text-muted"
104103
)}
105104
>
106-
<Show when={active() === 'preview'}>
105+
<Show when={active() === "preview"}>
107106
{/* // Motion.div */}
108107
<div
109-
class="prefers-dark:!bg-white/15 absolute inset-0 -z-10 size-full bg-white shadow-sm dark:bg-white/25"
110-
style={{ 'border-radius': '999' }}
108+
class="prefers-dark:!bg-white/15 -z-10 absolute inset-0 size-full bg-white shadow-sm dark:bg-white/25"
109+
style={{ "border-radius": "999" }}
111110
// layout
112111
// layoutId={`${id}active`}
113112
/>
@@ -117,15 +116,15 @@ function Demo(props: FlowProps<Props>) {
117116
<Tabs.Trigger
118117
value="code"
119118
class={clsx(
120-
active() !== 'code' && 'hover:transition-[color]',
121-
'dark:text-muted hover:text-primary aria-selected:text-primary relative px-2 py-1 text-xs/4 font-medium text-zinc-600',
119+
active() !== "code" && "hover:transition-[color]",
120+
"relative px-2 py-1 font-medium text-xs/4 text-zinc-600 hover:text-primary aria-selected:text-primary dark:text-muted"
122121
)}
123122
>
124123
<Show when={active() === _props.code}>
125124
{/* // Motion.div */}
126125
<div
127-
class="prefers-dark:!bg-white/15 absolute inset-0 -z-10 size-full bg-white shadow-sm dark:bg-white/25"
128-
style={{ 'border-radius': '999' }}
126+
class="prefers-dark:!bg-white/15 -z-10 absolute inset-0 size-full bg-white shadow-sm dark:bg-white/25"
127+
style={{ "border-radius": "999" }}
129128
// layout
130129
// layoutId={`${id}active`}
131130
/>
@@ -139,24 +138,24 @@ function Demo(props: FlowProps<Props>) {
139138
value="preview"
140139
class={clsx(
141140
_props.class,
142-
'border-faint relative rounded-lg border data-[state=inactive]:hidden',
141+
"relative rounded-lg border border-faint data-[state=inactive]:hidden"
143142
)}
144143
>
145144
<Show when={renderedTitle()}>
146-
<div class="absolute left-3 top-3">{renderedTitle()}</div>
145+
<div class="absolute top-3 left-3">{renderedTitle()}</div>
147146
</Show>
148147

149148
<div
150-
class={clsx(_props.minHeight, 'flex flex-col items-center justify-center p-5 pb-6')}
149+
class={clsx(_props.minHeight, "flex flex-col items-center justify-center p-5 pb-6")}
151150
onClick={handleClick}
152151
onMouseDown={handleMouseDown}
153152
>
154153
{_props.children}
155154
{_props?.onClick && (
156155
<span
157156
class={clsx(
158-
'absolute bottom-5 left-0 w-full text-center text-sm text-zinc-400 transition-opacity duration-200 ease-out',
159-
knowsToClick() && 'opacity-0',
157+
"absolute bottom-5 left-0 w-full text-center text-sm text-zinc-400 transition-opacity duration-200 ease-out",
158+
knowsToClick() && "opacity-0"
160159
)}
161160
>
162161
Click anywhere to change numbers
@@ -168,19 +167,19 @@ function Demo(props: FlowProps<Props>) {
168167
<Tabs.Content value="code">{_props?.code}</Tabs.Content>«
169168
</Show>
170169
</Tabs>
171-
);
170+
)
172171
}
173172

174-
export default Demo;
173+
export default Demo
175174

176-
export function DemoTitle(props: JSX.IntrinsicElements['span'] & { children: string }) {
177-
const [_props, other] = splitProps(props, ['class', 'children']);
175+
export function DemoTitle(props: JSX.IntrinsicElements["span"] & { children: string }) {
176+
const [_props, other] = splitProps(props, ["class", "children"])
178177

179178
return (
180-
<span {...other} class={clsx(props.class, 'px-2 py-1.5 text-sm')}>
179+
<span {...other} class={clsx(props.class, "px-2 py-1.5 text-sm")}>
181180
{props.children}
182181
</span>
183-
);
182+
)
184183
}
185184

186185
// export function DemoMenu(props: MenuProps) {
@@ -243,19 +242,19 @@ export function DemoTitle(props: JSX.IntrinsicElements['span'] & { children: str
243242
// }
244243

245244
export function DemoSwitch(props: ComponentProps<typeof Switch>) {
246-
const [_props, other] = splitProps(props, ['class', 'children']);
245+
const [_props, other] = splitProps(props, ["class", "children"])
247246

248247
return (
249248
<Switch {...other} class="flex items-center gap-x-2">
250249
<Switch.Control
251250
class={clsx(
252251
props.class,
253-
'group relative flex h-6 w-11 cursor-pointer rounded-full bg-zinc-200 p-0.5 transition-colors duration-200 ease-in-out focus:outline-none data-[checked]:bg-zinc-950 data-[focus]:outline-2 data-[focus]:outline-blue-500 dark:bg-zinc-800 dark:data-[checked]:bg-zinc-50',
252+
"group relative flex h-6 w-11 cursor-pointer rounded-full bg-zinc-200 p-0.5 transition-colors duration-200 ease-in-out focus:outline-none data-[checked]:bg-zinc-950 data-[focus]:outline-2 data-[focus]:outline-blue-500 dark:bg-zinc-800 dark:data-[checked]:bg-zinc-50"
254253
)}
255254
>
256255
<Switch.Thumb class="spring-bounce-0 spring-duration-200 pointer-events-none inline-block size-5 rounded-full bg-white shadow-lg ring-0 transition-transform group-data-[checked]:translate-x-5 dark:bg-zinc-950" />
257256
</Switch.Control>
258257
<Switch.Label class="text-xs">{props.children as any}</Switch.Label>
259258
</Switch>
260-
);
259+
)
261260
}

0 commit comments

Comments
 (0)