Skip to content

Commit

Permalink
[ops/ts] - fixed eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
emilbon99 committed Jul 17, 2024
1 parent a2d64cb commit 37f2881
Show file tree
Hide file tree
Showing 27 changed files with 30 additions and 41 deletions.
1 change: 0 additions & 1 deletion client/ts/src/errors.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { BaseTypedError, TypedError } from "@synnaxlabs/freighter";
import { MatchableErrorType } from "@synnaxlabs/freighter/src/errors";
import { describe, expect, test } from "vitest";

Expand Down
2 changes: 1 addition & 1 deletion client/ts/src/ontology/group/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { type UnaryClient } from "@synnaxlabs/freighter";
import { z } from "zod";

import { type Payload, groupZ } from "@/ontology/group/payload";
import { groupZ,type Payload } from "@/ontology/group/payload";
import { type ID, idZ } from "@/ontology/payload";

const resZ = z.object({
Expand Down
1 change: 0 additions & 1 deletion console/src/docs/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import { createSlice, type PayloadAction } from "@reduxjs/toolkit";
import { migrate } from "@synnaxlabs/x";
import { z } from "zod";

/**
* The name of the docs slice in a larger store.
Expand Down
2 changes: 1 addition & 1 deletion console/src/fs/LoadFileContents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// included in the file licenses/APL.txt.

import { Icon } from "@synnaxlabs/media";
import { Align, Button, Input, state } from "@synnaxlabs/pluto";
import { Align, Button, Input } from "@synnaxlabs/pluto";
import { binary } from "@synnaxlabs/x";
import { open } from "@tauri-apps/plugin-dialog";
import { readFile } from "@tauri-apps/plugin-fs";
Expand Down
1 change: 0 additions & 1 deletion console/src/hardware/ni/device/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// License, use of this software will be governed by the Apache License, Version 2.0,
// included in the file licenses/APL.txt.

import { task } from "@synnaxlabs/client";
import { z } from "zod";

// VENDOR
Expand Down
2 changes: 1 addition & 1 deletion console/src/hardware/ni/task/AnalogRead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import { NotFoundError, QueryError } from "@synnaxlabs/client";
import { Icon } from "@synnaxlabs/media";
import { Button, Form, Header, Menu, Status, Synnax } from "@synnaxlabs/pluto";
import { Form, Header, Menu, Status, Synnax } from "@synnaxlabs/pluto";
import { Align } from "@synnaxlabs/pluto/align";
import { Input } from "@synnaxlabs/pluto/input";
import { List } from "@synnaxlabs/pluto/list";
Expand Down
2 changes: 1 addition & 1 deletion console/src/hardware/ni/task/DigitalRead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// License, use of this software will be governed by the Apache License, Version 2.0,
// included in the file licenses/APL.txt.

import { NotFoundError, QueryError } from "@synnaxlabs/client";
import { NotFoundError } from "@synnaxlabs/client";
import { Icon } from "@synnaxlabs/media";
import {
Align,
Expand Down
4 changes: 0 additions & 4 deletions console/src/hardware/ni/task/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ export type UnitsInOz = z.infer<typeof unitsInOzZ>;
export const unitsFtLbsZ = z.literal("FootPounds");
export type UnitsFtLbs = z.infer<typeof unitsFtLbsZ>;

const resistanceZ = z.number().refine((val) => val > 0, {
message: "Value must be greater than 0",
});

export const unitsZ = z.union([
unitsVoltsZ,
unitsAmpsZ,
Expand Down
2 changes: 1 addition & 1 deletion console/src/hooks/useLoadRemote.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PayloadAction } from "@reduxjs/toolkit";
import { Synnax } from "@synnaxlabs/client";
import { Status, Synnax as PSynnax, useAsyncEffect } from "@synnaxlabs/pluto";
import { compare, migrate } from "@synnaxlabs/x";
import { migrate } from "@synnaxlabs/x";
import { useMutation } from "@tanstack/react-query";
import { nanoid } from "nanoid";
import { useDispatch } from "react-redux";
Expand Down
2 changes: 1 addition & 1 deletion console/src/layout/Window.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { Controls } from "@/components";
import { Menu } from "@/components/menu";
import { CSS } from "@/css";
import { Content } from "@/layout/Content";
import { WindowProps } from "@/layout/slice";
import { useSelect } from "@/layout/selectors";
import { WindowProps } from "@/layout/slice";

export interface NavTopProps extends Pick<WindowProps, "showTitle" | "navTop"> {
title: string;
Expand Down
2 changes: 1 addition & 1 deletion console/src/layout/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
export * from "@/layout/Content";
export * from "@/layout/context";
export * from "@/layout/hooks";
export * from "@/layout/slice";
export * from "@/layout/middleware";
export * from "@/layout/Modals";
export * from "@/layout/palette";
export * from "@/layout/Selector";
export * from "@/layout/selectors";
export * from "@/layout/slice";
export * from "@/layout/slice";
export * from "@/layout/Window";
1 change: 0 additions & 1 deletion console/src/layouts/Mosaic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import { createSelector } from "@/layouts/Selector";
import { LinePlot } from "@/lineplot";
import { SERVICES } from "@/services";
import { type RootStore } from "@/store";
import { Vis } from "@/vis";

const EmptyContent = (): ReactElement => (
<Eraser.Eraser>
Expand Down
2 changes: 1 addition & 1 deletion console/src/lineplot/migrations/v0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// included in the file licenses/APL.txt.

import { Text, Viewport } from "@synnaxlabs/pluto";
import { bounds, box, dimensions, direction, migrate, xy } from "@synnaxlabs/x";
import { bounds, box, dimensions, direction, xy } from "@synnaxlabs/x";
import { z } from "zod";

import {
Expand Down
1 change: 1 addition & 0 deletions console/src/ontology/Tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ export const Tree = (): ReactElement => {
onDrop={handleDrop}
onDoubleClick={handleDoubleClick}
showRules
loading={loading}
{...treeProps}
>
{item}
Expand Down
2 changes: 1 addition & 1 deletion console/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Reducer, Store } from "@reduxjs/toolkit";
import { combineReducers, Tuple } from "@reduxjs/toolkit";
import { Drift } from "@synnaxlabs/drift";
import { TauriRuntime } from "@synnaxlabs/drift/tauri";
import { type deep, migrate } from "@synnaxlabs/x";
import { type deep } from "@synnaxlabs/x";

import { Cluster } from "@/cluster";
import { Docs } from "@/docs";
Expand Down
12 changes: 2 additions & 10 deletions console/src/vis/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { type FC, type ReactElement } from "react";
import { ToolbarHeader, ToolbarTitle } from "@/components";
import { Layout } from "@/layout";
import { Layouts } from "@/layouts";
import { Selector } from "@/layouts/Selector";
import { LinePlot } from "@/lineplot";
import { Schematic } from "@/schematic";
import { type LayoutType } from "@/vis/types";
Expand All @@ -26,19 +27,10 @@ interface ToolbarProps {
layoutKey: string;
}

const SelectVis = ({ layoutKey }: ToolbarProps): ReactElement => (
<Align.Space justify="spaceBetween" style={{ height: "100%" }} empty>
<ToolbarHeader>
<VisToolbarTitle />
</ToolbarHeader>
{/* <LayoutSelector layoutKey={layoutKey} /> */}
</Align.Space>
);

