Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat / re-enable deno LSP for client project #405

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
"editor.tabSize": 2,
"deno.enable": true,
"deno.lint": true,
/*
* FIXME: This is a workaround for *.spec.ts files importing Svelte components.
* Disable when these issues are resolved:
* - https://github.com/denoland/deno/issues/17248
* - https://github.com/denoland/vscode_deno/issues/834
*/
"deno.disablePaths": [
"projects/client/src"
],
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MediaType } from '$lib/requests/models/MediaType';
import type { MediaType } from '$lib/requests/models/MediaType.ts';
import { getContext, setContext } from 'svelte';
import { type Writable, writable } from 'svelte/store';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from 'vitest';
import { attachRemoveWarning } from './attachRemoveWarning';
import { attachRemoveWarning } from './attachRemoveWarning.ts';

describe('attachRemoveWarning', () => {
it('should call handler when confirmed', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useMedia } from '$lib/stores/css/useMedia';
import { renderStore } from '$test/beds/store/renderStore';
import { useMedia } from '$lib/stores/css/useMedia.ts';
import { renderStore } from '$test/beds/store/renderStore.ts';
import { get, writable } from 'svelte/store';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { useDangerButton } from './useDangerButton';
import { useDangerButton } from './useDangerButton.ts';

vi.mock('$lib/stores/css/useMedia');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMedia, WellKnownMediaQuery } from '$lib/stores/css/useMedia';
import { useMedia, WellKnownMediaQuery } from '$lib/stores/css/useMedia.ts';
import { onMount } from 'svelte';
import { derived, get, writable } from 'svelte/store';
import type { TraktButtonProps } from '../TraktButtonProps';
import type { TraktButtonProps } from '../TraktButtonProps.ts';

type ButtonColor = Exclude<TraktButtonProps['color'], Nil>;
type DangerProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FavoriteButtonIntl } from './FavoriteButtonIntl';
import type { FavoriteButtonIntl } from './FavoriteButtonIntl.ts';

export type FavoriteButtonProps = {
i18n?: FavoriteButtonIntl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { WatchNowStreaming } from '$lib/requests/models/WatchNowServices';
import type { WatchNowButtonIntl } from './WatchNowButtonIntl';
import type { WatchNowStreaming } from '$lib/requests/models/WatchNowServices.ts';
import type { WatchNowButtonIntl } from './WatchNowButtonIntl.ts';

export type WatchNowButtonProps = {
mediaTitle: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
EpisodeComputedType,
EpisodeFinaleType,
EpisodePremiereType,
} from '$lib/requests/models/EpisodeType';
} from '$lib/requests/models/EpisodeType.ts';
import { render, screen } from '@testing-library/svelte';
import { describe, expect, test, vi } from 'vitest';
import { EpisodeIntlProvider } from '../EpisodeIntlProvider';
import { EpisodeIntlProvider } from '../EpisodeIntlProvider.ts';

vi.mock('$lib/stores/useMarkAsWatched');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "$style/scss/mixins/index" as *;
@use '$style/scss/mixins/index' as *;

