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

View File

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

View File

@ -132,7 +132,7 @@
</style> </style>
<script lang="ts"> <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' import { Member } from '~/neko/types'
// @ts-ignore // @ts-ignore
@ -229,11 +229,11 @@
} }
} }
adminRelease(member: Member) { adminRelease() {
this.$accessor.remote.adminRelease() this.$accessor.remote.adminRelease()
} }
adminControl(member: Member) { adminControl() {
this.$accessor.remote.adminControl() this.$accessor.remote.adminControl()
} }

View File

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

View File

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

View File

@ -1,5 +1,5 @@
import md, { SingleNodeParserRule, HtmlOutputRule, defaultRules, State, Rules } from 'simple-markdown' 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 } = const { blockQuote, inlineCode, codeBlock, autolink, newline, escape, strong, text, link, url, em, u, br } =
defaultRules defaultRules

View File

@ -157,8 +157,7 @@
</style> </style>
<script lang="ts"> <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'
import Content from './context.vue' import Content from './context.vue'
import Avatar from './avatar.vue' import Avatar from './avatar.vue'

View File

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

View File

@ -97,7 +97,7 @@
</style> </style>
<script lang="ts"> <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' import { ScreenResolution } from '~/neko/types'
// @ts-ignore // @ts-ignore

View File

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

View File

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

View File

@ -339,12 +339,12 @@
} }
@Watch('width') @Watch('width')
onWidthChanged(width: number) { onWidthChanged() {
this.onResize() this.onResize()
} }
@Watch('height') @Watch('height')
onHeightChanged(height: number) { onHeightChanged() {
this.onResize() this.onResize()
} }
@ -444,7 +444,7 @@
this.$accessor.video.setPlayable(false) this.$accessor.video.setPlayable(false)
}) })
this._video.addEventListener('volumechange', (event) => { this._video.addEventListener('volumechange', () => {
this.$accessor.video.setMuted(this._video.muted) this.$accessor.video.setMuted(this._video.muted)
this.$accessor.video.setVolume(this._video.volume * 100) 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._ws = new WebSocket(`${url}?password=${encodeURIComponent(password)}`)
this.emit('debug', `connecting to ${this._ws.url}`) this.emit('debug', `connecting to ${this._ws.url}`)
this._ws.onmessage = this.onMessage.bind(this) this._ws.onmessage = this.onMessage.bind(this)
this._ws.onerror = (event) => this.onError.bind(this) this._ws.onerror = () => this.onError.bind(this)
this._ws.onclose = (event) => this.onDisconnected.bind(this, new Error('websocket closed')) this._ws.onclose = () => this.onDisconnected.bind(this, new Error('websocket closed'))
this._timeout = window.setTimeout(this.onTimeout.bind(this), 15000) this._timeout = window.setTimeout(this.onTimeout.bind(this), 15000)
} catch (err: any) { } catch (err: any) {
this.onDisconnected(err) 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.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.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._state = this._peer!.iceConnectionState
this.emit('debug', `peer ice connection state changed: ${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 { import {
SystemMessagePayload, SystemMessagePayload,
SignalProvidePayload,
MemberListPayload, MemberListPayload,
MemberDisconnectPayload, MemberDisconnectPayload,
MemberPayload, MemberPayload,
@ -19,7 +18,6 @@ import {
ScreenConfigurationsPayload, ScreenConfigurationsPayload,
ScreenResolutionPayload, ScreenResolutionPayload,
BroadcastStatusPayload, BroadcastStatusPayload,
AdminPayload,
AdminTargetPayload, AdminTargetPayload,
AdminLockMessage, AdminLockMessage,
SystemInitPayload, SystemInitPayload,
@ -131,7 +129,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.video.setStream(0) this.$accessor.video.setStream(0)
} }
protected [EVENT.DATA](data: any) {} protected [EVENT.DATA]() {}
///////////////////////////// /////////////////////////////
// System Events // System Events

View File

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

View File

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

View File

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

View File

@ -63,7 +63,7 @@ export const getters = getterTree(state, {
export const actions = actionTree( export const actions = actionTree(
{ state, getters, mutations }, { state, getters, mutations },
{ {
initialise(store) { initialise() {
accessor.emoji.initialise() accessor.emoji.initialise()
accessor.settings.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 }) accessor.setLogin({ displayname, password })
$client.login(password, displayname) $client.login(password, displayname)
}, },
logout({ state }) { logout() {
accessor.setLogin({ displayname: '', password: '' }) accessor.setLogin({ displayname: '', password: '' })
set('displayname', '') set('displayname', '')
set('password', '') set('password', '')

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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