Addapt linting to dependency update.

This commit is contained in:
John Livingston 2025-05-12 13:01:40 +02:00
parent d36fa2e241
commit c0d2c0caae
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
4 changed files with 16 additions and 6 deletions

View File

@ -39,9 +39,7 @@ export class PtContext {
* Keep them in cache after first request.
*/
public async getSettings (): Promise<LiveChatSettings> {
if (!this._settings) {
this._settings = await this.ptOptions.peertubeHelpers.getSettings() as LiveChatSettings
}
this._settings ??= await this.ptOptions.peertubeHelpers.getSettings() as LiveChatSettings
return this._settings
}
}

View File

@ -54,7 +54,7 @@ function overrideMUCMessageForm (_converse: any, current: Current): void {
class MUCMessageFormloaded extends MUCMessageForm {
async onFormSubmitted (ev?: Event): Promise<void> {
const announcementSelect = this.querySelector('[name=livechat-announcements]')
current.announcementType = announcementSelect?.selectedOptions?.[0]?.value || undefined
current.announcementType = announcementSelect?.selectedOptions?.[0]?.value ?? undefined
try {
await super.onFormSubmitted(ev)
if (announcementSelect) { announcementSelect.selectedIndex = 0 } // set back to default
@ -173,7 +173,7 @@ function onGetOutgoingMessageAttributes (
chatbox: any,
attrs: any
): Parameters<typeof onGetOutgoingMessageAttributes>[3] {
if (!current.announcementType) { return attrs }
if (!current.announcementType) { return attrs } // undefined or ""
const { __ } = _converse
attrs.livechat_announcement_type = current.announcementType

View File

@ -78,7 +78,7 @@ export default tseslint.config(
'@typescript-eslint/no-unsafe-call': 'off', // FIXME: comes with eslint-config-love 84 update, and should be used.
'@typescript-eslint/no-unnecessary-condition': 'off', // FIXME: comes with eslint-config-love 84 update, but seems buggy (false positive).
'@typescript-eslint/prefer-nullish-coalescing': 'off', // disabling, because many false positive (where i want "" to act as false)
'max-len': [
'error',
{

View File

@ -89,17 +89,29 @@ async function initWebchatRouter (options: RegisterServerOptionsV5): Promise<Rou
) {
peertubeHelpers.logger.debug('Trying to load AutoColors...')
const autocolors: AutoColors = {
// eslint-disable-next-line @typescript-eslint/no-base-to-string
mainForeground: req.query._ac_mainForeground?.toString() ?? '',
// eslint-disable-next-line @typescript-eslint/no-base-to-string
mainBackground: req.query._ac_mainBackground?.toString() ?? '',
// eslint-disable-next-line @typescript-eslint/no-base-to-string
greyForeground: req.query._ac_greyForeground?.toString() ?? '',
// eslint-disable-next-line @typescript-eslint/no-base-to-string
greyBackground: req.query._ac_greyBackground?.toString() ?? '',
// eslint-disable-next-line @typescript-eslint/no-base-to-string
menuForeground: req.query._ac_menuForeground?.toString() ?? '',
// eslint-disable-next-line @typescript-eslint/no-base-to-string
menuBackground: req.query._ac_menuBackground?.toString() ?? '',
// eslint-disable-next-line @typescript-eslint/no-base-to-string
inputForeground: req.query._ac_inputForeground?.toString() ?? '',
// eslint-disable-next-line @typescript-eslint/no-base-to-string
inputBackground: req.query._ac_inputBackground?.toString() ?? '',
// eslint-disable-next-line @typescript-eslint/no-base-to-string
buttonForeground: req.query._ac_buttonForeground?.toString() ?? '',
// eslint-disable-next-line @typescript-eslint/no-base-to-string
buttonBackground: req.query._ac_buttonBackground?.toString() ?? '',
// eslint-disable-next-line @typescript-eslint/no-base-to-string
link: req.query._ac_link?.toString() ?? '',
// eslint-disable-next-line @typescript-eslint/no-base-to-string
linkHover: req.query._ac_linkHover?.toString() ?? ''
}
if (!Object.values(autocolors).find(c => c !== '')) {