Skip to content

Commit

Permalink
Audit and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zerebos committed Oct 22, 2022
1 parent 88b1fc0 commit 34dc2b9
Show file tree
Hide file tree
Showing 9 changed files with 922 additions and 597 deletions.
4 changes: 3 additions & 1 deletion src/main/update_installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const getJSON = phin.defaults({
followRedirects: true
});

/* eslint-disable no-console */
export default async function () {
const downloadUrl = "https://api.github.com/repos/BetterDiscord/Installer/releases";
console.info(`Better Discord Installer ${version}`);
Expand All @@ -35,7 +36,8 @@ export default async function () {
process.exit(0);
}

} else {
}
else {
console.info(`The installer is up to date.`);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/common/Checkbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import {handleKeyboardToggle, checkItem} from "../stores/controls.js";
export let checked = false;
export let label = undefined;
export let label = undefined; // eslint-disable-line no-undef-init
let checkbox;
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/common/ProgressBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export let value = 0;
export let max = 100;
let className;
export { className as class };
export {className as class};
</script>

<div class="progress-bar {className}" {...$$restProps}>
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/common/SocialLinks.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script>
import { tooltip } from "./tooltip";
import {tooltip} from "./tooltip";
const webUrl = "https://betterdiscord.app";
const githubUrl = "http://github.com/BetterDiscord/BetterDiscord";
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/common/Spinner.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import { afterUpdate, onMount } from "svelte";
export let value = undefined;
let className = undefined;
import {afterUpdate, onMount} from "svelte";
export let value = undefined; // eslint-disable-line no-undef-init
let className = undefined; // eslint-disable-line no-undef-init
export {className as class};
let circle;
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/common/Text.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script>
export let hasMargin = undefined;;
export let hasMargin = undefined; // eslint-disable-line no-undef-init
export let type = "paragraph";
let className = undefined;
export { className as class };
let className = undefined; // eslint-disable-line no-undef-init
export {className as class};
</script>

{#if type === "header"}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/common/Tooltip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
export let position = "top";
export let x = 0;
export let y = 0;
export let element = undefined;
export let element = undefined; // eslint-disable-line no-undef-init
$: colors = ["default", "danger", "accent"];
$: positions = ["top", "bottom", "left", "right"];
Expand Down
17 changes: 10 additions & 7 deletions src/renderer/common/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,16 @@ export function tooltip (node, {
if (position === "top") {
component.x = node.getBoundingClientRect().left + (node.offsetWidth / 2) - (tooltipDOM.offsetWidth / 2);
component.y = (node.getBoundingClientRect().top - tooltipDOM.offsetHeight - 5) - spacing;
} else if (position === "bottom") {
}
else if (position === "bottom") {
component.x = node.getBoundingClientRect().left + (node.offsetWidth / 2) - (tooltipDOM.offsetWidth / 2);
component.y = (node.getBoundingClientRect().bottom + 5) + spacing;
} else if (position === "left") {
}
else if (position === "left") {
component.x = (node.getBoundingClientRect().left - tooltipDOM.offsetWidth - 5) - spacing;
component.y = node.getBoundingClientRect().top + (node.offsetHeight / 2) - (tooltipDOM.offsetHeight / 2);
} else if (position === "right") {
}
else if (position === "right") {
component.x = (node.getBoundingClientRect().left + node.offsetWidth + 5) + spacing;
component.y = node.getBoundingClientRect().top + (node.offsetHeight / 2) - (tooltipDOM.offsetHeight / 2);
}
Expand All @@ -65,7 +68,7 @@ export function tooltip (node, {

function unmountTooltip() {

let tooltipsLayer = document.getElementById("tooltips-layer");
const tooltipsLayer = document.getElementById("tooltips-layer");

// Check if component is already rendered to prevent warnings
if (isComponentRendered) {
Expand All @@ -92,7 +95,7 @@ export function tooltip (node, {
});

return {
destroy() {
destroy() {
node.removeEventListener("mouseenter", renderTooltip);
node.removeEventListener("mouseleave", unmountTooltip);
node.removeEventListener("focus", renderTooltip);
Expand All @@ -102,6 +105,6 @@ export function tooltip (node, {
node.childNodes.forEach(child => {
child.removeEventListener("blur", unmountTooltip);
});
}
};
}
};
}
Loading

0 comments on commit 34dc2b9

Please sign in to comment.