From d748ba2c51211d3a2833fd1cb6ef898bc149d486 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 4 Jul 2022 16:39:04 +0200 Subject: fix lint no-prototype-builtins --- packages/client/src/scripts/array.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/client/src/scripts') diff --git a/packages/client/src/scripts/array.ts b/packages/client/src/scripts/array.ts index 29d027de14..26c6195d66 100644 --- a/packages/client/src/scripts/array.ts +++ b/packages/client/src/scripts/array.ts @@ -98,7 +98,7 @@ export function groupOn(f: (x: T) => S, xs: T[]): T[][] { export function groupByX(collections: T[], keySelector: (x: T) => string) { return collections.reduce((obj: Record, item: T) => { const key = keySelector(item); - if (!obj.hasOwnProperty(key)) { + if (typeof obj[key] === 'undefined') { obj[key] = []; } -- cgit v1.2.3-freya From a228d1ddaa66c8b1acafc38b05a958b497582a6a Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 4 Jul 2022 16:46:48 +0200 Subject: fix lint @typescript-eslint/ban-types --- packages/client/src/components/global/router-view.vue | 3 --- packages/client/src/components/tag-cloud.vue | 2 -- packages/client/src/scripts/autocomplete.ts | 2 +- packages/client/src/scripts/hotkey.ts | 8 +++++--- packages/client/src/scripts/url.ts | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) (limited to 'packages/client/src/scripts') diff --git a/packages/client/src/components/global/router-view.vue b/packages/client/src/components/global/router-view.vue index 7138faaa9d..fca2371f0d 100644 --- a/packages/client/src/components/global/router-view.vue +++ b/packages/client/src/components/global/router-view.vue @@ -13,9 +13,6 @@ const props = defineProps<{ router?: Router; }>(); -const emit = defineEmits<{ -}>(); - const router = props.router ?? inject('router'); if (router == null) { diff --git a/packages/client/src/components/tag-cloud.vue b/packages/client/src/components/tag-cloud.vue index 5ffa7321e4..9f3bc1c603 100644 --- a/packages/client/src/components/tag-cloud.vue +++ b/packages/client/src/components/tag-cloud.vue @@ -13,8 +13,6 @@ import { onMounted, ref, watch, PropType, onBeforeUnmount } from 'vue'; import tinycolor from 'tinycolor2'; -const props = defineProps<{}>(); - const loaded = !!window.TagCanvas; const SAFE_FOR_HTML_ID = 'abcdefghijklmnopqrstuvwxyz'; const computedStyle = getComputedStyle(document.documentElement); diff --git a/packages/client/src/scripts/autocomplete.ts b/packages/client/src/scripts/autocomplete.ts index 8d9bdee8f5..3ef6224175 100644 --- a/packages/client/src/scripts/autocomplete.ts +++ b/packages/client/src/scripts/autocomplete.ts @@ -8,7 +8,7 @@ export class Autocomplete { x: Ref; y: Ref; q: Ref; - close: Function; + close: () => void; } | null; private textarea: HTMLInputElement | HTMLTextAreaElement; private currentType: string; diff --git a/packages/client/src/scripts/hotkey.ts b/packages/client/src/scripts/hotkey.ts index fd9c74f6c8..bd8c3b6cab 100644 --- a/packages/client/src/scripts/hotkey.ts +++ b/packages/client/src/scripts/hotkey.ts @@ -1,6 +1,8 @@ import keyCode from './keycode'; -type Keymap = Record; +type Callback = (ev: KeyboardEvent) => void; + +type Keymap = Record; type Pattern = { which: string[]; @@ -11,14 +13,14 @@ type Pattern = { type Action = { patterns: Pattern[]; - callback: Function; + callback: Callback; allowRepeat: boolean; }; const parseKeymap = (keymap: Keymap) => Object.entries(keymap).map(([patterns, callback]): Action => { const result = { patterns: [], - callback: callback, + callback, allowRepeat: true } as Action; diff --git a/packages/client/src/scripts/url.ts b/packages/client/src/scripts/url.ts index 542b00e0f0..86735de9f0 100644 --- a/packages/client/src/scripts/url.ts +++ b/packages/client/src/scripts/url.ts @@ -1,4 +1,4 @@ -export function query(obj: {}): string { +export function query(obj: Record): string { const params = Object.entries(obj) .filter(([, v]) => Array.isArray(v) ? v.length : v !== undefined) .reduce((a, [k, v]) => (a[k] = v, a), {} as Record); -- cgit v1.2.3-freya