Skip to content

Commit fb3033b

Browse files
authored
Merge pull request #817 from nextcloud-libraries/dependabot/npm_and_yarn/eslint-9.29.0
chore(deps-dev): Bump eslint from 8.57.1 to 9.29.0
2 parents 3031c28 + 4b13ed7 commit fb3033b

15 files changed

+2399
-3548
lines changed

.eslintrc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

eslint.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*!
2+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: CC0-1.0
4+
*/
5+
6+
import { recommendedLibrary } from '@nextcloud/eslint-config'
7+
8+
export default [...recommendedLibrary]

lib/csp-nonce.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: GPL-3.0-or-later
44
*/
55

6-
import { getRequestToken } from './requesttoken'
6+
import { getRequestToken } from './requesttoken.ts'
77

88
/**
99
* Get the CSP nonce for script loading

lib/eventbus.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: GPL-3.0-or-later
44
*/
5-
import { NextcloudUser } from './user'
5+
6+
import type { NextcloudUser } from './user.ts'
67

78
declare module '@nextcloud/event-bus' {
89
export interface NextcloudEvents {

lib/globals.d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*!
2+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: GPL-3.0-or-later
4+
*/
5+
6+
declare global {
7+
interface Window {
8+
_oc_isadmin?: boolean
9+
}
10+
}
11+
12+
export {}

lib/guest.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
/**
1+
/*!
22
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: GPL-3.0-or-later
44
*/
5+
6+
import type { NextcloudUser } from './user.ts'
7+
58
import { getBuilder } from '@nextcloud/browser-storage'
6-
import { NextcloudUser } from './user'
79
import { emit, subscribe } from '@nextcloud/event-bus'
810

911
const browserStorage = getBuilder('public').persist().build()
1012

1113
class GuestUser implements NextcloudUser {
12-
1314
private _displayName: string | null
1415
readonly uid: string
1516
readonly isAdmin: boolean
@@ -27,7 +28,6 @@ class GuestUser implements NextcloudUser {
2728
this._displayName = guest.displayName
2829
browserStorage.setItem('guestNickname', guest.displayName || '')
2930
})
30-
3131
}
3232

3333
get displayName(): string | null {
@@ -39,7 +39,6 @@ class GuestUser implements NextcloudUser {
3939
browserStorage.setItem('guestNickname', displayName)
4040
emit('user:info:changed', this)
4141
}
42-
4342
}
4443

4544
let currentUser: NextcloudUser | undefined
@@ -64,7 +63,8 @@ export function getGuestNickname(): string | null {
6463

6564
/**
6665
* Set the guest nickname for public pages
67-
* @param nickname The nickname to set
66+
*
67+
* @param nickname - The nickname to set
6868
*/
6969
export function setGuestNickname(nickname: string): void {
7070
if (!nickname || nickname.trim().length === 0) {

lib/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: GPL-3.0-or-later
44
*/
5-
export type { CsrfTokenObserver } from './requesttoken'
6-
export type { NextcloudUser } from './user'
75

8-
export { getCSPNonce } from './csp-nonce'
9-
export { getGuestUser, getGuestNickname, setGuestNickname } from './guest'
10-
export { getRequestToken, onRequestTokenUpdate } from './requesttoken'
11-
export { getCurrentUser } from './user'
6+
export type { CsrfTokenObserver } from './requesttoken.ts'
7+
export type { NextcloudUser } from './user.ts'
8+
9+
export { getCSPNonce } from './csp-nonce.ts'
10+
export { getGuestNickname, getGuestUser, setGuestNickname } from './guest.ts'
11+
export { getRequestToken, onRequestTokenUpdate } from './requesttoken.ts'
12+
export { getCurrentUser } from './user.ts'

lib/requesttoken.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: GPL-3.0-or-later
44
*/
5+
56
import { subscribe } from '@nextcloud/event-bus'
67

78
export interface CsrfTokenObserver {
8-
(token: string): void;
9+
(token: string): void
910
}
1011

1112
let token: string | null | undefined
@@ -14,7 +15,7 @@ const observers: CsrfTokenObserver[] = []
1415
/**
1516
* Get current request token
1617
*
17-
* @return {string|null} Current request token or null if not set
18+
* @return Current request token or null if not set
1819
*/
1920
export function getRequestToken(): string | null {
2021
if (token === undefined) {
@@ -40,8 +41,10 @@ subscribe('csrf-token-update', (e: unknown) => {
4041
observers.forEach((observer) => {
4142
try {
4243
observer(token!)
43-
} catch (e) {
44-
console.error('Error updating CSRF token observer', e)
44+
} catch (error) {
45+
// we cannot use the logger as the logger uses this library = circular dependency
46+
// eslint-disable-next-line no-console
47+
console.error('Error updating CSRF token observer', error)
4548
}
4649
})
4750
})

lib/user.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,20 @@
22
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: GPL-3.0-or-later
44
*/
5-
declare global {
6-
interface Window {
7-
_oc_isadmin?: boolean
8-
}
9-
}
105

116
export interface NextcloudUser {
12-
uid: string,
13-
displayName: string | null,
14-
isAdmin: boolean,
7+
uid: string
8+
displayName: string | null
9+
isAdmin: boolean
1510
}
1611

1712
let currentUser: NextcloudUser | null | undefined
1813

19-
const getAttribute = (el: HTMLHeadElement | undefined, attribute: string): string | null => {
14+
/**
15+
* @param el - The element
16+
* @param attribute - The attribute to fetch
17+
*/
18+
function getAttribute(el: HTMLHeadElement | undefined, attribute: string): string | null {
2019
if (el) {
2120
return el.getAttribute(attribute)
2221
}

0 commit comments

Comments
 (0)