@mixin adaptive-gap($property: gap) {
#{$property}: var(--gap-s);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { onMount } from 'svelte';
import { writable } from 'svelte/store';
import { useScrollHistory } from './useScrollHistory';
import { useScrollHistory } from './useScrollHistory.ts';

export function useScrollHistoryAction(
id: string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { time } from '$lib/utils/timing/time';
import { time } from '$lib/utils/timing/time.ts';
import { render, screen } from '@testing-library/svelte';
import { describe, expect, it } from 'vitest';
import AirDateTag from './AirDateTag.svelte';
import { TagIntlProvider } from './TagIntlProvider';
import { TagIntlProvider } from './TagIntlProvider.ts';

describe('AirDateTag', () => {
it('should display TBA when year is null', () => {
Expand Down
12 changes: 6 additions & 6 deletions projects/client/src/lib/components/media/tags/TagIntlProvider.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as m from '$lib/features/i18n/messages';
import * as m from '$lib/features/i18n/messages.ts';

import { getLocale, languageTag } from '$lib/features/i18n';
import { toHumanDuration } from '$lib/utils/formatting/date/toHumanDuration';
import { getLocale, languageTag } from '$lib/features/i18n/index.ts';
import { toHumanDuration } from '$lib/utils/formatting/date/toHumanDuration.ts';

import { toHumanETA } from '$lib/utils/formatting/date/toHumanETA';
import { toHumanNumber } from '$lib/utils/formatting/number/toHumanNumber';
import type { TagIntl } from './TagIntl';
import { toHumanETA } from '$lib/utils/formatting/date/toHumanETA.ts';
import { toHumanNumber } from '$lib/utils/formatting/number/toHumanNumber.ts';
import type { TagIntl } from './TagIntl.ts';

export const TagIntlProvider: TagIntl = {
toDuration: (duration) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import type { MediaRating } from '$lib/requests/models/MediaRating';
import { time } from '$lib/utils/timing/time';
import type { MediaRating } from '$lib/requests/models/MediaRating.ts';
import { time } from '$lib/utils/timing/time.ts';
import { describe, expect, it } from 'vitest';
import { EMPTY_RATINGS, getDisplayableRatings } from './getDisplayableRatings';
import {
EMPTY_RATINGS,
getDisplayableRatings,
} from './getDisplayableRatings.ts';

describe('getDisplayableRatings', () => {
const ratings: MediaRating = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MediaRating } from '$lib/requests/models/MediaRating';
import type { MediaRating } from '$lib/requests/models/MediaRating.ts';

type GetDisplayableRatingsProps = {
ratings: MediaRating;
Expand Down
4 changes: 2 additions & 2 deletions projects/client/src/lib/components/text/lineClamp.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NOOP_FN } from '$lib/utils/constants';
import { NOOP_FN } from '$lib/utils/constants.ts';
import type { Writable } from 'svelte/store';
import { GlobalEventBus } from '../../utils/events/GlobalEventBus';
import { GlobalEventBus } from '../../utils/events/GlobalEventBus.ts';

type LineClampProps = {
lines: number;
Expand Down
2 changes: 1 addition & 1 deletion projects/client/src/lib/features/auth/environment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { env } from '$env/dynamic/private';
import { assertDefined } from '$lib/utils/assert/assertDefined';
import { assertDefined } from '$lib/utils/assert/assertDefined.ts';

export const key = await crypto.subtle.importKey(
'raw',
Expand Down
16 changes: 8 additions & 8 deletions projects/client/src/lib/features/auth/handle.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { AuthMappedMock } from '$mocks/data/auth/AuthMappedMock';
import { EncryptedAuthMock } from '$mocks/data/auth/EncryptedAuthMock';
import { EncryptedExpiredAuthMock } from '$mocks/data/auth/EncryptedExpiredAuthMock';
import { mockRequestEvent } from '$test/request/mockRequestEvent';
import { AuthMappedMock } from '$mocks/data/auth/AuthMappedMock.ts';
import { EncryptedAuthMock } from '$mocks/data/auth/EncryptedAuthMock.ts';
import { EncryptedExpiredAuthMock } from '$mocks/data/auth/EncryptedExpiredAuthMock.ts';
import { mockRequestEvent } from '$test/request/mockRequestEvent.ts';
import { describe, expect, it, vi } from 'vitest';
import { AuthEndpoint } from './AuthEndpoint';
import { key } from './environment';
import { AUTH_COOKIE_NAME, handle } from './handle';
import { decrypt } from './utils/decrypt';
import { AuthEndpoint } from './AuthEndpoint.ts';
import { key } from './environment.ts';
import { AUTH_COOKIE_NAME, handle } from './handle.ts';
import { decrypt } from './utils/decrypt.ts';

describe('handle: auth', () => {
it('should handle logout', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { UserHistoryMappedMock } from '$mocks/data/users/mapped/UserHistoryMappedMock';
import { UserHistoryMappedMock } from '$mocks/data/users/mapped/UserHistoryMappedMock.ts';
import { runQuery } from '$test/beds/query/runQuery.ts';
import { createQuery } from '@tanstack/svelte-query';
import { describe, expect, it } from 'vitest';
import { currentUserHistoryQuery } from './currentUserHistoryQuery';
import { currentUserHistoryQuery } from './currentUserHistoryQuery.ts';

describe('currentUserHistoryQuery', () => {
it('should query for user user history', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AuthToken } from '../../models/AuthToken';
import type { AuthToken } from '../../models/AuthToken.ts';

type ExchangeBody = {
grant_type: 'authorization_code';
Expand Down
4 changes: 2 additions & 2 deletions projects/client/src/lib/features/auth/requests/verifyAuth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { env } from '$env/dynamic/private';
import { api } from '../../../requests/api.ts';
import type { AuthToken } from '../models/AuthToken';
import { getGrantTypeAndCode } from './_internal/getGrantTypeAndCode';
import type { AuthToken } from '../models/AuthToken.ts';
import { getGrantTypeAndCode } from './_internal/getGrantTypeAndCode.ts';

export type DeviceAuth = {
token: {
Expand Down
2 changes: 1 addition & 1 deletion projects/client/src/lib/features/auth/stores/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AuthEndpoint } from '$lib/features/auth/AuthEndpoint.ts';
import { InvalidateAction } from '$lib/requests/models/InvalidateAction.ts';
import { useInvalidator } from '$lib/stores/useInvalidator.ts';
import { assertDefined } from '$lib/utils/assert/assertDefined.ts';
import { setCacheBuster } from '$lib/utils/url/setCacheBuster';
import { setCacheBuster } from '$lib/utils/url/setCacheBuster.ts';
import { getContext, setContext } from 'svelte';
import { type Writable, writable } from 'svelte/store';

Expand Down
8 changes: 4 additions & 4 deletions projects/client/src/lib/features/auth/utils/decrypt.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AuthMappedMock } from '$mocks/data/auth/AuthMappedMock';
import { EncryptedAuthMock } from '$mocks/data/auth/EncryptedAuthMock';
import { encryptionKeyMock } from '$mocks/data/auth/encryptionKeyMock';
import { AuthMappedMock } from '$mocks/data/auth/AuthMappedMock.ts';
import { EncryptedAuthMock } from '$mocks/data/auth/EncryptedAuthMock.ts';
import { encryptionKeyMock } from '$mocks/data/auth/encryptionKeyMock.ts';
import { describe, expect, it, vi } from 'vitest';
import { decrypt } from './decrypt';
import { decrypt } from './decrypt.ts';

describe('utils: decrypt', () => {
it('should decrypt', async () => {
Expand Down
8 changes: 4 additions & 4 deletions projects/client/src/lib/features/auth/utils/encrypt.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AuthMappedMock } from '$mocks/data/auth/AuthMappedMock';
import { EncryptedAuthMock } from '$mocks/data/auth/EncryptedAuthMock';
import { encryptionKeyMock } from '$mocks/data/auth/encryptionKeyMock';
import { AuthMappedMock } from '$mocks/data/auth/AuthMappedMock.ts';
import { EncryptedAuthMock } from '$mocks/data/auth/EncryptedAuthMock.ts';
import { encryptionKeyMock } from '$mocks/data/auth/encryptionKeyMock.ts';
import { describe, expect, it } from 'vitest';
import { encrypt } from './encrypt';
import { encrypt } from './encrypt.ts';

describe('utils: encrypt', () => {
it('should encrypt', async () => {
Expand Down
4 changes: 2 additions & 2 deletions projects/client/src/lib/features/cache-bust/handle.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { interceptHandleResolveOptions } from '$test/resolve/interceptHandleResolveOptions';
import { interceptHandleResolveOptions } from '$test/resolve/interceptHandleResolveOptions.ts';
import { describe, expect, it } from 'vitest';
import { handle, TIMESTAMP_PLACEHOLDER } from './handle';
import { handle, TIMESTAMP_PLACEHOLDER } from './handle.ts';

describe('handle: cache-bust', () => {
it('should replace timestamp placeholder with current timestamp', async () => {
Expand Down
6 changes: 3 additions & 3 deletions projects/client/src/lib/features/gateway/handle.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AuthMappedMock } from '$mocks/data/auth/AuthMappedMock';
import { mockRequestEvent } from '$test/request/mockRequestEvent';
import { AuthMappedMock } from '$mocks/data/auth/AuthMappedMock.ts';
import { mockRequestEvent } from '$test/request/mockRequestEvent.ts';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { handle } from './handle';
import { handle } from './handle.ts';

describe('handle: gateway', () => {
const fetch = vi.fn();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { browser } from '$app/environment';
import { error } from '$lib/utils/console/print.ts';
import { NOOP_FN } from '$lib/utils/constants';
import { monitor } from '$lib/utils/perf/monitor';
import { NOOP_FN } from '$lib/utils/constants.ts';
import { monitor } from '$lib/utils/perf/monitor.ts';
import type {
PersistedClient,
Persister,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import { z } from 'zod';
import { zodToHash } from './zodToHash';
import { zodToHash } from './zodToHash.ts';

describe('zodToHash', () => {
it('should generate consistent hash for same schema', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { checksum } from '$lib/utils/string/checksum';
import { checksum } from '$lib/utils/string/checksum.ts';
import type { z } from 'zod';
import { zodToJsonSchema } from 'zod-to-json-schema';

Expand Down
6 changes: 3 additions & 3 deletions projects/client/src/lib/features/query/defineQuery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ApiParams } from '$lib/requests/api';
import type { InvalidateActionOptions } from '$lib/requests/models/InvalidateAction';
import { monitor } from '$lib/utils/perf/monitor';
import type { ApiParams } from '$lib/requests/api.ts';
import type { InvalidateActionOptions } from '$lib/requests/models/InvalidateAction.ts';
import { monitor } from '$lib/utils/perf/monitor.ts';
import type { CreateQueryOptions } from '@tanstack/svelte-query';
import type { z, ZodType } from 'zod';
import { zodToHash } from './_internal/zodToHash.ts';
Expand Down
6 changes: 3 additions & 3 deletions projects/client/src/lib/features/query/useQuery.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { browser } from '$app/environment';
import { invalidationId } from '$lib/requests/models/InvalidateAction';
import { time } from '$lib/utils/timing/time';
import { invalidationId } from '$lib/requests/models/InvalidateAction.ts';
import { time } from '$lib/utils/timing/time.ts';
import {
createQuery,
type CreateQueryOptions,
useQueryClient,
} from '@tanstack/svelte-query';
import { onMount } from 'svelte';
import { queryId } from './defineQuery';
import { queryId } from './defineQuery.ts';

const INVALIDATION_MAP = new Map<string, number>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { clone } from '$lib/utils/object/clone';
import { deepAssign } from '$lib/utils/object/deepAssign';
import { ExtendedUsersResponseMock } from '$mocks/data/users/response/ExtendedUserSettingsResponseMock';
import { server } from '$mocks/server';
import { renderStore, setAuthorization } from '$test/beds/store/renderStore';
import { waitForEmission } from '$test/readable/waitForEmission';
import { waitForValue } from '$test/readable/waitForValue';
import { clone } from '$lib/utils/object/clone.ts';
import { deepAssign } from '$lib/utils/object/deepAssign.ts';
import { ExtendedUsersResponseMock } from '$mocks/data/users/response/ExtendedUserSettingsResponseMock.ts';
import { server } from '$mocks/server.ts';
import { renderStore, setAuthorization } from '$test/beds/store/renderStore.ts';
import { waitForEmission } from '$test/readable/waitForEmission.ts';
import { waitForValue } from '$test/readable/waitForValue.ts';
import { http, HttpResponse } from 'msw';
import { describe, expect, it } from 'vitest';
import { useSpoiler } from './useSpoiler';
import { useSpoiler } from './useSpoiler.ts';

describe('store: useSpoiler', () => {
it('should return false when user is not authorized', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useAuth } from '$lib/features/auth/stores/useAuth';
import { useUser } from '$lib/features/auth/stores/useUser';
import { useAuth } from '$lib/features/auth/stores/useAuth.ts';
import { useUser } from '$lib/features/auth/stores/useUser.ts';
import { derived } from 'svelte/store';

export function useSpoiler() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { clone } from '$lib/utils/object/clone';
import { deepAssign } from '$lib/utils/object/deepAssign';
import { ExtendedUsersResponseMock } from '$mocks/data/users/response/ExtendedUserSettingsResponseMock';
import { WatchedMoviesResponseMock } from '$mocks/data/users/response/WatchedMoviesResponseMock';
import { server } from '$mocks/server';
import { renderStore, setAuthorization } from '$test/beds/store/renderStore';
import { clone } from '$lib/utils/object/clone.ts';
import { deepAssign } from '$lib/utils/object/deepAssign.ts';
import { ExtendedUsersResponseMock } from '$mocks/data/users/response/ExtendedUserSettingsResponseMock.ts';
import { WatchedMoviesResponseMock } from '$mocks/data/users/response/WatchedMoviesResponseMock.ts';
import { server } from '$mocks/server.ts';
import { renderStore, setAuthorization } from '$test/beds/store/renderStore.ts';
import { waitFor } from '@testing-library/svelte';
import { http, HttpResponse } from 'msw';
import { describe, expect, it } from 'vitest';
import { useSpoilerAction } from './useSpoilerAction';
import { useSpoilerAction } from './useSpoilerAction.ts';

describe('action: useSpoilerAction', () => {
it('should add spoiler class when isSpoilerHidden is true', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MediaStoreProps } from '$lib/models/MediaStoreProps';
import { useMediaSpoiler } from '../useMediaSpoiler';
import type { MediaStoreProps } from '$lib/models/MediaStoreProps.ts';
import { useMediaSpoiler } from '../useMediaSpoiler.ts';

type SpoilerActionProps = MediaStoreProps;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { EpisodeEntry } from '$lib/requests/models/EpisodeEntry';
import type { ShowEntry as MediaEntry } from '$lib/requests/models/ShowEntry';
import type { EpisodeEntry } from '$lib/requests/models/EpisodeEntry.ts';
import type { ShowEntry as MediaEntry } from '$lib/requests/models/ShowEntry.ts';
import { derived } from 'svelte/store';
import { useMediaSpoiler } from './useMediaSpoiler';
import { useMediaSpoiler } from './useMediaSpoiler.ts';

type SpoilerImageProps = {
episode: EpisodeEntry;
Expand Down
4 changes: 2 additions & 2 deletions projects/client/src/lib/features/spoilers/useMediaSpoiler.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { MediaStoreProps } from '$lib/models/MediaStoreProps';
import type { MediaStoreProps } from '$lib/models/MediaStoreProps.ts';
import {
useIsWatched,
} from '$lib/sections/media-actions/mark-as-watched/useIsWatched';
import { derived } from 'svelte/store';
import { useSpoiler } from './_internal/useSpoiler';
import { useSpoiler } from './_internal/useSpoiler.ts';

export type MediaSpoilerProps = MediaStoreProps;

Expand Down
Loading
Loading