Skip to content

Commit 2860c1f

Browse files
ci: apply automated fixes
1 parent 6ceb473 commit 2860c1f

5 files changed

Lines changed: 60 additions & 32 deletions

File tree

packages/devtools/src/context/devtools-store.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import type { TanStackDevtoolsPlugin } from './devtools-context'
33

44
export type ModifierKey = 'Alt' | 'Control' | 'Meta' | 'Shift'
55
type KeyboardKey = ModifierKey | (string & {})
6-
export const keyboardModifiers: Array<ModifierKey> = ['Alt', 'Control', 'Meta', 'Shift']
6+
export const keyboardModifiers: Array<ModifierKey> = [
7+
'Alt',
8+
'Control',
9+
'Meta',
10+
'Shift',
11+
]
712

813
type TriggerPosition =
914
| 'top-left'

packages/devtools/src/devtools.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function DevTools() {
3030
setIsOpen(!open)
3131
setPersistOpen(!open)
3232
}
33-
createEffect(() => { })
33+
createEffect(() => {})
3434
// Used to resize the panel
3535
const handleDragStart = (
3636
panelElement: HTMLDivElement | undefined,
@@ -134,8 +134,12 @@ export default function DevTools() {
134134
})
135135
createEffect(() => {
136136
// we create all combinations of modifiers
137-
const modifiers = settings().openHotkey.filter(key => keyboardModifiers.includes(key as any))
138-
const nonModifiers = settings().openHotkey.filter(key => !keyboardModifiers.includes(key as any))
137+
const modifiers = settings().openHotkey.filter((key) =>
138+
keyboardModifiers.includes(key as any),
139+
)
140+
const nonModifiers = settings().openHotkey.filter(
141+
(key) => !keyboardModifiers.includes(key as any),
142+
)
139143

140144
const allModifierCombinations = getAllPermutations(modifiers)
141145
console.log(allModifierCombinations, nonModifiers)
@@ -145,7 +149,6 @@ export default function DevTools() {
145149
toggleOpen()
146150
})
147151
}
148-
149152
})
150153

