chore: fix eslint warnings

This commit is contained in:
Ashhhleyyy 2022-11-10 14:56:55 +00:00
parent 1543f0ac79
commit 3e4434c0bc
Signed by: ash
GPG key ID: 83B789081A0878FB
5 changed files with 7 additions and 10 deletions

View file

@ -29,12 +29,9 @@ const DrawName: FunctionComponent<Props> = ({ names }) => {
}
return <>
<div class="button-group">
{names.map(([name, _], i) => {
if (completed.includes(i)) {
return null;
} else {
return <button key={i + "-" + name} class="primary" onClick={() => setCurrentPerson(i)}>{name}</button>;
}
{names.map(([name], i) => {
if (completed.includes(i)) return null;
return <button key={`${i}-${name}`} class="primary" onClick={() => setCurrentPerson(i)}>{name}</button>;
})}
</div>
</>

View file

@ -22,7 +22,7 @@ const EnterNames: FunctionComponent<Props> = ({ names, start }) => {
return <>
<ul>
{names.value.map((name, i) => <li key={i + "-" + name}>
{names.value.map((name, i) => <li key={`${i}-${name}`}>
{name}
</li>)}
</ul>

View file

@ -1,6 +1,6 @@
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(() => {
window.addEventListener(type, listener, options);
return () => window.removeEventListener(type, listener);

View file

@ -2,7 +2,7 @@ import { expect, test } from 'vitest';
import { buildNameMap } from '../src/shuffle';
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++) {
const shuffled = buildNameMap(names);
for (const pair of shuffled) {

View file

@ -31,7 +31,7 @@ export default defineConfig({
],
server: {
hmr: {
clientPort: parseInt(process.env.CLIENT_PORT || '5173'),
clientPort: parseInt(process.env.CLIENT_PORT || '5173', 10),
},
},
});