Skip to content

Commit

Permalink
feat: apply updated biome linting rules to entire codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
amalv committed Mar 11, 2024
1 parent c902f56 commit 1bba04d
Show file tree
Hide file tree
Showing 28 changed files with 46 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, screen, waitFor } from "@testing-library/react";
import { ReactNode } from "react";
import type { ReactNode } from "react";
import { describe, it, vi } from "vitest";

import { App } from "./App";
Expand Down
7 changes: 6 additions & 1 deletion src/components/LibraryPage/LibraryPage.styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { Card, CardActionArea, CardMedia, CardMediaProps } from "@mui/material";
import {
Card,
CardActionArea,
CardMedia,
type CardMediaProps,
} from "@mui/material";
import { styled } from "@mui/material/styles";

export const Root = styled("div")(({ theme }) => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MockedProvider } from "@apollo/client/testing";
import { render, screen } from "@testing-library/react";

import { Book } from "../../../../../../data/books";
import type { Book } from "../../../../../../data/books";

import { BookCard } from "./BookCard";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box, Grid } from "@mui/material";

import { CardContent, FavoriteButton } from "./components";

import { Book } from "@/data/books";
import type { Book } from "@/data/books";

export const BookCard: React.FC<{ book: Book }> = ({ book }) => (
<Grid item xs={6} sm={4} md={4} lg={3} xl={2} key={book.title}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { Card, CardActionArea, CardMedia, CardMediaProps } from "@mui/material";
import {
Card,
CardActionArea,
CardMedia,
type CardMediaProps,
} from "@mui/material";
import { styled } from "@mui/material/styles";

export const CardWrapper = styled(Card)(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render, screen } from "@testing-library/react";

import { CardContent } from "./CardContent";

import { Book } from "@/data/books";
import type { Book } from "@/data/books";

describe("CardContent", () => {
it("renders correctly", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "./CardContent.styles";
import { BookDetails, CircularProgressWithLabel } from "./components";

import { Book } from "@/data/books";
import type { Book } from "@/data/books";

interface CardContentProps {
book: Book;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styled from "@emotion/styled";
import {
Box,
CircularProgress,
CircularProgressProps,
type CircularProgressProps,
Typography,
} from "@mui/material";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { InMemoryCache, gql, useMutation } from "@apollo/client";
import { MockedProvider } from "@apollo/client/testing";
import { useAuth0 } from "@auth0/auth0-react";
import { act, renderHook } from "@testing-library/react";
import { ReactNode } from "react";
import type { ReactNode } from "react";
import { vi } from "vitest";

import { useAddFavorite } from "./useAddFavorite";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { InMemoryCache, useApolloClient } from "@apollo/client";
import { MockedProvider } from "@apollo/client/testing";
import { useAuth0 } from "@auth0/auth0-react";
import { act, renderHook } from "@testing-library/react";
import { ReactNode } from "react";
import type { ReactNode } from "react";
import { vi } from "vitest";

import { useFavorite } from "./useFavorite";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { InMemoryCache, useMutation } from "@apollo/client";
import { MockedProvider } from "@apollo/client/testing";
import { act, renderHook } from "@testing-library/react";
import { ReactNode } from "react";
import type { ReactNode } from "react";
import { vi } from "vitest";

import { useRemoveFavorite } from "./useRemoveFavorite";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BookCard, Message } from "../";

import { Book } from "@/data/books";
import type { Book } from "@/data/books";

export const BooksView = ({ books }: { books: Book[] }) =>
books.length > 0 ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApolloError } from "@apollo/client";
import { SnackbarCloseReason } from "@mui/material";
import type { ApolloError } from "@apollo/client";
import type { SnackbarCloseReason } from "@mui/material";

import { ErrorSnackbar } from "../../../../../shared";
import { Message } from "../Message";
Expand Down
2 changes: 1 addition & 1 deletion src/components/LibraryPage/components/Books/hooks/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Book } from "../../../../../data/books";
import type { Book } from "../../../../../data/books";

export interface FetchMoreResult {
books: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useIntersectionObserver } from "./useIntersectionObserver";
import { getCloseSnackbarHandler, getUpdateQuery } from "./utils";

import { useAuth } from "@/contexts";
import { BOOKS_QUERY, BooksData, BooksVars } from "@/data/books";
import { BOOKS_QUERY, type BooksData, type BooksVars } from "@/data/books";

const PAGE_SIZE = 50;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
import type {
ApolloQueryResult,
FetchMoreOptions,
FetchMoreQueryOptions,
} from "@apollo/client";
import { useCallback, useRef } from "react";

import { BooksData, BooksVars } from "../../../../../data/books";
import type { BooksData, BooksVars } from "../../../../../data/books";

import { FetchMoreResult } from "./types";
import type { FetchMoreResult } from "./types";

type FetchMoreFunction = (
options: FetchMoreQueryOptions<BooksVars, BooksData> &
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { renderHook } from "@testing-library/react";
import { RefObject } from "react";
import type { RefObject } from "react";
import { vi } from "vitest";

import { useIntersectionObserver } from "./useIntersectionObserver";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RefObject, useCallback, useEffect, useMemo } from "react";
import { type RefObject, useCallback, useEffect, useMemo } from "react";

const ROOT_MARGIN = "20px";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { vi } from "vitest";

import { FetchMoreResult } from "../types";
import type { FetchMoreResult } from "../types";

import { getCloseSnackbarHandler, getUpdateQuery } from "./utils";

import { BooksData } from "@/data/books";
import type { BooksData } from "@/data/books";

describe("utils", () => {
describe("getCloseSnackbarHandler", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SnackbarCloseReason } from "@mui/material";
import type { SnackbarCloseReason } from "@mui/material";

import { FetchMoreResult } from "../types";
import type { FetchMoreResult } from "../types";

import { BooksData } from "@/data/books";
import type { BooksData } from "@/data/books";

const PAGE_SIZE = 50;

Expand Down
2 changes: 1 addition & 1 deletion src/components/LibraryPage/components/Search/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box } from "@mui/material";
import { ChangeEvent, Dispatch, SetStateAction } from "react";
import type { ChangeEvent, Dispatch, SetStateAction } from "react";

import { StyledTextField } from "./SearchInput.styles";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { User, useAuth0 } from "@auth0/auth0-react";
import { type User, useAuth0 } from "@auth0/auth0-react";
import { Avatar, CircularProgress, Menu, MenuItem } from "@mui/material";
import { useCallback, useState } from "react";

Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/ErrorSnackbar/ErrorSnackbar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Alert, Snackbar } from "@mui/material";
import { SnackbarCloseReason } from "@mui/material/Snackbar";
import type { SnackbarCloseReason } from "@mui/material/Snackbar";

interface ErrorSnackbarProps {
open: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/AuthContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { User } from "@auth0/auth0-react";
import type { User } from "@auth0/auth0-react";
import { createContext } from "react";

interface AuthContextProps {
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/AuthProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GetTokenSilentlyOptions, useAuth0 } from "@auth0/auth0-react";
import { type GetTokenSilentlyOptions, useAuth0 } from "@auth0/auth0-react";
import { jwtDecode } from "jwt-decode";
import { useEffect, useMemo, useState } from "react";

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/paletteConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PaletteOptions } from "@mui/material";
import type { PaletteOptions } from "@mui/material";

export const getPaletteConfig = (darkMode: boolean): PaletteOptions => ({
mode: darkMode ? "dark" : "light",
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"],
"@/*": ["src/*"]
},
"target": "ES2020",
"useDefineForClassFields": true,
Expand All @@ -23,8 +23,8 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }],
"references": [{ "path": "./tsconfig.node.json" }]
}
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path";

import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
Expand Down

1 comment on commit 1bba04d

@github-actions
Copy link

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.