eslint 8.57 WIP:

* tweaking some more rules.
* fixing linting.
This commit is contained in:
John Livingston
2024-09-09 20:01:25 +02:00
parent c010758164
commit fd27105c2c
34 changed files with 165 additions and 36 deletions

View File

@ -2,7 +2,8 @@
//
// SPDX-License-Identifier: AGPL-3.0-only
export function chatRoomMessageOverrides (): {[key: string]: Function} {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
export function chatRoomMessageOverrides (): Record<string, Function> {
return {
/* By default, ConverseJS groups messages from the same users for a 10 minutes period.
* This make no sense in a livechat room. So we override isFollowup to ignore. */

View File

@ -2,7 +2,8 @@
//
// SPDX-License-Identifier: AGPL-3.0-only
export function chatRoomOverrides (): {[key: string]: Function} {
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
export function chatRoomOverrides (): Record<string, Function> {
return {
getActionInfoMessage: function getActionInfoMessage (this: any, code: string, nick: string, actor: any): any {
if (code === '303') {
@ -27,8 +28,9 @@ export function chatRoomOverrides (): {[key: string]: Function} {
initOccupants: function initOccupants (this: any) {
const r = this.__super__.initOccupants()
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
const originalComparatorFunction: Function = this.occupants.comparator
this.occupants.comparator = function (this: any, occupant1: any, occupant2: any): Number {
this.occupants.comparator = function (this: any, occupant1: any, occupant2: any): number {
// Overriding Occupants comparators, to display anonymous users at the end of the list.
const nick1: string = occupant1.getDisplayName()
const nick2: string = occupant2.getDisplayName()

View File

@ -19,7 +19,7 @@ export function customizeMessageAction (plugin: any): void {
try {
txt += this.model.getDisplayName() as string
txt += ' - '
const date = new Date(this.model.get('edited') || this.model.get('time'))
const date = new Date((this.model.get('edited') || this.model.get('time')) as string)
txt += date.toLocaleDateString() + ' ' + date.toLocaleTimeString()
txt += '\n'
} catch {}

View File

@ -2,6 +2,9 @@
//
// SPDX-License-Identifier: AGPL-3.0-only
// FIXME: @stylistic/indent is buggy with strings literrals.
/* eslint-disable @stylistic/indent */
/**
* Do some customization on the toolbar:
* * change the appearance of the toggle occupants button

View File

@ -25,7 +25,7 @@ export function getOpenPromise (): any {
promise.isResolved = false
promise.isPending = false
promise.isRejected = true
throw (e)
throw (e as Error)
}
)
return promise