Skip to content

Commit

Permalink
eslint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
C2dricLeroy committed Nov 18, 2024
1 parent 3d21267 commit e5b0457
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 46 deletions.
1 change: 1 addition & 0 deletions my-app/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ module.exports = {
'jsx-a11y/alt-text': 'warn',
'jsx-a11y/anchor-is-valid': 'warn',
'semi': ['error', 'always'],
'@typescript-eslint/no-explicit-any': 'off',
},
};
27 changes: 14 additions & 13 deletions my-app/src/components/LanguageFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client"
"use client";

import * as React from "react"
import { Check, ChevronsUpDown, X } from "lucide-react"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import * as React from "react";
import { Check, ChevronsUpDown, X } from "lucide-react";
import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import { useTranslations } from 'next-intl';
import {
Command,
Expand All @@ -12,22 +12,23 @@ import {
CommandInput,
CommandItem,
CommandList,
} from "@/components/ui/command"
} from "@/components/ui/command";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
} from "@/components/ui/popover";


interface LanguageFilterProps {
// eslint-disable-next-line
onSelectLanguage?: (language: string) => void;
}

export default function LanguageFilter({ onSelectLanguage }: LanguageFilterProps) {
const [open, setOpen] = React.useState(false)
const [languages, setLanguages] = React.useState<{ value: string, label: string }[]>([])
const [value, setValue] = React.useState<string>('')
const [open, setOpen] = React.useState(false);
const [languages, setLanguages] = React.useState<{ value: string, label: string }[]>([]);
const [value, setValue] = React.useState<string>('');

const t = useTranslations('LanguageFilter');

Expand All @@ -37,7 +38,7 @@ export default function LanguageFilter({ onSelectLanguage }: LanguageFilterProps
if (onSelectLanguage) {
onSelectLanguage(val);
}
}
};

const handleClearSelection = () => {
setValue('');
Expand Down Expand Up @@ -114,7 +115,7 @@ export default function LanguageFilter({ onSelectLanguage }: LanguageFilterProps
key={language.value}
value={language.value}
onSelect={() => {
handleSetValue(language.value)
handleSetValue(language.value);
}}
>
<Check
Expand All @@ -131,5 +132,5 @@ export default function LanguageFilter({ onSelectLanguage }: LanguageFilterProps
</Command>
</PopoverContent>
</Popover>
)
);
}
14 changes: 7 additions & 7 deletions my-app/src/components/Modetoggle.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
"use client";

import * as React from "react"
import { MoonIcon, SunIcon } from "@radix-ui/react-icons"
import { useTheme } from "next-themes"
import * as React from "react";
import { MoonIcon, SunIcon } from "@radix-ui/react-icons";
import { useTheme } from "next-themes";

import { Button } from "@/components/ui/button"
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
} from "@/components/ui/dropdown-menu";
import {useTranslations} from "next-intl";

export function ModeToggle() {
const t = useTranslations('ModeToggle');
const { setTheme } = useTheme()
const { setTheme } = useTheme();

return (
<DropdownMenu>
Expand All @@ -38,5 +38,5 @@ export function ModeToggle() {
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
);
}
19 changes: 10 additions & 9 deletions my-app/src/components/SigninComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ export default function SigninComponent() {
const [email, setEmail] = useState<string>('');
const [errorMessage, setErrorMessage] = useState<string | null>(null);

const router = useRouter()
const router = useRouter();

const signinSubmit = async (e: FormEvent) => {
e.preventDefault()
e.preventDefault();

const url = process.env.NEXT_PUBLIC_BASE_URL + '/api/auth/login/';

const data = {
"username": email,
'password': password
}
const data = {
"username": email,
'password': password
};

try {
const response = await fetch(url, {
Expand All @@ -45,11 +45,11 @@ export default function SigninComponent() {
throw new Error(`HTTP Error: ${response.status}`);
}

router.push('/dashboard');
router.push("/dashboard" as any);
} catch (error) {
console.error('Error fetching data:', error);
}
}
};

return (
<>
Expand Down Expand Up @@ -100,10 +100,11 @@ export default function SigninComponent() {
</Button>
<div className="text-center mt-6">
<p>{t('Dont have an account?')}</p>
{/* @ts-expect-error on Link href*/}
<Link href="/signup" className="text-blue-500 ml-2">{t('Sign up')}</Link>
</div>
</form>
</div>
</>
)
);
}
5 changes: 3 additions & 2 deletions my-app/src/components/SignupComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function SignupComponent() {
throw new Error(`Signup error: ${response.status}`);
}

router.push('/signin');
router.push('/signin' as any);
} catch (error) {
console.error('Signup error:', error);
}
Expand Down Expand Up @@ -93,7 +93,7 @@ export default function SignupComponent() {
id="username"
placeholder={t('Enter your username')}
className="w-full"
onChange={(e) => setEmail(e.target.value)}
onChange={(e) => setUsername(e.target.value)}
required
/>
</div>
Expand Down Expand Up @@ -147,6 +147,7 @@ export default function SignupComponent() {
</Button>
<div className="text-center mt-6">
<p>{t('Already have an account?')}</p>
{/* @ts-expect-error on Link href*/}
<Link href="/signin" className="text-blue-500 ml-2">{t('Sign In')}</Link>
</div>
</form>
Expand Down
12 changes: 7 additions & 5 deletions my-app/src/components/theme-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"use client"
"use client";

import * as React from "react"
import { ThemeProvider as NextThemesProvider } from "next-themes"
import { type ThemeProviderProps } from "next-themes/dist/types"
import * as React from "react";
import { ThemeProvider as NextThemesProvider } from "next-themes";
import { type ThemeProviderProps } from "next-themes/dist/types";

export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
return (
<NextThemesProvider {...props}>{children}</NextThemesProvider>
);
}
18 changes: 8 additions & 10 deletions my-app/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import * as React from "react";
import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/lib/utils"
import { cn } from "@/lib/utils";

const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
Expand Down Expand Up @@ -34,7 +33,7 @@ const buttonVariants = cva(
size: "default",
},
}
)
);

export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
Expand All @@ -51,8 +50,7 @@ export interface ButtonProps
}

const Button = React.forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(
({ className, variant, size, asChild = false, link, ...props }, ref) => {
const Comp = asChild ? Slot : (link ? "a" : "button");
({ className, variant, size, link, ...props }, ref) => {

if (link) {
return (
Expand All @@ -61,7 +59,7 @@ const Button = React.forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonPro
ref={ref as React.Ref<HTMLAnchorElement>}
href={link}
{...(props as React.AnchorHTMLAttributes<HTMLAnchorElement>)}
/>
>{props.children || "Link"}</a>
);
} else {
return (
Expand All @@ -76,6 +74,6 @@ const Button = React.forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonPro
);


Button.displayName = "Button"
Button.displayName = "Button";

export { Button, buttonVariants }
export { Button, buttonVariants };

0 comments on commit e5b0457

Please sign in to comment.