diff --git a/apps/desktop/e2e/utils.ts b/apps/desktop/e2e/utils.ts index e5d6c1c4b1..f0c3ad5150 100644 --- a/apps/desktop/e2e/utils.ts +++ b/apps/desktop/e2e/utils.ts @@ -1,5 +1,5 @@ -import { spawnSync } from 'node:child_process'; import { browser } from '@wdio/globals'; +import { spawnSync } from 'node:child_process'; const DEFAULT_TIMEOUT = 5_000; diff --git a/apps/desktop/src/lib/branch/BranchHeader.svelte b/apps/desktop/src/lib/branch/BranchHeader.svelte index ee06d847d4..7aceb56203 100644 --- a/apps/desktop/src/lib/branch/BranchHeader.svelte +++ b/apps/desktop/src/lib/branch/BranchHeader.svelte @@ -21,9 +21,13 @@ import type { PullRequest } from '$lib/gitHost/interface/types'; import type { Persisted } from '$lib/persisted/persisted'; - export let uncommittedChanges = 0; - export let isLaneCollapsed: Persisted; - export let onGenerateBranchName: () => void; + interface Props { + uncommittedChanges?: number; + isLaneCollapsed: Persisted; + onGenerateBranchName: () => void; + } + + const { uncommittedChanges = 0, isLaneCollapsed, onGenerateBranchName }: Props = $props(); const branchController = getContext(BranchController); const baseBranchService = getContext(BaseBranchService); @@ -33,13 +37,13 @@ const prMonitor = getGitHostPrMonitor(); const gitHost = getGitHost(); - $: branch = $branchStore; - $: pr = $prMonitor?.pr; + const branch = $derived($branchStore); + const pr = $derived($prMonitor?.pr); - let contextMenu: ContextMenu; - let meatballButtonEl: HTMLDivElement; - let isLoading: boolean; - let isTargetBranchAnimated = false; + let contextMenu = $state(); + let meatballButtonEl = $state(); + let isLoading = $state(false); + let isTargetBranchAnimated = $state(false); function handleBranchNameChange(title: string) { if (title === '') return; @@ -55,9 +59,9 @@ $isLaneCollapsed = true; } - $: hasIntegratedCommits = branch.commits?.some((b) => b.isIntegrated); + const hasIntegratedCommits = $derived(branch.commits?.some((b) => b.isIntegrated)); - let headerInfoHeight = 0; + let headerInfoHeight = $state(0); interface CreatePrOpts { draft: boolean; @@ -120,7 +124,7 @@
e.key === 'Enter' && expandLane()} + onkeydown={(e) => e.key === 'Enter' && expandLane()} tabindex="0" role="button" > @@ -251,7 +255,7 @@ outline icon="kebab" onclick={() => { - contextMenu.toggle(); + contextMenu?.toggle(); }} /> void; - export let onGenerateBranchName: () => void; + interface Props { + contextMenuEl?: ContextMenu; + target?: HTMLElement; + onCollapse: () => void; + onGenerateBranchName: () => void; + } + + let { contextMenuEl = $bindable(), target, onCollapse, onGenerateBranchName }: Props = $props(); const user = getContextStore(User); const project = getContext(Project); @@ -29,15 +33,21 @@ const nameNormalizationService = getNameNormalizationServiceContext(); - let aiConfigurationValid = false; + let aiConfigurationValid = $state(false); let deleteBranchModal: Modal; let renameRemoteModal: Modal; - let newRemoteName: string; + let newRemoteName = $state(''); - $: branch = $branchStore; - $: commits = branch.commits; - $: setAIConfigurationValid($user); - $: allowRebasing = branch.allowRebasing; + const branch = $derived($branchStore); + const commits = $derived(branch.commits); + $effect(() => { + setAIConfigurationValid($user); + }); + + let allowRebasing = $state(false); + $effect(() => { + allowRebasing = branch.allowRebasing; + }); async function toggleAllowRebasing() { branchController.updateBranchAllowRebasing(branch.id, !allowRebasing); @@ -53,16 +63,18 @@ let normalizedBranchName: string; - $: if (branch.name) { - nameNormalizationService - .normalize(branch.name) - .then((name) => { - normalizedBranchName = name; - }) - .catch((e) => { - console.error('Failed to normalize branch name', e); - }); - } + $effect(() => { + if (branch.name) { + nameNormalizationService + .normalize(branch.name) + .then((name) => { + normalizedBranchName = name; + }) + .catch((e) => { + console.error('Failed to normalize branch name', e); + }); + } + }); @@ -71,7 +83,7 @@ label="Collapse lane" on:click={() => { onCollapse(); - contextMenuEl.close(); + contextMenuEl?.close(); }} /> @@ -80,7 +92,7 @@ label="Unapply" on:click={() => { unapplyBranch(); - contextMenuEl.close(); + contextMenuEl?.close(); }} /> @@ -96,7 +108,7 @@ } else { deleteBranchModal.show(branch); } - contextMenuEl.close(); + contextMenuEl?.close(); }} /> @@ -104,7 +116,7 @@ label="Generate branch name" on:click={() => { onGenerateBranchName(); - contextMenuEl.close(); + contextMenuEl?.close(); }} disabled={!($aiGenEnabled && aiConfigurationValid) || branch.files?.length === 0} /> @@ -118,7 +130,7 @@ newRemoteName = branch.upstreamName || normalizedBranchName || ''; renameRemoteModal.show(branch); - contextMenuEl.close(); + contextMenuEl?.close(); }} /> @@ -128,7 +140,7 @@ @@ -140,7 +152,7 @@ label="Create branch to the left" on:click={() => { branchController.createBranch({ order: branch.order }); - contextMenuEl.close(); + contextMenuEl?.close(); }} /> @@ -148,7 +160,7 @@ label="Create branch to the right" on:click={() => { branchController.createBranch({ order: branch.order + 1 }); - contextMenuEl.close(); + contextMenuEl?.close(); }} /> diff --git a/apps/desktop/src/lib/pr/PullRequestButton.svelte b/apps/desktop/src/lib/pr/PullRequestButton.svelte index ccea71c0dd..ab31fad38c 100644 --- a/apps/desktop/src/lib/pr/PullRequestButton.svelte +++ b/apps/desktop/src/lib/pr/PullRequestButton.svelte @@ -1,16 +1,3 @@ - - { + e.stopPropagation(); + onclick?.(e); + }} type="checkbox" class="toggle" class:small diff --git a/eslint.config.mjs b/eslint.config.js similarity index 94% rename from eslint.config.mjs rename to eslint.config.js index 4726c89187..dde7e43bd0 100644 --- a/eslint.config.mjs +++ b/eslint.config.js @@ -24,6 +24,9 @@ export default tsEslint.config( globals: { ...globals.node, ...globals.browser, + ...globals.mocha, + ...globals.chai, + ...globals.protractor, $state: 'readonly', $derived: 'readonly', $props: 'readonly', @@ -50,7 +53,6 @@ export default tsEslint.config( '**/dist', '.svelte-kit', '**/package', - '**/e2e', '**/.env', '**/.env.*', '!**/.env.example', @@ -61,7 +63,6 @@ export default tsEslint.config( '.vscode', 'src-tauri', '**/eslint.config.js', - '**/eslint.config.mjs', '**/svelte.config.js', '**/.pnpm-store', '**/vite.config.ts.timestamp-*', @@ -83,7 +84,6 @@ export default tsEslint.config( rules: { eqeqeq: ['error', 'always'], 'import-x/no-cycle': 'error', - 'import-x/order': [ 'error', { @@ -107,20 +107,24 @@ export default tsEslint.config( 'newlines-between': 'never' } ], - 'import-x/no-unresolved': [ 'error', { ignore: ['^\\$app', '^\\$env'] } ], + 'import-x/no-relative-packages': 'error', - 'import-x/no-relative-packages': 'error', // Don't allow packages to have relative imports between each other 'func-style': [2, 'declaration'], + 'no-return-await': 'off', + 'svelte/no-at-html-tags': 'off', + '@typescript-eslint/no-namespace': 'off', '@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-explicit-any': 'off', - + '@typescript-eslint/return-await': ['error', 'always'], + '@typescript-eslint/promise-function-async': 'error', + '@typescript-eslint/await-thenable': 'error', '@typescript-eslint/no-unused-vars': [ 'error', { @@ -128,13 +132,7 @@ export default tsEslint.config( varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' } - ], - - 'no-return-await': 'off', - '@typescript-eslint/return-await': ['error', 'always'], - '@typescript-eslint/promise-function-async': 'error', - '@typescript-eslint/await-thenable': 'error', - 'svelte/no-at-html-tags': 'off' + ] }, settings: { 'import-x/extensions': ['.ts'], diff --git a/packages/ui/src/lib/utils/tooltip.ts b/packages/ui/src/lib/utils/tooltip.ts index fc0b4ec441..e478a92b56 100644 --- a/packages/ui/src/lib/utils/tooltip.ts +++ b/packages/ui/src/lib/utils/tooltip.ts @@ -54,6 +54,7 @@ export function tooltip(node: HTMLElement, optsOrString: ToolTipOptions | string tooltip = document.createElement('div') as HTMLDivElement; // TODO: Can we co-locate tooltip.js & tooltip.postcss? tooltip.classList.add('tooltip', 'text-11'); // see tooltip.postcss + tooltip.style.zIndex = '9999'; if (noMaxWidth) tooltip.classList.add('no-max-width'); tooltip.innerText = text; document.body.appendChild(tooltip); diff --git a/packages/ui/src/stories/Button/DemoAllButtons.svelte b/packages/ui/src/stories/Button/DemoAllButtons.svelte index a2a3e2376c..0568de0b80 100644 --- a/packages/ui/src/stories/Button/DemoAllButtons.svelte +++ b/packages/ui/src/stories/Button/DemoAllButtons.svelte @@ -1,15 +1,18 @@ -{#snippet buttons({ label, outline, style, reversedDirection })} +{#snippet buttons({ label, outline, style, reversedDirection }: Props)}