151154
return (

packages/devtools/src/styles/use-styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ const stylesFactory = () => {
316316
settingsModifiers: css`
317317
display: flex;
318318
gap: 0.5rem;
319-
`
319+
`,
320320
}
321321
}
322322

packages/devtools/src/tabs/settings-tab.tsx

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Show, createMemo, } from 'solid-js'
1+
import { Show, createMemo } from 'solid-js'
22
import { Button, Checkbox, Input, Select } from '@tanstack/devtools-ui'
33
import { useDevtoolsSettings } from '../context/use-devtools-context'
44
import { uppercaseFirstLetter } from '../utils/sanitize'
@@ -9,19 +9,22 @@ export const SettingsTab = () => {
99
const { setSettings, settings } = useDevtoolsSettings()
1010
const styles = useStyles()
1111
const hotkey = createMemo(() => settings().openHotkey)
12-
const modifiers: Array<ModifierKey> = ["Control", "Alt", "Meta", "Shift"]
12+
const modifiers: Array<ModifierKey> = ['Control', 'Alt', 'Meta', 'Shift']
1313
const changeHotkey = (newHotkey: ModifierKey) => () => {
1414
if (hotkey().includes(newHotkey)) {
1515
return setSettings({
16-
openHotkey: hotkey().filter(key => key !== newHotkey),
17-
});
16+
openHotkey: hotkey().filter((key) => key !== newHotkey),
17+
})
1818
}
19-
const existingModifiers = hotkey().filter(key => modifiers.includes(key as any));
20-
const otherModifiers = hotkey().filter(key => !modifiers.includes(key as any));
19+
const existingModifiers = hotkey().filter((key) =>
20+
modifiers.includes(key as any),
21+
)
22+
const otherModifiers = hotkey().filter(
23+
(key) => !modifiers.includes(key as any),
24+
)
2125
setSettings({
2226
openHotkey: [...existingModifiers, newHotkey, ...otherModifiers],
23-
});
24-
27+
})
2528
}
2629
return (
2730
<div class={styles().settingsContainer}>
@@ -154,40 +157,57 @@ export const SettingsTab = () => {
154157
<div class={styles().settingsGroup}>
155158
<div class={styles().settingsModifiers}>
156159
<Show keyed when={hotkey()}>
157-
<Button variant="success" onclick={changeHotkey("Shift")} outline={!hotkey().includes("Shift")}>
160+
<Button
161+
variant="success"
162+
onclick={changeHotkey('Shift')}
163+
outline={!hotkey().includes('Shift')}
164+
>
158165
Shift
159166
</Button>
160-
<Button variant="success" onclick={changeHotkey("Alt")} outline={!hotkey().includes("Alt")}>
167+
<Button
168+
variant="success"
169+
onclick={changeHotkey('Alt')}
170+
outline={!hotkey().includes('Alt')}
171+
>
161172
Alt
162173
</Button>
163-
<Button variant="success" onclick={changeHotkey("Meta")} outline={!hotkey().includes("Meta")}>
174+
<Button
175+
variant="success"
176+
onclick={changeHotkey('Meta')}
177+
outline={!hotkey().includes('Meta')}
178+
>
164179
Meta
165180
</Button>
166-
<Button variant="success" onclick={changeHotkey("Control")} outline={!hotkey().includes("Control")}>
181+
<Button
182+
variant="success"
183+
onclick={changeHotkey('Control')}
184+
outline={!hotkey().includes('Control')}
185+
>
167186
Control
168187
</Button>
169-
170188
</Show>
171189
</div>
172-
173190
<Input
174191
label="Hotkey to open/close devtools"
175192
description="Use '+' to combine keys (e.g., 'A+B' or 'D')"
176193
placeholder="A"
177-
value={hotkey().filter(key => !(["Shift", "Meta", "Alt", "Ctrl"].includes(key))).join('+')}
194+
value={hotkey()
195+
.filter((key) => !['Shift', 'Meta', 'Alt', 'Ctrl'].includes(key))
196+
.join('+')}
178197
onChange={(e) =>
179198
setSettings({
180199
openHotkey: [
181-
...hotkey().filter(key => (["Shift", "Meta", "Alt", "Ctrl"].includes(key)))],
200+
...hotkey().filter((key) =>
201+
['Shift', 'Meta', 'Alt', 'Ctrl'].includes(key),
202+
),
203+
],
182204
...e
183205
.split('+')
184206
.map((key) => uppercaseFirstLetter(key))
185207
.filter(Boolean),
186-
187208
})
188209
}
189210
/>
190-
191211
Final shortcut is: {hotkey().join(' + ')}
192212
</div>
193213
</div>

packages/devtools/src/utils/sanitize.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ export const uppercaseFirstLetter = (value: string) =>
1111
value.charAt(0).toUpperCase() + value.slice(1)
1212

1313
export const getAllPermutations = <T extends any>(arr: Array<T>) => {
14-
const res: Array<Array<T>> = [];
14+
const res: Array<Array<T>> = []
1515

1616
function permutate(arr: Array<T>, start: number) {
1717
if (start === arr.length - 1) {
18-
res.push([...arr] as any);
19-
return;
18+
res.push([...arr] as any)
19+
return
2020
}
2121
for (let i = start; i < arr.length; i++) {
22-
[arr[start], arr[i]] = [arr[i]!, arr[start]!];
23-
permutate(arr, start + 1);
24-
[arr[start], arr[i]] = [arr[i]!, arr[start]];
22+
;[arr[start], arr[i]] = [arr[i]!, arr[start]!]
23+
permutate(arr, start + 1)
24+
;[arr[start], arr[i]] = [arr[i]!, arr[start]]
2525
}
2626
}
2727
permutate(arr, 0)
2828

29-
return res;
30-
}
29+
return res
30+
}

0 commit comments

Comments
 (0)