Archived
2
0

npm lint.

This commit is contained in:
Miroslav Šedivý 2023-01-28 21:54:26 +01:00
parent 12623866b3
commit dfe8b8b57d
24 changed files with 48 additions and 53 deletions

View File

@ -132,8 +132,7 @@
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import md, { HtmlOutputRule } from 'simple-markdown'
import { Component, Vue } from 'vue-property-decorator'
@Component({ name: 'neko-about' })
export default class extends Vue {

View File

@ -147,8 +147,7 @@
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import { get, set } from '~/utils/localstorage'
import { Component, Vue } from 'vue-property-decorator'
@Component({ name: 'neko-connect' })
export default class extends Vue {

View File

@ -132,7 +132,7 @@
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import { Component, Ref, Vue } from 'vue-property-decorator'
import { Member } from '~/neko/types'
// @ts-ignore
@ -229,11 +229,11 @@
}
}
adminRelease(member: Member) {
adminRelease() {
this.$accessor.remote.adminRelease()
}
adminControl(member: Member) {
adminControl() {
this.$accessor.remote.adminControl()
}

View File

@ -287,9 +287,9 @@
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import { Component, Ref, Vue } from 'vue-property-decorator'
import { directive as onClickaway } from 'vue-clickaway'
import { get, set } from '../utils/localstorage'
import { get } from '../utils/localstorage'
@Component({
name: 'neko-emoji',
@ -356,7 +356,7 @@
this.waitingForPaint = false
let scrollTop = this._scroll.scrollTop
let active = 0
for (const [i, group] of this.groups.entries()) {
for (const [i] of this.groups.entries()) {
let component = this._groups[i]
if (component && component.offsetTop > scrollTop) {
break
@ -368,7 +368,7 @@
}
}
onMouseExit(event: MouseEvent, emoji: string) {
onMouseExit() {
this.hovered = ''
}
@ -382,7 +382,7 @@
this.$emit('picked', emoji)
}
onClickAway(event: MouseEvent) {
onClickAway() {
this.$emit('done')
}
}

View File

@ -157,7 +157,7 @@
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import { Component, Vue } from 'vue-property-decorator'
import { AdminLockResource } from '~/neko/messages'
@Component({ name: 'neko-settings' })

View File

@ -1,5 +1,5 @@
import md, { SingleNodeParserRule, HtmlOutputRule, defaultRules, State, Rules } from 'simple-markdown'
import { Component, Watch, Vue, Prop } from 'vue-property-decorator'
import { Component, Vue, Prop } from 'vue-property-decorator'
const { blockQuote, inlineCode, codeBlock, autolink, newline, escape, strong, text, link, url, em, u, br } =
defaultRules

View File

@ -157,8 +157,7 @@
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import { Member } from '~/neko/types'
import { Component, Ref, Vue } from 'vue-property-decorator'
import Content from './context.vue'
import Avatar from './avatar.vue'

View File

@ -60,7 +60,7 @@
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import { Component, Vue } from 'vue-property-decorator'
import { messages } from '~/locale'
@Component({ name: 'neko-menu' })

View File

@ -97,7 +97,7 @@
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import { Component, Ref, Vue } from 'vue-property-decorator'
import { ScreenResolution } from '~/neko/types'
// @ts-ignore

View File

@ -304,7 +304,7 @@
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import { Component, Watch, Vue } from 'vue-property-decorator'
@Component({ name: 'neko-settings' })
export default class extends Vue {

View File

@ -68,7 +68,7 @@
</style>
<script lang="ts">
import { Component, Ref, Watch, Vue } from 'vue-property-decorator'
import { Component, Vue } from 'vue-property-decorator'
@Component({ name: 'neko-unsupported' })
export default class extends Vue {}

View File

@ -339,12 +339,12 @@
}
@Watch('width')
onWidthChanged(width: number) {
onWidthChanged() {
this.onResize()
}
@Watch('height')
onHeightChanged(height: number) {
onHeightChanged() {
this.onResize()
}
@ -444,7 +444,7 @@
this.$accessor.video.setPlayable(false)
})
this._video.addEventListener('volumechange', (event) => {
this._video.addEventListener('volumechange', () => {
this.$accessor.video.setMuted(this._video.muted)
this.$accessor.video.setVolume(this._video.volume * 100)
})

View File

@ -66,8 +66,8 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
this._ws = new WebSocket(`${url}?password=${encodeURIComponent(password)}`)
this.emit('debug', `connecting to ${this._ws.url}`)
this._ws.onmessage = this.onMessage.bind(this)
this._ws.onerror = (event) => this.onError.bind(this)
this._ws.onclose = (event) => this.onDisconnected.bind(this, new Error('websocket closed'))
this._ws.onerror = () => this.onError.bind(this)
this._ws.onclose = () => this.onDisconnected.bind(this, new Error('websocket closed'))
this._timeout = window.setTimeout(this.onTimeout.bind(this), 15000)
} catch (err: any) {
this.onDisconnected(err)
@ -210,15 +210,15 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
})
}
this._peer.onconnectionstatechange = (event) => {
this._peer.onconnectionstatechange = () => {
this.emit('debug', `peer connection state changed`, this._peer ? this._peer.connectionState : undefined)
}
this._peer.onsignalingstatechange = (event) => {
this._peer.onsignalingstatechange = () => {
this.emit('debug', `peer signaling state changed`, this._peer ? this._peer.signalingState : undefined)
}
this._peer.oniceconnectionstatechange = (event) => {
this._peer.oniceconnectionstatechange = () => {
this._state = this._peer!.iceConnectionState
this.emit('debug', `peer ice connection state changed: ${this._peer!.iceConnectionState}`)

View File

@ -7,7 +7,6 @@ import { accessor } from '~/store'
import {
SystemMessagePayload,
SignalProvidePayload,
MemberListPayload,
MemberDisconnectPayload,
MemberPayload,
@ -19,7 +18,6 @@ import {
ScreenConfigurationsPayload,
ScreenResolutionPayload,
BroadcastStatusPayload,
AdminPayload,
AdminTargetPayload,
AdminLockMessage,
SystemInitPayload,
@ -131,7 +129,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.video.setStream(0)
}
protected [EVENT.DATA](data: any) {}
protected [EVENT.DATA]() {}
/////////////////////////////
// System Events

View File

@ -10,7 +10,7 @@ declare module 'vue/types/vue' {
$swal: VueSwalInstance
}
interface VueConstructor<V extends Vue = Vue> {
interface VueConstructor {
swal: VueSwalInstance
}
}

View File

@ -73,7 +73,7 @@ export const actions = actionTree(
accessor.chat.addEmote({ id, emote })
},
newMessage({ state }, message: Message) {
newMessage(store, message: Message) {
if (accessor.settings.chat_sound) {
new Audio('chat.mp3').play().catch(console.error)
}

View File

@ -53,7 +53,7 @@ export const actions = actionTree(
accessor.files._removeTransfer(transfer)
},
cancelAllTransfers(store) {
cancelAllTransfers() {
for (const t of accessor.files.transfers) {
if (t.status !== 'completed') {
t.abortController?.abort()
@ -62,7 +62,7 @@ export const actions = actionTree(
}
},
refresh(store) {
refresh() {
if (!accessor.connected) {
return
}

View File

@ -63,7 +63,7 @@ export const getters = getterTree(state, {
export const actions = actionTree(
{ state, getters, mutations },
{
initialise(store) {
initialise() {
accessor.emoji.initialise()
accessor.settings.initialise()
},
@ -92,12 +92,12 @@ export const actions = actionTree(
}
},
login({ state }, { displayname, password }: { displayname: string; password: string }) {
login(store, { displayname, password }: { displayname: string; password: string }) {
accessor.setLogin({ displayname, password })
$client.login(password, displayname)
},
logout({ state }) {
logout() {
accessor.setLogin({ displayname: '', password: '' })
set('displayname', '')
set('password', '')

View File

@ -21,7 +21,7 @@ export const getters = getterTree(state, {
hosting: (state, getters, root) => {
return root.user.id === state.id || state.implicitHosting
},
hosted: (state, getters, root) => {
hosted: (state) => {
return state.id !== '' || state.implicitHosting
},
host: (state, getters, root) => {
@ -136,7 +136,7 @@ export const actions = actionTree(
$client.sendMessage(EVENT.ADMIN.RELEASE)
},
adminGive({ getters }, member: string | Member) {
adminGive(store, member: string | Member) {
if (!accessor.connected) {
return
}
@ -160,7 +160,7 @@ export const actions = actionTree(
$client.sendMessage(EVENT.CONTROL.KEYBOARD, { layout: accessor.settings.keyboard_layout })
},
syncKeyboardModifierState({ state, getters }, { capsLock, numLock, scrollLock }) {
syncKeyboardModifierState({ state }, { capsLock, numLock, scrollLock }) {
if (state.keyboardModifierState === keyboardModifierState(capsLock, numLock, scrollLock)) {
return
}

View File

@ -79,13 +79,13 @@ export const actions = actionTree(
}
},
broadcastStatus({ getters }, { url, isActive }) {
broadcastStatus(store, { url, isActive }) {
accessor.settings.setBroadcastStatus({ url, isActive })
},
broadcastCreate({ getters }, url: string) {
broadcastCreate(store, url: string) {
$client.sendMessage(EVENT.BROADCAST.CREATE, { url })
},
broadcastDestroy({ getters }) {
broadcastDestroy() {
$client.sendMessage(EVENT.BROADCAST.DESTROY)
},
},

View File

@ -169,7 +169,7 @@ export const mutations = mutationTree(state, {
export const actions = actionTree(
{ state, getters, mutations },
{
screenConfiguations({ state }) {
screenConfiguations() {
if (!accessor.connected || !accessor.user.admin) {
return
}
@ -177,7 +177,7 @@ export const actions = actionTree(
$client.sendMessage(EVENT.SCREEN.CONFIGURATIONS)
},
screenGet({ state }) {
screenGet() {
if (!accessor.connected) {
return
}
@ -185,7 +185,7 @@ export const actions = actionTree(
$client.sendMessage(EVENT.SCREEN.RESOLUTION)
},
screenSet({ state }, resolution: ScreenResolution) {
screenSet(store, resolution: ScreenResolution) {
if (!accessor.connected || !accessor.user.admin) {
return
}

View File

@ -3,13 +3,13 @@
// Type declarations for Keyboard API
// https://developer.mozilla.org/en-US/docs/Web/API/Keyboard_API
interface Keyboard {
lock(keyCodes?: array<string>): Promise<void>;
unlock(): void;
lock(keyCodes?: array<string>): Promise<void>
unlock(): void
}
interface NavigatorKeyboard {
// Only available in a secure context.
readonly keyboard?: Keyboard;
readonly keyboard?: Keyboard
}
interface Navigator extends NavigatorKeyboard {}

View File

@ -10,13 +10,13 @@ export function makeid(length: number) {
export function lockKeyboard() {
if (navigator && navigator.keyboard) {
navigator.keyboard.lock();
navigator.keyboard.lock()
}
}
export function unlockKeyboard() {
if (navigator && navigator.keyboard) {
navigator.keyboard.unlock();
navigator.keyboard.unlock()
}
}

View File

@ -22,6 +22,6 @@ module.exports = {
},
},
devServer: {
allowedHosts: "all",
allowedHosts: 'all',
},
}