const TOOLBARS: Record<LayoutType | "vis", FC<ToolbarProps>> = {
schematic: Schematic.Toolbar,
lineplot: LinePlot.Toolbar,
vis: SelectVis,
vis: ({ layoutKey }) => <Selector layoutKey={layoutKey} onClose={() => {}} />,
};

const NoVis = (): ReactElement => {
Expand Down
2 changes: 2 additions & 0 deletions console/src/workspace/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { Layout } from "@/layout";
import { type RootState } from "@/store";
import { selectActiveKey, useSelectActiveKey } from "@/workspace/selectors";

// this fixes conflicts between JSX and TS
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
export const useSyncComponent = <P extends unknown>(
name: string,
layoutKey: string,
Expand Down
2 changes: 1 addition & 1 deletion drift/src/external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export {
closeWindow,
completeProcess,
createWindow,
focusWindow,
initialState,
reducer,
focusWindow,
registerProcess,
reloadWindow,
setWindowAlwaysOnTop,
Expand Down
13 changes: 10 additions & 3 deletions pluto/src/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import "@/button/Button.css";
import { Icon } from "@synnaxlabs/media";
import { TimeSpan } from "@synnaxlabs/x/telem";
import { toArray } from "@synnaxlabs/x/toArray";
import { type ComponentPropsWithoutRef, type ReactElement } from "react";
import { type ComponentPropsWithoutRef, type ReactElement, useCallback } from "react";

import { type Align } from "@/align";
import { Color } from "@/color";
Expand Down Expand Up @@ -100,8 +100,15 @@ export const Button = Tooltip.wrap(

Triggers.use({
triggers,
// @ts-expect-error
callback: ({ stage }) => stage === "end" && handleClick(new MouseEvent("click")),
callback: useCallback<(e: Triggers.UseEvent) => void>(
({ stage }) => {
if (stage === "end")
handleClick(
new MouseEvent("click") as unknown as React.MouseEvent<HTMLButtonElement>,
);
},
[handleClick],
),
});

return (
Expand Down
1 change: 0 additions & 1 deletion pluto/src/css/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { type BEM, newBEM } from "@/css/bem";
import { CSSGridBuilder } from "@/css/grid";
import { applyCSSVars, removeCSSVars } from "@/css/vars";
import { type ComponentSize } from "@/util/component";
import { act } from '@testing-library/react';

export interface CSSType extends BEM {
visible: (visible: boolean) => string;
Expand Down
2 changes: 0 additions & 2 deletions pluto/src/dialog/use.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import "@/dropdown/Dropdown.css";

import { useCallback, useEffect, useState } from "react";

import { Triggers } from "@/triggers";

/** Props for the {@link use} hook. */
export interface UseProps {
initialVisible?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion pluto/src/state/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// included in the file licenses/APL.txt.

import { type Primitive, type UnknownRecord } from "@synnaxlabs/x";
import { useId, useState } from "react";
import { useState } from "react";

export type State = Primitive | UnknownRecord;
export type SetFunc<S, PS = S> = (prev: PS) => S;
Expand Down
2 changes: 1 addition & 1 deletion pluto/src/tree/Tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export interface TreeProps
children?: RenderProp<ItemProps>;
virtual?: boolean;
showRules?: boolean;
loading?: string;
loading?: string | null | false;
}

export type Item = FC<ItemProps>;
Expand Down
1 change: 0 additions & 1 deletion pluto/src/triggers/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import { Icon } from "@synnaxlabs/media";
import { type ReactElement } from "react";

import { Align } from "@/align";
import { Text as Core } from "@/text";
import { type Key, type Trigger } from "@/triggers/triggers";

Expand Down
2 changes: 1 addition & 1 deletion pluto/src/triggers/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export interface UseEvent {

export interface UseProps {
triggers?: Trigger[];
callback?: (e: UseEvent) => void;
region?: RefObject<HTMLElement>;
loose?: boolean;
callback?: (e: UseEvent) => void;
}

export const use = ({ triggers, callback: f, region, loose }: UseProps): void => {
Expand Down
4 changes: 2 additions & 2 deletions x/ts/src/compare/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ export const stringsWithNumbers = (a: string, b: string): number => {
const alphaNumericRegex = /([a-zA-Z]+)|(\d+)/g;

// Remove separators and split into parts
const aParts = a.replace(/[\s_.\-]+/g, "").match(alphaNumericRegex);
const bParts = b.replace(/[\s_.\-]+/g, "").match(alphaNumericRegex);
const aParts = a.replace(/[\s_.-]+/g, "").match(alphaNumericRegex);
const bParts = b.replace(/[\s_.-]+/g, "").match(alphaNumericRegex);

if (!aParts || !bParts) return 0;

Expand Down
1 change: 0 additions & 1 deletion x/ts/src/deep/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
// License, use of this software will be governed by the Apache License, Version 2.0,
// included in the file licenses/APL.txt.

import { caseconv } from "@/caseconv";
import { type Join } from "@/join";
import { type UnknownRecord } from "@/record";

Expand Down

0 comments on commit 37f2881

Please sign in to comment.