Skip to content

Commit

Permalink
lint: Lint and format the entire repo with the new configs
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Mar 13, 2024
1 parent bbeee76 commit af88d2a
Show file tree
Hide file tree
Showing 122 changed files with 424 additions and 411 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pnpm format:check
pnpm format
pnpm lint
3 changes: 0 additions & 3 deletions apps/browser-extension/.eslintrc.cjs

This file was deleted.

1 change: 1 addition & 0 deletions apps/browser-extension/src/BookmarkSavedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default function BookmarkSavedPage() {
<Link
className="flex gap-2 rounded-md p-3 text-black hover:text-black"
target="_blank"
rel="noreferrer"
to={`${settings.address}/dashboard/preview/${bookmarkId}`}
>
<ArrowUpRightFromSquare className="my-auto" size="20" />
Expand Down
1 change: 1 addition & 0 deletions apps/browser-extension/src/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default function Layout() {
<a
className="flex gap-2 text-black"
target="_blank"
rel="noreferrer"
href={`${settings.address}/dashboard/bookmarks`}
>
<Home />
Expand Down
1 change: 0 additions & 1 deletion apps/browser-extension/src/SignInPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default function SignInPage() {
setSettings((s) => ({ ...s, apiKey: resp.key }));
navigate("/options");
},
onError: () => {},
});

const [formData, setFormData] = useState<{
Expand Down
4 changes: 2 additions & 2 deletions apps/browser-extension/src/utils/settings.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useChromeStorageSync } from "use-chrome-storage";

export type Settings = {
export interface Settings {
apiKey: string;
address: string;
};
}

export default function usePluginSettings() {
const [settings, setSettings, _1, _2, isInit] = useChromeStorageSync(
Expand Down
3 changes: 2 additions & 1 deletion apps/browser-extension/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"include": ["src", "vite.config.ts"],
"exclude": ["node_modules"],
"references": [{ "path": "./tsconfig.node.json" }]
}
4 changes: 0 additions & 4 deletions apps/mobile/.eslintrc.js

This file was deleted.

4 changes: 1 addition & 3 deletions apps/mobile/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": [
"**/*"
],
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "app.hoarder.hoardermobile",
Expand Down
5 changes: 2 additions & 3 deletions apps/mobile/app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import "@/globals.css";
import "expo-dev-client";

import { useEffect } from "react";
import { View } from "react-native";
import { useRouter } from "expo-router";
import { Stack } from "expo-router/stack";
import { useShareIntent } from "expo-share-intent";
import { StatusBar } from "expo-status-bar";
import { useEffect } from "react";
import { View } from "react-native";

import { useLastSharedIntent } from "@/lib/last-shared-intent";
import { Providers } from "@/lib/providers";

Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/app/dashboard/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Tabs } from "expo-router";
import { ClipboardList, Home, Search, Settings } from "lucide-react-native";
import React from "react";

