feat: add formidable ESLint + Prettier linting setup
Some checks failed
Build and Push Backend Image / build (push) Successful in 47s
Build and Push Frontend Image / build (push) Has been cancelled

- Root-level eslint.config.js (flat config): typescript-eslint,
  eslint-plugin-svelte, eslint-config-prettier, @eslint/js
- Root-level prettier.config.js with prettier-plugin-svelte
- svelte-check added to frontend for Svelte/TS type checking
- lint, lint:fix, format, format:check, check scripts in root
  and both packages
- All 60 lint errors fixed across backend and frontend:
  - Consistent type imports
  - Removed unused imports/variables
  - Added keys to all {#each} blocks for Svelte performance
  - Replaced mutable Set/Map with SvelteSet/SvelteMap
  - Fixed useless assignments and empty catch blocks
- 64 remaining warnings are intentional any usages in the
  Pothos/Drizzle GraphQL resolver layer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 22:24:55 +01:00
parent 741e0c3387
commit 18116072c9
43 changed files with 1023 additions and 5048 deletions

View File

@@ -4,8 +4,8 @@ import Meta from "$lib/components/meta/meta.svelte";
import {
ButtplugClient,
ButtplugWasmClientConnector,
ButtplugClientDevice,
OutputType,
type ButtplugClientDevice,
type OutputType,
InputType,
DeviceOutputValueConstructor,
} from "@sexy.pivoine.art/buttplug";
@@ -149,7 +149,7 @@ async function handleStop(device: BluetoothDevice) {
}
function convertDevice(device: ButtplugClientDevice): BluetoothDevice {
const actuators: import("$lib/types").DeviceActuator[] = [];
const actuators: import("$lib/types").DeviceActuator[] = []; // eslint-disable-line @typescript-eslint/consistent-type-imports
for (const [, feature] of device.features) {
for (const outputType of feature.outputTypes) {
actuators.push({
@@ -568,7 +568,7 @@ onMount(() => {
<div class="container mx-auto px-4 py-12">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
{#if devices}
{#each devices as device}
{#each devices as device (device.name)}
<DeviceCard
{device}
onChange={(scalarIndex, val) => handleChange(device, scalarIndex, val)}

View File

@@ -1,5 +1,6 @@
<script lang="ts">
import { _ } from "svelte-i18n";
import { SvelteMap } from "svelte/reactivity";
import * as Dialog from "$lib/components/ui/dialog";
import Button from "$lib/components/ui/button/button.svelte";
import type { BluetoothDevice, DeviceInfo } from "$lib/types";
@@ -15,7 +16,7 @@ interface Props {
let { open, recordedDevices, connectedDevices, onConfirm, onCancel }: Props = $props();
// Device mappings: recorded device name -> connected device
let mappings = $state<Map<string, BluetoothDevice>>(new Map());
let mappings = new SvelteMap<string, BluetoothDevice>();
// Check if a connected device is compatible with a recorded device
function isCompatible(recordedDevice: DeviceInfo, connectedDevice: BluetoothDevice): boolean {
@@ -37,7 +38,7 @@ function getCompatibleDevices(recordedDevice: DeviceInfo): BluetoothDevice[] {
// Auto-map devices on open
$effect(() => {
if (open && recordedDevices.length > 0 && connectedDevices.length > 0) {
const newMappings = new Map<string, BluetoothDevice>();
const newMappings = new SvelteMap<string, BluetoothDevice>();
recordedDevices.forEach(recordedDevice => {
// Try to find exact name match first
@@ -74,7 +75,7 @@ function handleDeviceSelect(recordedDeviceName: string, deviceId: string) {
const device = connectedDevices.find(d => d.id === deviceId);
if (device) {
const newMappings = new Map(mappings);
const newMappings = new SvelteMap(mappings);
newMappings.set(recordedDeviceName, device);
mappings = newMappings;
}
@@ -95,7 +96,7 @@ const allDevicesMapped = $derived(
</Dialog.Header>
<div class="space-y-4 py-4">
{#each recordedDevices as recordedDevice}
{#each recordedDevices as recordedDevice (recordedDevice.name)}
{@const compatibleDevices = getCompatibleDevices(recordedDevice)}
{@const currentMapping = mappings.get(recordedDevice.name)}
@@ -106,7 +107,7 @@ const allDevicesMapped = $derived(
<h3 class="font-semibold text-card-foreground">{recordedDevice.name}</h3>
</div>
<div class="flex flex-wrap gap-1">
{#each recordedDevice.capabilities as capability}
{#each recordedDevice.capabilities as capability (capability)}
<span class="text-xs px-2 py-0.5 rounded-full bg-primary/10 text-primary border border-primary/20">
{capability}
</span>
@@ -129,7 +130,7 @@ const allDevicesMapped = $derived(
onchange={(e) => handleDeviceSelect(recordedDevice.name, e.currentTarget.value)}
>
<option value="" disabled>Select device...</option>
{#each compatibleDevices as device}
{#each compatibleDevices as device (device.name)}
<option value={device.id}>
{device.name}
{#if device.name === recordedDevice.name}(exact match){/if}

View File

@@ -96,7 +96,7 @@ function handleCancel() {
<!-- Device Info -->
<div class="space-y-2">
<Label>Devices Used</Label>
{#each deviceInfo as device}
{#each deviceInfo as device (device.name)}
<div
class="flex items-center gap-2 text-sm bg-muted/20 rounded px-3 py-2"
>