Skip to content

Commit

Permalink
Fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
somebody1234 committed Dec 19, 2024
1 parent 97b3515 commit 771a863
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/gui/src/common/services/LocalBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export function extractTypeAndId<Id extends AssetId>(id: Id): AssetTypeAndId {
* Class for sending requests to the Project Manager API endpoints.
* This is used instead of the cloud backend API when managing local projects from the dashboard.
*/
export default class LocalBackend extends Backend {
export class LocalBackend extends Backend {
readonly type = BackendType.local
/** All files that have been uploaded to the Project Manager. */
uploadedFiles: Map<string, UploadedLargeAsset> = new Map()
Expand Down
8 changes: 3 additions & 5 deletions app/gui/src/common/services/RemoteBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ interface RemoteBackendPostOptions {
}

/** Class for sending requests to the Cloud backend API endpoints. */
export default class RemoteBackend extends Backend {
export class RemoteBackend extends Backend {
readonly type = BackendType.remote
private user: Mutable<User> | null = null

Expand Down Expand Up @@ -268,7 +268,6 @@ export default class RemoteBackend extends Backend {
response == null || response.headers.get('Content-Type') !== 'application/json' ?
{ message: 'unknown error' }
// This is SAFE only when the response has been confirmed to have an erroring status code.
// eslint-disable-next-line no-restricted-syntax
: ((await response.json()) as RemoteBackendError)
const message = `${this.getText(textId, ...replacements)}: ${error.message}.`
this.logger.error(message)
Expand Down Expand Up @@ -436,7 +435,7 @@ export default class RemoteBackend extends Backend {
/** Upload a new profile picture for the current user. */
override async uploadUserPicture(params: UploadPictureRequestParams, file: Blob): Promise<User> {
const paramsString = new URLSearchParams({
// eslint-disable-next-line @typescript-eslint/naming-convention, camelcase
// eslint-disable-next-line camelcase
...(params.fileName != null ? { file_name: params.fileName } : {}),
}).toString()
const path = `${UPLOAD_USER_PICTURE_PATH}?${paramsString}`
Expand Down Expand Up @@ -504,7 +503,7 @@ export default class RemoteBackend extends Backend {
file: Blob,
): Promise<OrganizationInfo> {
const paramsString = new URLSearchParams({
// eslint-disable-next-line @typescript-eslint/naming-convention, camelcase
// eslint-disable-next-line camelcase
...(params.fileName != null ? { file_name: params.fileName } : {}),
}).toString()
const path = `${UPLOAD_ORGANIZATION_PICTURE_PATH}?${paramsString}`
Expand Down Expand Up @@ -594,7 +593,6 @@ export default class RemoteBackend extends Backend {
const ret = (await response.json()).assets
.map((asset) =>
merge(asset, {
// eslint-disable-next-line no-restricted-syntax
type: asset.id.match(/^(.+?)-/)?.[1] as AssetType,
// `Users` and `Teams` folders are virtual, so their children incorrectly have
// the organization root id as their parent id.
Expand Down
4 changes: 2 additions & 2 deletions app/gui/src/dashboard/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ import { APP_BASE_URL } from '#/utilities/appBaseUrl'
import { isElementPartOfMonaco, isElementTextInput } from '#/utilities/event'
import LocalStorage from '#/utilities/LocalStorage'
import { STATIC_QUERY_OPTIONS } from '#/utilities/reactQuery'
import LocalBackend from '@common/services/LocalBackend'
import { LocalBackend } from '@common/services/LocalBackend'
import ProjectManager, * as projectManager from '@common/services/ProjectManager'

Check failure on line 113 in app/gui/src/dashboard/App.tsx

View workflow job for this annotation

GitHub Actions / 🧹 GUI Lint Results

app/gui/src/dashboard/App.tsx#L113

[no-restricted-syntax] No default imports from modules. Add to `DEFAULT_IMPORT_ONLY_MODULES` in `eslint.config.js` if the module only has a default export.

Check failure on line 113 in app/gui/src/dashboard/App.tsx

View workflow job for this annotation

GitHub Actions / 🧹 GUI Lint Results

app/gui/src/dashboard/App.tsx#L113

[no-restricted-syntax] No default imports from modules. Add to `DEFAULT_IMPORT_ONLY_MODULES` in `eslint.config.js` if the module only has a default export.

Check failure on line 113 in app/gui/src/dashboard/App.tsx

View workflow job for this annotation

GitHub Actions / 🧹 GUI Lint Results

app/gui/src/dashboard/App.tsx#L113

[no-restricted-syntax] No default imports from modules. Add to `DEFAULT_IMPORT_ONLY_MODULES` in `eslint.config.js` if the module only has a default export.

Check failure on line 113 in app/gui/src/dashboard/App.tsx

View workflow job for this annotation

GitHub Actions / 🧹 GUI Lint Results

app/gui/src/dashboard/App.tsx#L113

[no-restricted-syntax] No default imports from modules. Add to `DEFAULT_IMPORT_ONLY_MODULES` in `eslint.config.js` if the module only has a default export.
import RemoteBackend from '@common/services/RemoteBackend'
import { RemoteBackend } from '@common/services/RemoteBackend'

declare module '#/utilities/LocalStorage' {
/** */
Expand Down
2 changes: 1 addition & 1 deletion app/gui/src/dashboard/hooks/backendHooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ import { useSetModal } from '#/providers/ModalProvider'
import { useText } from '#/providers/TextProvider'
import { tryCreateOwnerPermission } from '#/utilities/permissions'
import { usePreventNavigation } from '#/utilities/preventNavigation'
import LocalBackend from '@common/services/LocalBackend'
import { LocalBackend } from '@common/services/LocalBackend'
import { TEAMS_DIRECTORY_ID, USERS_DIRECTORY_ID } from '@common/services/remoteBackendPaths'

// The number of bytes in 1 megabyte.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import InviteUsersModal from '#/modals/InviteUsersModal'
import { useFullUserSession } from '#/providers/AuthProvider'
import { useRemoteBackend } from '#/providers/BackendProvider'
import { useText } from '#/providers/TextProvider'
import type RemoteBackend from '@common/services/RemoteBackend'
import type { RemoteBackend } from '@common/services/RemoteBackend'

const LIST_USERS_STALE_TIME_MS = 60_000

Expand Down
4 changes: 2 additions & 2 deletions app/gui/src/dashboard/layouts/Settings/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import type { ToastAndLogCallback } from '#/hooks/toastAndLogHooks'
import { passwordWithPatternSchema } from '#/pages/authentication/schemas'
import type { GetText } from '#/providers/TextProvider'
import { PASSWORD_REGEX } from '#/utilities/validation'
import type LocalBackend from '@common/services/LocalBackend'
import type RemoteBackend from '@common/services/RemoteBackend'
import type { LocalBackend } from '@common/services/LocalBackend'
import type { RemoteBackend } from '@common/services/RemoteBackend'
import ActivityLogSettingsSection from './ActivityLogSettingsSection'
import DeleteUserAccountSettingsSection from './DeleteUserAccountSettingsSection'
import KeyboardShortcutsSettingsSection from './KeyboardShortcutsSettingsSection'
Expand Down
2 changes: 1 addition & 1 deletion app/gui/src/dashboard/providers/AuthProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { useText } from '#/providers/TextProvider'
import { Dialog } from '#/components/AriaComponents'
import { Result } from '#/components/Result'

import type RemoteBackend from '@common/services/RemoteBackend'
import type { RemoteBackend } from '@common/services/RemoteBackend'

import {
CognitoErrorType,
Expand Down
4 changes: 2 additions & 2 deletions app/gui/src/dashboard/providers/BackendProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import * as common from 'enso-common'
import { type Category, isCloudCategory } from '#/layouts/CategorySwitcher/Category'

import { useEventCallback } from '#/hooks/eventCallbackHooks'
import type LocalBackend from '@common/services/LocalBackend'
import type { LocalBackend } from '@common/services/LocalBackend'
import { ProjectManagerEvents } from '@common/services/ProjectManager'
import type RemoteBackend from '@common/services/RemoteBackend'
import type { RemoteBackend } from '@common/services/RemoteBackend'

/** State contained in a `BackendContext`. */
export interface BackendContextType {
Expand Down

0 comments on commit 771a863

Please sign in to comment.