export default function TabLayout() {
return (
Expand Down
5 changes: 2 additions & 3 deletions apps/mobile/app/dashboard/(tabs)/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Link, Stack } from "expo-router";
import { SquarePen, Link as LinkIcon } from "lucide-react-native";
import { View } from "react-native";

import { Link, Stack } from "expo-router";
import BookmarkList from "@/components/bookmarks/BookmarkList";
import { Link as LinkIcon, SquarePen } from "lucide-react-native";

function HeaderRight() {
return (
Expand Down
3 changes: 1 addition & 2 deletions apps/mobile/app/dashboard/(tabs)/lists.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Link } from "expo-router";
import { useEffect, useState } from "react";
import { FlatList, View } from "react-native";

import { Link } from "expo-router";
import { api } from "@/lib/trpc";

export default function Lists() {
Expand Down
5 changes: 2 additions & 3 deletions apps/mobile/app/dashboard/(tabs)/search.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { keepPreviousData } from "@tanstack/react-query";
import { useState } from "react";
import { View } from "react-native";
import { useDebounce } from "use-debounce";

import BookmarkList from "@/components/bookmarks/BookmarkList";
import { Divider } from "@/components/ui/Divider";
import { Input } from "@/components/ui/Input";
import { api } from "@/lib/trpc";
import { keepPreviousData } from "@tanstack/react-query";
import { useDebounce } from "use-debounce";

export default function Search() {
const [search, setSearch] = useState("");
Expand Down
3 changes: 1 addition & 2 deletions apps/mobile/app/dashboard/(tabs)/settings.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useRouter } from "expo-router";
import { useEffect } from "react";
import { Text, View } from "react-native";

import { useRouter } from "expo-router";
import Logo from "@/components/Logo";
import { Button } from "@/components/ui/Button";
import { useSession } from "@/lib/session";
Expand Down
11 changes: 5 additions & 6 deletions apps/mobile/app/dashboard/add-link.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useRouter } from "expo-router";
import { useState } from "react";
import { View, Text } from "react-native";

import { Text, View } from "react-native";
import { useRouter } from "expo-router";
import { Button } from "@/components/ui/Button";
import { Input } from "@/components/ui/Input";
import { api } from "@/lib/trpc";
Expand All @@ -24,9 +23,9 @@ export default function AddNote() {
},
onError: (e) => {
let message;
if (e.data?.code === "BAD_REQUEST") {
const error = JSON.parse(e.message)[0];
message = error.message;
if (e.data?.zodError) {
const zodError = e.data.zodError;
message = JSON.stringify(zodError);
} else {
message = `Something went wrong: ${e.message}`;
}
Expand Down
11 changes: 5 additions & 6 deletions apps/mobile/app/dashboard/add-note.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useRouter } from "expo-router";
import { useState } from "react";
import { View, Text } from "react-native";

import { Text, View } from "react-native";
import { useRouter } from "expo-router";
import { Button } from "@/components/ui/Button";
import { Input } from "@/components/ui/Input";
import { api } from "@/lib/trpc";
Expand All @@ -24,9 +23,9 @@ export default function AddNote() {
},
onError: (e) => {
let message;
if (e.data?.code === "BAD_REQUEST") {
const error = JSON.parse(e.message)[0];
message = error.message;
if (e.data?.zodError) {
const zodError = e.data.zodError;
message = JSON.stringify(zodError);
} else {
message = `Something went wrong: ${e.message}`;
}
Expand Down
1 change: 0 additions & 1 deletion apps/mobile/app/dashboard/archive.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { View } from "react-native";

import BookmarkList from "@/components/bookmarks/BookmarkList";

export default function Archive() {
Expand Down
1 change: 0 additions & 1 deletion apps/mobile/app/dashboard/favourites.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { View } from "react-native";

import BookmarkList from "@/components/bookmarks/BookmarkList";

export default function Favourites() {
Expand Down
3 changes: 1 addition & 2 deletions apps/mobile/app/dashboard/lists/[slug].tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useLocalSearchParams, Stack } from "expo-router";
import { View } from "react-native";

import { Stack, useLocalSearchParams } from "expo-router";
import BookmarkList from "@/components/bookmarks/BookmarkList";
import FullPageSpinner from "@/components/ui/FullPageSpinner";
import { api } from "@/lib/trpc";
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/app/error.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { View, Text } from "react-native";
import { Text, View } from "react-native";

export default function ErrorPage() {
return (
Expand Down
3 changes: 1 addition & 2 deletions apps/mobile/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useRouter } from "expo-router";
import { useEffect } from "react";
import { View } from "react-native";

import { useRouter } from "expo-router";
import { useSession } from "@/lib/session";

export default function App() {
Expand Down
12 changes: 6 additions & 6 deletions apps/mobile/app/sharing.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Link, useLocalSearchParams, useRouter } from "expo-router";
import { ShareIntent, useShareIntent } from "expo-share-intent";
import type { ShareIntent } from "expo-share-intent";
import { useEffect, useMemo, useState } from "react";
import { View, Text } from "react-native";
import { z } from "zod";

import { Text, View } from "react-native";
import { Link, useLocalSearchParams, useRouter } from "expo-router";
import { useShareIntent } from "expo-share-intent";
import { api } from "@/lib/trpc";
import { z } from "zod";

type Mode =
| { type: "idle" }
Expand All @@ -18,7 +18,7 @@ function SaveBookmark({ setMode }: { setMode: (mode: Mode) => void }) {
const params = useLocalSearchParams();

const shareIntent = useMemo(() => {
if (params && params.shareIntent) {
if (params?.shareIntent) {
if (typeof params.shareIntent === "string") {
return JSON.parse(params.shareIntent) as ShareIntent;
}
Expand Down
5 changes: 2 additions & 3 deletions apps/mobile/app/signin.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useRouter } from "expo-router";
import { useEffect, useState } from "react";
import { View, Text } from "react-native";

import { Text, View } from "react-native";
import { useRouter } from "expo-router";
import Logo from "@/components/Logo";
import { Button } from "@/components/ui/Button";
import { Input } from "@/components/ui/Input";
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/components/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Text, View } from "react-native";
import { PackageOpen } from "lucide-react-native";
import { View, Text } from "react-native";

export default function Logo() {
return (
Expand Down
15 changes: 8 additions & 7 deletions apps/mobile/components/bookmarks/BookmarkCard.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { ZBookmark } from "@hoarder/trpc/types/bookmarks";
import * as WebBrowser from "expo-web-browser";
import { Star, Archive, Trash, ArchiveRestore } from "lucide-react-native";
import { View, Text, Image, ScrollView, Pressable } from "react-native";
import { Image, Pressable, ScrollView, Text, View } from "react-native";
import Markdown from "react-native-markdown-display";
import * as WebBrowser from "expo-web-browser";
import { api } from "@/lib/trpc";
import { Archive, ArchiveRestore, Star, Trash } from "lucide-react-native";

import type { ZBookmark } from "@hoarder/trpc/types/bookmarks";

import { ActionButton } from "../ui/ActionButton";
import { Divider } from "../ui/Divider";
import { Skeleton } from "../ui/Skeleton";
import { useToast } from "../ui/Toast";

import { api } from "@/lib/trpc";

const MAX_LOADING_MSEC = 30 * 1000;

export function isBookmarkStillCrawling(bookmark: ZBookmark) {
Expand Down Expand Up @@ -155,6 +155,7 @@ function LinkCard({ bookmark }: { bookmark: ZBookmark }) {
/>
) : (
<Image
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
source={require("@/assets/blur.jpeg")}
className="h-56 w-full rounded-t-lg"
/>
Expand All @@ -168,7 +169,7 @@ function LinkCard({ bookmark }: { bookmark: ZBookmark }) {
className="line-clamp-2 text-xl font-bold"
onPress={() => WebBrowser.openBrowserAsync(url)}
>
{bookmark.content.title || parsedUrl.host}
{bookmark.content.title ?? parsedUrl.host}
</Text>
<TagList bookmark={bookmark} />
<Divider orientation="vertical" className="mt-2 h-0.5 w-full" />
Expand Down
5 changes: 2 additions & 3 deletions apps/mobile/components/bookmarks/BookmarkList.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { useEffect, useState } from "react";
import { Text, View } from "react-native";
import Animated, { LinearTransition } from "react-native-reanimated";
import { api } from "@/lib/trpc";

import BookmarkCard from "./BookmarkCard";
import FullPageSpinner from "../ui/FullPageSpinner";

import { api } from "@/lib/trpc";
import BookmarkCard from "./BookmarkCard";

export default function BookmarkList({
favourited,
Expand Down
3 changes: 2 additions & 1 deletion apps/mobile/components/ui/ActionButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ActivityIndicator, Pressable, PressableProps } from "react-native";
import type { PressableProps } from "react-native";
import { ActivityIndicator, Pressable } from "react-native";

export function ActionButton({
children,
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/components/ui/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type VariantProps, cva } from "class-variance-authority";
import type { VariantProps } from "class-variance-authority";
import { Text, TouchableOpacity } from "react-native";

import { cn } from "@/lib/utils";
import { cva } from "class-variance-authority";

const buttonVariants = cva(
"flex flex-row items-center justify-center rounded-md",
Expand Down
1 change: 0 additions & 1 deletion apps/mobile/components/ui/Divider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { View } from "react-native";

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

function Divider({
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/components/ui/FullPageSpinner.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { View, ActivityIndicator } from "react-native";
import { ActivityIndicator, View } from "react-native";

export default function FullPageSpinner() {
return (
Expand Down
5 changes: 3 additions & 2 deletions apps/mobile/components/ui/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { forwardRef } from "react";
import { Text, TextInput, View } from "react-native";

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

export interface InputProps
Expand All @@ -15,14 +14,16 @@ const Input = forwardRef<React.ElementRef<typeof TextInput>, InputProps>(
<View className={cn("flex flex-col gap-1.5", className)}>
{label && <Text className={cn("text-base", labelClasses)}>{label}</Text>}
<TextInput
ref={ref}
className={cn(
inputClasses,
"border-input rounded-lg border px-4 py-2.5",
"rounded-lg border border-input px-4 py-2.5",
)}
{...props}
/>
</View>
),
);
Input.displayName = "Input";

export { Input };
6 changes: 3 additions & 3 deletions apps/mobile/components/ui/Skeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { View } from "react-native";
import { useEffect, useRef } from "react";
import { Animated, type View } from "react-native";

import { Animated } from "react-native";
import { cn } from "@/lib/utils";

function Skeleton({
Expand Down Expand Up @@ -28,7 +28,7 @@ function Skeleton({

return (
<Animated.View
className={cn("bg-muted rounded-md", className)}
className={cn("rounded-md bg-muted", className)}
style={[{ opacity: fadeAnim }]}
{...props}
/>
Expand Down
Loading

0 comments on commit af88d2a

Please sign in to comment.