diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 4b04e87a..11d3112e 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -93,6 +93,7 @@ const tsRules = defineConfig({ // note you must disable the base rule as it can report incorrect errors "no-shadow": "off", "@typescript-eslint/no-shadow": ["error"], + "@typescript-eslint/no-redundant-type-constituents": "off", }, }).rules; diff --git a/client/components/Chat.vue b/client/components/Chat.vue index 645704e5..41f7ca11 100644 --- a/client/components/Chat.vue +++ b/client/components/Chat.vue @@ -136,6 +136,7 @@ import ListIgnored from "./Special/ListIgnored.vue"; import {defineComponent, PropType, ref, computed, watch, nextTick, onMounted, Component} from "vue"; import type {ClientNetwork, ClientChan} from "../js/types"; import {useStore} from "../js/store"; +import {SpecialChanType, ChanType} from "../../shared/types/chan"; export default defineComponent({ name: "Chat", @@ -161,13 +162,13 @@ export default defineComponent({ const specialComponent = computed(() => { switch (props.channel.special) { - case "list_bans": + case SpecialChanType.BANLIST: return ListBans as Component; - case "list_invites": + case SpecialChanType.INVITELIST: return ListInvites as Component; - case "list_channels": + case SpecialChanType.CHANNELLIST: return ListChannels as Component; - case "list_ignored": + case SpecialChanType.IGNORELIST: return ListIgnored as Component; } @@ -194,7 +195,7 @@ export default defineComponent({ }; const editTopic = () => { - if (props.channel.type === "channel") { + if (props.channel.type === ChanType.CHANNEL) { props.channel.editTopic = true; } }; diff --git a/client/components/ChatInput.vue b/client/components/ChatInput.vue index 704beda4..8cc2f8ed 100644 --- a/client/components/ChatInput.vue +++ b/client/components/ChatInput.vue @@ -56,13 +56,14 @@ import Mousetrap from "mousetrap"; import {wrapCursor} from "undate"; import autocompletion from "../js/autocompletion"; -import commands from "../js/commands/index"; +import {commands} from "../js/commands/index"; import socket from "../js/socket"; import upload from "../js/upload"; import eventbus from "../js/eventbus"; import {watch, defineComponent, nextTick, onMounted, PropType, ref, onUnmounted} from "vue"; import type {ClientNetwork, ClientChan} from "../js/types"; import {useStore} from "../js/store"; +import {ChanType} from "../../shared/types/chan"; const formattingHotkeys = { "mod+k": "\x03", @@ -130,7 +131,7 @@ export default defineComponent({ }; const getInputPlaceholder = (channel: ClientChan) => { - if (channel.type === "channel" || channel.type === "query") { + if (channel.type === ChanType.CHANNEL || channel.type === ChanType.QUERY) { return `Write to ${channel.name}`; } @@ -185,10 +186,7 @@ export default defineComponent({ return false; } - if ( - Object.prototype.hasOwnProperty.call(commands, cmd) && - commands[cmd].input(args) - ) { + if (Object.prototype.hasOwnProperty.call(commands, cmd) && commands[cmd](args)) { return false; } } diff --git a/client/components/MessageCondensed.vue b/client/components/MessageCondensed.vue index c45a7ac0..218fdeff 100644 --- a/client/components/MessageCondensed.vue +++ b/client/components/MessageCondensed.vue @@ -20,6 +20,7 @@