chore: fix eslint warnings
This commit is contained in:
parent
1543f0ac79
commit
3e4434c0bc
5 changed files with 7 additions and 10 deletions
|
@ -29,12 +29,9 @@ const DrawName: FunctionComponent<Props> = ({ names }) => {
|
||||||
}
|
}
|
||||||
return <>
|
return <>
|
||||||
<div class="button-group">
|
<div class="button-group">
|
||||||
{names.map(([name, _], i) => {
|
{names.map(([name], i) => {
|
||||||
if (completed.includes(i)) {
|
if (completed.includes(i)) return null;
|
||||||
return null;
|
return <button key={`${i}-${name}`} class="primary" onClick={() => setCurrentPerson(i)}>{name}</button>;
|
||||||
} else {
|
|
||||||
return <button key={i + "-" + name} class="primary" onClick={() => setCurrentPerson(i)}>{name}</button>;
|
|
||||||
}
|
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -22,7 +22,7 @@ const EnterNames: FunctionComponent<Props> = ({ names, start }) => {
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
<ul>
|
<ul>
|
||||||
{names.value.map((name, i) => <li key={i + "-" + name}>
|
{names.value.map((name, i) => <li key={`${i}-${name}`}>
|
||||||
{name}
|
{name}
|
||||||
</li>)}
|
</li>)}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { useEffect } from "preact/hooks";
|
import { useEffect } from "preact/hooks";
|
||||||
|
|
||||||
export function useWindowEvent<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void {
|
export function useWindowEvent<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
window.addEventListener(type, listener, options);
|
window.addEventListener(type, listener, options);
|
||||||
return () => window.removeEventListener(type, listener);
|
return () => window.removeEventListener(type, listener);
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { expect, test } from 'vitest';
|
||||||
import { buildNameMap } from '../src/shuffle';
|
import { buildNameMap } from '../src/shuffle';
|
||||||
|
|
||||||
test('shuffle does not include matching pairs', () => {
|
test('shuffle does not include matching pairs', () => {
|
||||||
const names = Array(10).fill(null).map((_, i) => "Test " + i);
|
const names = Array(10).fill(null).map((_, i) => `Test ${i}`);
|
||||||
for (let i = 0; i < 50000; i++) {
|
for (let i = 0; i < 50000; i++) {
|
||||||
const shuffled = buildNameMap(names);
|
const shuffled = buildNameMap(names);
|
||||||
for (const pair of shuffled) {
|
for (const pair of shuffled) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default defineConfig({
|
||||||
],
|
],
|
||||||
server: {
|
server: {
|
||||||
hmr: {
|
hmr: {
|
||||||
clientPort: parseInt(process.env.CLIENT_PORT || '5173'),
|
clientPort: parseInt(process.env.CLIENT_PORT || '5173', 10),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue