Skip to content

Commit

Permalink
Merge pull request #7 from Dosbodoke/6-add-simple-import-sort-to-eslint
Browse files Browse the repository at this point in the history
Added linting to import/export
  • Loading branch information
Dosbodoke authored Oct 1, 2023
2 parents fc0628a + a8a0e54 commit 2efc01f
Show file tree
Hide file tree
Showing 27 changed files with 280 additions and 75 deletions.
10 changes: 9 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"extends": "next/core-web-vitals"
"extends": "next/core-web-vitals",
"plugins": ["simple-import-sort", "import"],
"rules": {
"simple-import-sort/imports": "warn",
"simple-import-sort/exports": "warn",
"import/first": "error",
"import/newline-after-import": "warn",
"import/no-duplicates": "error"
}
}
4 changes: 2 additions & 2 deletions app/[locale]/Providers.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";

import type { ReactNode } from "react";
import { ThemeProvider } from "next-themes";
import { type AbstractIntlMessages, NextIntlClientProvider } from "next-intl";
import { ThemeProvider } from "next-themes";
import type { ReactNode } from "react";

import { ReactQueryProvider } from "@/components/ReactQueryProvider";

Expand Down
7 changes: 4 additions & 3 deletions app/[locale]/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import supabase from "@/utils/supabase";
import Tabs from "@/components/tabs/Tabs";
import RegistryEntry from "@/components/RegistryEntry";
import HighlineImage from "@/components/HighlineImage";
import RegistryEntry from "@/components/RegistryEntry";
import Tabs from "@/components/tabs/Tabs";
import supabase from "@/utils/supabase";

import GoBack from "./_components/GoBack";

export async function generateStaticParams() {
Expand Down
6 changes: 4 additions & 2 deletions app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import "./globals.css";
import { Inter } from "next/font/google";

import { Analytics } from "@vercel/analytics/react";
import { Inter } from "next/font/google";
import { notFound } from "next/navigation";

import Providers from "./Providers";
import Footer from "@/components/Footer";
import NavBar from "@/components/layout/navbar";

import Providers from "./Providers";

const inter = Inter({ subsets: ["latin"] });

export const metadata = {
Expand Down
9 changes: 5 additions & 4 deletions app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"use client";

import { useState, useEffect } from "react";
import supabase, { type Tables } from "@/utils/supabase";
import Highline from "@/components/Highline";
import { useTranslations } from "next-intl";
import { useEffect, useState } from "react";

import { SearchSvg } from "@/assets";
import CreateHighline from "@/components/CreateHighline";
import { useTranslations } from "next-intl";
import Highline from "@/components/Highline";
import supabase, { type Tables } from "@/utils/supabase";

export default function Home() {
const [highlines, setHighlines] = useState<Tables["highline"]["Row"][]>([]);
Expand Down
2 changes: 1 addition & 1 deletion assets/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SVGAttributes } from "react";
import { motion } from "framer-motion";
import { SVGAttributes } from "react";

export const PlusSvg = (props: SVGAttributes<SVGElement>) => (
<svg
Expand Down
19 changes: 9 additions & 10 deletions components/CreateHighline.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
"use client";

import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useMutation } from "@tanstack/react-query";
import { z } from "zod";
import Link from "next/link";
import { useTranslations } from "next-intl";
import { useState } from "react";
import { useForm } from "react-hook-form";
import { v4 as uuidv4 } from "uuid";
import { z } from "zod";

import { PlusSvg } from "@/assets";
import supabase, {
ACCEPTED_IMAGE_TYPES,
MAX_FILE_SIZE,
} from "@/utils/supabase";

import { PlusSvg } from "@/assets";
import { SuccessAnimation } from "./animations/SuccessAnimation";
import { Form, FormField, FormControl, FormItem, FormLabel } from "./ui/Form";
import Button from "./ui/Button";
import {
Dialog,
DialogContent,
Expand All @@ -22,14 +25,10 @@ import {
DialogTitle,
DialogTrigger,
} from "./ui/Dialog";
import Dropzone from "./ui/Dropzone";
import { Form, FormControl, FormField, FormItem, FormLabel } from "./ui/Form";
import { Input } from "./ui/Input";
import TextField from "./ui/TextField";
import { TextArea } from "./ui/TextArea";
import Dropzone from "./ui/Dropzone";
import Button from "./ui/Button";
import Link from "next/link";
import { useState } from "react";
import { useTranslations } from "next-intl";

const formSchema = z.object({
name: z.string().min(3, "Deve conter ao menos 3 caracteres"),
Expand Down
2 changes: 1 addition & 1 deletion components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { useTranslations } from "next-intl";
import Link from "next/link";
import { useTranslations } from "next-intl";

function Footer() {
const t = useTranslations("footer");
Expand Down
5 changes: 3 additions & 2 deletions components/Highline.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Link from "next/link";
import { useTranslations } from "next-intl";

import type { Tables } from "@/utils/supabase";
import { ArrowIcon } from "@/assets";
import type { Tables } from "@/utils/supabase";

import HighlineImage from "./HighlineImage";
import { useTranslations } from "next-intl";

interface Props {
highline: Tables["highline"]["Row"];
Expand Down
14 changes: 7 additions & 7 deletions components/RegistryEntry.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
"use client";

import { useState, useEffect } from "react";
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { useTranslations } from "next-intl";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import { z } from "zod";

import supabase from "@/utils/supabase";
import { PlusSvg } from "@/assets";
import { transformTimeStringToSeconds } from "@/utils/helperFunctions";
import supabase from "@/utils/supabase";

import { PlusSvg } from "@/assets";
import { SuccessAnimation } from "./animations/SuccessAnimation";
import { TextArea } from "./ui/TextArea";
import Button from "./ui/Button";
import NumberPicker from "./ui/NumberPicker";
import {
Dialog,
DialogContent,
Expand All @@ -31,7 +30,8 @@ import {
FormLabel,
} from "./ui/Form";
import { Input } from "./ui/Input";
import { useTranslations } from "next-intl";
import NumberPicker from "./ui/NumberPicker";
import { TextArea } from "./ui/TextArea";

const formSchema = z.object({
instagram: z
Expand Down
2 changes: 1 addition & 1 deletion components/animations/SuccessAnimation.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { Player } from "@lottiefiles/react-lottie-player";
import React from "react";

import succesAnimation from "@/assets/success-animation.json";

Expand Down
11 changes: 4 additions & 7 deletions components/layout/navbar/LocaleSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@

import { useLocale, useTranslations } from "next-intl";
import { usePathname, useRouter } from "next-intl/client";
import { ChangeEvent, useTransition } from "react";
import { useTransition } from "react";

import {
Select,
SelectTrigger,
SelectValue,
SelectContent,
SelectGroup,
SelectLabel,
SelectItem,
SelectLabel,
SelectTrigger,
SelectValue,
} from "@/components/ui/Select";

import { cn } from "@/utils/cn";
import { ChevronDownIcon } from "@radix-ui/react-icons";

export default function LocaleSwitcher() {
const t = useTranslations("LocaleSwitcher");
const [isPending, startTransition] = useTransition();
Expand Down
2 changes: 1 addition & 1 deletion components/layout/navbar/ThemeToggler.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { useEffect, useState } from "react";
import { useTheme } from "next-themes";
import { useEffect, useState } from "react";

import { MoonIcon, SunIcon } from "@/assets";

Expand Down
3 changes: 2 additions & 1 deletion components/tabs/Comments.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"use client";

import { useInfiniteQuery } from "@tanstack/react-query";
import React from "react";
import Link from "next/link";
import { useFormatter } from "next-intl";
import React from "react";

import supabase, { type Tables } from "@/utils/supabase";

import LoadingSkeleton from "./Ranking/LoadingSkeleton";
import SeeMore from "./SeeMore";

Expand Down
7 changes: 4 additions & 3 deletions components/tabs/Ranking/Cadenas.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import Link from "next/link";
import { useInfiniteQuery } from "@tanstack/react-query";
import Link from "next/link";
import React from "react";

import supabase, { type Tables } from "@/utils/supabase";
import LoadingSkeleton from "./LoadingSkeleton";

import SeeMore from "../SeeMore";
import LoadingSkeleton from "./LoadingSkeleton";

interface Props {
highline: Tables["highline"]["Row"];
Expand Down
5 changes: 3 additions & 2 deletions components/tabs/Ranking/CategoryDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"use client";

import { useTranslations } from "next-intl";
import { useState } from "react";

import { type Category, type Categories } from "./index";
import { ArrowDownSvg } from "@/assets";
import { useTranslations } from "next-intl";

import { type Categories, type Category } from "./index";

interface Props {
categories: Categories;
Expand Down
7 changes: 4 additions & 3 deletions components/tabs/Ranking/Distance.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import Link from "next/link";
import { useInfiniteQuery } from "@tanstack/react-query";
import Link from "next/link";
import React from "react";

import supabase, { type Tables } from "@/utils/supabase";
import LoadingSkeleton from "./LoadingSkeleton";

import SeeMore from "../SeeMore";
import LoadingSkeleton from "./LoadingSkeleton";

interface Props {
highline: Tables["highline"]["Row"];
Expand Down
7 changes: 4 additions & 3 deletions components/tabs/Ranking/FullLine.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import Link from "next/link";
import { useInfiniteQuery } from "@tanstack/react-query";
import Link from "next/link";
import React from "react";

import supabase, { type Tables } from "@/utils/supabase";
import LoadingSkeleton from "./LoadingSkeleton";

import SeeMore from "../SeeMore";
import LoadingSkeleton from "./LoadingSkeleton";

interface Props {
highline: Tables["highline"]["Row"];
Expand Down
9 changes: 5 additions & 4 deletions components/tabs/Ranking/Speedline.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from "react";
import Link from "next/link";
import { useInfiniteQuery } from "@tanstack/react-query";
import Link from "next/link";
import { useFormatter } from "next-intl";
import React from "react";

import { transformSecondsToTimeString } from "@/utils/helperFunctions";
import supabase, { type Tables } from "@/utils/supabase";
import LoadingSkeleton from "./LoadingSkeleton";

import SeeMore from "../SeeMore";
import { useFormatter } from "next-intl";
import LoadingSkeleton from "./LoadingSkeleton";

interface Props {
highline: Tables["highline"]["Row"];
Expand Down
6 changes: 3 additions & 3 deletions components/tabs/Ranking/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"use client";

import { useTranslations } from "next-intl";
import React, { useMemo, useState } from "react";

import { type Tables } from "@/utils/supabase";

import Cadenas from "./Cadenas";
import CategoryDropdown from "./CategoryDropdown";
import Speedline from "./Speedline";
import Distance from "./Distance";
import Cadenas from "./Cadenas";
import FullLine from "./FullLine";
import { useTranslations } from "next-intl";
import Speedline from "./Speedline";

interface Props {
highline: Tables["highline"]["Row"];
Expand Down
7 changes: 4 additions & 3 deletions components/tabs/Tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"use client";

import { useMemo, useState } from "react";
import { motion } from "framer-motion";
import { useTranslations } from "next-intl";
import { useMemo, useState } from "react";

import type { Tables } from "@/utils/supabase";

import Comments from "./Comments";
import Info from "./Info";
import Ranking from "./Ranking";
import Comments from "./Comments";
import { useTranslations } from "next-intl";

type Tab = {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion components/ui/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";

import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { Cross1Icon } from "@radix-ui/react-icons";
import * as React from "react";

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

Expand Down
5 changes: 3 additions & 2 deletions components/ui/Dropzone.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { UploadCloudIcon } from "@/assets";
import React from "react";
import Image from "next/image";
import React from "react";

import { UploadCloudIcon } from "@/assets";
import { ACCEPTED_IMAGE_TYPES } from "@/utils/supabase";

interface Props {
Expand Down
4 changes: 1 addition & 3 deletions components/ui/NumberPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
"use client";

import { PlusSvg } from "@/assets";
import { MouseEventHandler, useEffect, useState } from "react";
import { MinusIcon } from "@radix-ui/react-icons";

import { motion } from "framer-motion";

import { PlusSvg } from "@/assets";
import { cn } from "@/utils/cn";

interface Props {
Expand Down
4 changes: 2 additions & 2 deletions components/ui/Select.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";

import * as React from "react";
import { CheckIcon, ChevronDownIcon } from "@radix-ui/react-icons";
import * as SelectPrimitive from "@radix-ui/react-select";
import { ChevronDownIcon, CheckIcon } from "@radix-ui/react-icons";
import * as React from "react";

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

Expand Down
Loading

1 comment on commit 2efc01f

@vercel
Copy link

@vercel vercel bot commented on 2efc01f Oct 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.