Skip to content

Commit

Permalink
style: fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Feb 13, 2024
1 parent af8b87f commit faceb62
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 102 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
rules: {
'import/extensions': 'off',
'import/no-extraneous-dependencies': 'off',
'svelte/valid-compile': 'off',
'vitest/prefer-lowercase-title': 'off',
},
overrides: [
Expand Down
27 changes: 13 additions & 14 deletions packages/safe-ds-eda/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,35 @@
let sidebarWidth = 307; // Initial width of the sidebar in pixels
function handleDrag(e: MouseEvent) {
const throttledOnMouseMove = throttle(onMouseMove, 30);
let prevX = e.clientX;
function onMouseMove(e: MouseEvent) {
const dx = e.clientX - prevX;
prevX = e.clientX;
const handleDrag = function (e: MouseEvent) {
const onMouseMove = function (mouseMoveEvent: MouseEvent) {
const dx = mouseMoveEvent.clientX - prevX;
prevX = mouseMoveEvent.clientX;
if (sidebarWidth + dx < 10) {
sidebarWidth = 10;
} else {
sidebarWidth += dx;
}
}
};
const throttledOnMouseMove = throttle(onMouseMove, 30);
function onMouseUp() {
let prevX = e.clientX;
const onMouseUp = function () {
document.removeEventListener('mousemove', throttledOnMouseMove);
document.removeEventListener('mouseup', onMouseUp);
document.removeEventListener('mousemove', clearTextSelection);
}
};
document.addEventListener('mousemove', throttledOnMouseMove);
document.addEventListener('mouseup', onMouseUp);
document.addEventListener('mousemove', clearTextSelection);
}
};
function clearTextSelection() {
const clearTextSelection = function () {
const selection = window.getSelection();
if (selection) selection.removeAllRanges();
}
};
</script>

<main>
Expand Down
14 changes: 7 additions & 7 deletions packages/safe-ds-eda/src/components/Sidebar.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { currentState, currentTabIndex } from '../webviewState';
import {currentState, currentTabIndex} from '../webviewState';
import CaretIcon from '../icons/Caret.svelte';
import HistoryIcon from '../icons/History.svelte';
import UndoIcon from '../icons/Undo.svelte';
Expand Down Expand Up @@ -37,14 +37,14 @@
<nav
class="tab"
class:tabActive={$currentTabIndex === 0}
on:click={() => currentTabIndex.update((cs) => 0)}
on:click={() => currentTabIndex.update((_cs) => 0)}
>
<span class="icon tableIcon"><TableIcon /></span>{#if width > 109}Table{/if}
</nav>
{#if $currentState.tabs}
{#each $currentState.tabs as tab, index}
{#if tab.type === 'linePlot'}
<nav on:click={() => currentTabIndex.update((cs) => index + 1)}>
<nav on:click={() => currentTabIndex.update((_cs) => index + 1)}>
<LinePlotTab tabObject={tab} active={$currentTabIndex === index + 1} {width} />
</nav>
{/if}
Expand All @@ -66,7 +66,7 @@
align-items: flex-end;
justify-content: space-between;
height: 63px;
padding: 0px 20px 0px 20px;
padding: 0 20px 0 20px;
margin-bottom: 10px;
}
Expand All @@ -87,7 +87,7 @@
.historyBar {
font-size: 1.3rem;
background-color: var(--bg-bright);
padding: 19.5px 20px 0px 20px;
padding: 19.5px 20px 0 20px;
display: flex;
flex-direction: row;
justify-content: space-between;
Expand All @@ -97,7 +97,7 @@
}
.no-borders {
border: 0px;
border: 0;
}
.historyItem {
Expand All @@ -109,7 +109,7 @@
margin-bottom: 20px;
}
.historyItem:last-of-type {
margin-right: 0px;
margin-right: 0;
}
.icon {
margin-right: 7px;
Expand Down
Loading

0 comments on commit faceb62

Please sign in to comment.