Skip to content

Commit

Permalink
[FCE-926] Fix lint config (#188)
Browse files Browse the repository at this point in the history
## Description

Update lint config and fix new errors in example app.

## Motivation and Context

Unify lint configuration in workspace

## Types of changes

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to
      not work as expected)
  • Loading branch information
mironiasty authored Nov 27, 2024
1 parent fd8fddd commit 0f0b4e0
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ module.exports = {
"no-case-declarations": "off",
"react-hooks/exhaustive-deps": "error",
"react-hooks/rules-of-hooks": "error",
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
"react-refresh/only-export-components": ["error", { allowConstantExport: true }],
},
};
9 changes: 2 additions & 7 deletions examples/react-client/fishjam-chat/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
],
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
"error",
{ allowConstantExport: true },
],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FC, useEffect, useRef } from "react";
import type { FC } from "react";
import { useEffect, useRef } from "react";

interface AudioPlayerProps {
stream?: MediaStream | null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import AudioPlayer from "./AudioPlayer";
import { Track } from "@fishjam-cloud/react-client";
import type { Track } from "@fishjam-cloud/react-client";

type Props = {
audioTracks: Track[] | undefined;
Expand Down
12 changes: 4 additions & 8 deletions examples/react-client/fishjam-chat/src/components/BlurToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { TrackMiddleware, useCamera } from "@fishjam-cloud/react-client";
import {
createContext,
FC,
PropsWithChildren,
useCallback,
useContext,
} from "react";
import type { TrackMiddleware } from "@fishjam-cloud/react-client";
import { useCamera } from "@fishjam-cloud/react-client";
import type { FC, PropsWithChildren } from "react";
import { createContext, useCallback, useContext } from "react";
import { BlurProcessor } from "../utils/blur/BlurProcessor";
import { Button, type ButtonProps } from "./ui/button";
import { Stars } from "lucide-react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC } from "react";
import type { FC } from "react";
import {
Select,
SelectContent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { useInitializeDevices, useConnect } from "@fishjam-cloud/react-client";

import { Loader2 } from "lucide-react";

import { FC, useEffect } from "react";
import type { FC } from "react";
import { useEffect } from "react";
import {
Card,
CardContent,
Expand All @@ -23,7 +24,7 @@ import {

import { useForm } from "react-hook-form";
import { getRoomCredentials } from "@/lib/roomManager";
import { RoomForm } from "@/types";
import type { RoomForm } from "@/types";
import { getPersistedFormValues, persistFormValues } from "@/lib/utils";
import { useAutoConnect } from "@/hooks/useAutoConnect";
import { CameraSettings, MicrophoneSettings } from "./DeviceSettings";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FC, PropsWithChildren } from "react";
import type { FC, PropsWithChildren } from "react";
import {
SheetTrigger,
SheetContent,
Expand Down
2 changes: 1 addition & 1 deletion examples/react-client/fishjam-chat/src/components/Tile.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import VideoPlayer from "./VideoPlayer";
import { Track } from "@fishjam-cloud/react-client";
import type { Track } from "@fishjam-cloud/react-client";
import AudioPlayer from "./AudioPlayer";
import { Badge } from "./ui/badge";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FC, useEffect, useRef } from "react";
import type { FC } from "react";
import { useEffect, useRef } from "react";

interface VideoPlayerProps extends React.HTMLAttributes<HTMLVideoElement> {
stream?: MediaStream | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ const badgeVariants = cva(
export type BadgeProps = React.HTMLAttributes<HTMLDivElement> &
VariantProps<typeof badgeVariants>;

function Badge({ className, variant, ...props }: BadgeProps) {
export function Badge({ className, variant, ...props }: BadgeProps) {
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
);
}

export { Badge, badgeVariants };
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export interface ButtonProps
asChild?: boolean;
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return (
Expand All @@ -54,5 +54,3 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
},
);
Button.displayName = "Button";

export { Button, buttonVariants };
16 changes: 2 additions & 14 deletions examples/react-client/fishjam-chat/src/hooks/useAutoConnect.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { getRoomCredentials } from "@/lib/roomManager";
import {
useConnect,
useInitializeDevices,
useStatus,
} from "@fishjam-cloud/react-client";
import { useConnect, useStatus } from "@fishjam-cloud/react-client";
import { useCallback, useEffect } from "react";

export const useAutoConnect = () => {
const connect = useConnect();
const peerStatus = useStatus();
const { initializeDevices } = useInitializeDevices();

const qs = new URLSearchParams(window.location.search);

Expand All @@ -30,14 +25,7 @@ export const useAutoConnect = () => {
token: peerToken,
peerMetadata: { displayName: peerName },
});
}, [
isPeerIdle,
roomName,
peerName,
roomManagerUrl,
initializeDevices,
connect,
]);
}, [isPeerIdle, roomName, peerName, roomManagerUrl, connect]);

useEffect(() => {
handleConnection();
Expand Down
2 changes: 1 addition & 1 deletion examples/react-client/fishjam-chat/src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RoomForm } from "@/types";
import type { RoomForm } from "@/types";
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
FilesetResolver,
ImageSegmenter,
ImageSegmenterCallback,
} from "@mediapipe/tasks-vision";
import type { ImageSegmenterCallback } from "@mediapipe/tasks-vision";
import { FilesetResolver, ImageSegmenter } from "@mediapipe/tasks-vision";
import BlurWorker from "./BlurProcessorWorker?worker";

export class BlurProcessor {
Expand Down

0 comments on commit 0f0b4e0

Please sign in to comment.