Skip to content

Commit

Permalink
feat: sort import by ESLint (#134)
Browse files Browse the repository at this point in the history
Merge commits below into one commit:

* feat: sort import by ESLint
* chore: lint sort-imports
* fix: sort shared modules
* chore: lint `shared` modules

---------

Co-authored-by: Ourai L. <[email protected]>
  • Loading branch information
Debbl and ourai authored Feb 11, 2025
1 parent be135d0 commit 5a09537
Show file tree
Hide file tree
Showing 229 changed files with 1,121 additions and 924 deletions.
19 changes: 18 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"overrides": [
{
"files": ["src/**/*.js", "src/**/*.jsx"],
"plugins": ["headers"],
"plugins": ["headers", "perfectionist"],
"rules": {
"headers/header-format": [
"error",
Expand All @@ -42,6 +42,23 @@
"content": "Copyright 2024 OpenBuild\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.",
"trailingNewlines": 2
}
],
"perfectionist/sort-imports": [
"error",
{
"groups": [
["builtin", "external"],
"shared",
"src",
"unknown"
],
"customGroups": {
"value": {
"shared": ["^@/"],
"src": ["#/*"]
}
}
}
]
}
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"eslint": "^8.7.0",
"eslint-config-next": "^13.1.1",
"eslint-plugin-headers": "1.2.1",
"eslint-plugin-perfectionist": "4.8.0",
"eslint-plugin-tailwindcss": "3.15.1",
"husky": "9.1.7",
"ksio": "^0.0.3",
Expand Down
6 changes: 3 additions & 3 deletions src/app/(uc)/reset/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

'use client';

import { useState } from 'react';
import Link from 'next/link';
import { useSearchParams, useRouter } from 'next/navigation';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { toast } from 'react-toastify';

import Loader from '@/components/Loader';

import { useForm } from 'react-hook-form';
import { reset } from '#/services/auth';
import { toast } from 'react-toastify';

export default function Reset() {
const { register, handleSubmit, watch } = useForm();
Expand Down
3 changes: 2 additions & 1 deletion src/app/(uc)/signin/VerifyCodeLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
*/

import { useState, useEffect } from 'react';
import { isEmail } from 'validator';
import { toast } from 'react-toastify';
import { isEmail } from 'validator';

import { wrapOnChange } from '@/utils/form';

import { sendCode } from '#/services/auth';

export default function VerifyCodeLogin({ register, loginType, email }) {
Expand Down
15 changes: 8 additions & 7 deletions src/app/(uc)/signin/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@

'use client';

import { useState } from 'react';
import { isEmpty } from 'lodash';
import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline';
import clsx from 'clsx';
import { useSearchParams } from 'next/navigation';
import Link from 'next/link';
import { isEmpty } from 'lodash';
import { signIn } from 'next-auth/react';
import Link from 'next/link';
import { useSearchParams } from 'next/navigation';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { toast } from 'react-toastify';
import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline';

import { signin, emailCodeLogin } from '#/services/auth';
import { wrapOnChange } from '@/utils/form';
import Loader from '@/components/Loader';
import { wrapOnChange } from '@/utils/form';

import { signin, emailCodeLogin } from '#/services/auth';

import LoginTypeSwitcher from './LoginTypeSwitcher';
import VerifyCodeLogin from './VerifyCodeLogin';
Expand Down
18 changes: 10 additions & 8 deletions src/app/(uc)/signup/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,21 @@

'use client';

import Link from 'next/link';
import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline';
import clsx from 'clsx';
import { useSession } from 'next-auth/react';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useSearchParams } from 'next/navigation';
import { useEffect, useState } from 'react';
import { registerEmail, sendCode } from '#/services/auth';
import { useForm } from 'react-hook-form';
import { useRouter } from 'next/navigation';
import { toast } from 'react-toastify';
import Loader from '@/components/Loader';
import { useAccount } from 'wagmi';
import { useSearchParams } from 'next/navigation';
import { useSession } from 'next-auth/react';
import isEmail from 'validator/lib/isEmail';
import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline';
import { useAccount } from 'wagmi';

import Loader from '@/components/Loader';

import { registerEmail, sendCode } from '#/services/auth';

import { NavButtonStyle } from '../signin/page';
const SignupAfterStyle = 'after:content-[\'\'] after:absolute after:left-[-12px] after:bottom-0 after:w-3 after:h-3 after:bg-signup-gradient';
Expand Down
1 change: 1 addition & 0 deletions src/app/api/auth/[...nextauth]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import NextAuth from 'next-auth';

import { authOptions } from '#/lib/auth';

const handler = NextAuth(authOptions);
Expand Down
4 changes: 2 additions & 2 deletions src/app/bind/[type]/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

'use client';

import { useSearchParams, useRouter } from 'next/navigation';
import { signIn, signOut, useSession } from 'next-auth/react';
import { useSearchParams, useRouter } from 'next/navigation';
import { toast } from 'react-toastify';

import useMounted from '@/hooks/useMounted';
import Loader from '@/components/Loader';
import useMounted from '@/hooks/useMounted';

import { bindOAuth } from '#/services/auth';

Expand Down
4 changes: 2 additions & 2 deletions src/app/bounties/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

import Link from 'next/link';

import { fromNow } from '@/utils/date';
import { ArrowRightLineIcon } from '@/components/Icons';
import Avatar from '@/components/Avatar';
import { ArrowRightLineIcon } from '@/components/Icons';
import Image from '@/components/Image';
import { fromNow } from '@/utils/date';

import { useConfig } from '#/state/application/hooks';

Expand Down
10 changes: 5 additions & 5 deletions src/app/bounties/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

import { NoData } from '@/components/NoData';
import { PAGE_SIZE } from '@/constants/config';
import { get } from '@/utils/request';

import { FilterToggle } from '../learn/[type]/FilterToggle';
import { Search } from '../learn/[type]/Search';
import { Sort } from '../learn/[type]/Sort';
import { FilterToggle } from '../learn/[type]/FilterToggle';
import { List } from './List';

import { NoData } from '@/components/NoData';
import { get } from '@/utils/request';
import { PAGE_SIZE } from '@/constants/config';


export async function Container({ type, searchParams }) {
const page = Number(searchParams?.page) || 1;
Expand Down
12 changes: 7 additions & 5 deletions src/app/bounties/Filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@

'use client';

import clsx from 'clsx';
import { useRouter, useSearchParams, usePathname } from 'next/navigation';
import { createQueryString } from '@/utils';
import { ChevronUpIcon } from '@heroicons/react/20/solid';
import { bountyFilterList } from '#/lib/bountyFilterList';
import Image from 'next/image';
import clsx from 'clsx';
import { motion } from 'framer-motion';
import Image from 'next/image';
import { useRouter, useSearchParams, usePathname } from 'next/navigation';
import { useMemo, useState } from 'react';

import { ReactSelect } from '@/components/Select/ReactSelect';
import { createQueryString } from '@/utils';

import { bountyFilterList } from '#/lib/bountyFilterList';
import { useAllSkills } from '#/state/application/hooks';

export function SkillsFilter() {
Expand Down
6 changes: 4 additions & 2 deletions src/app/bounties/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

'use client';

import { useOpenFilter } from '#/state/application/hooks';
import clsx from 'clsx';

import { BountiesCard } from './Card';
import { OPagination } from '@/components/Pagination';

import { useOpenFilter } from '#/state/application/hooks';

import { BountiesCard } from './Card';

export function List({ data }) {
const openFilter = useOpenFilter();
return (
Expand Down
8 changes: 5 additions & 3 deletions src/app/bounties/[id]/Activities.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@

'use client';

import { RefetchIcon, StartTimeIcon, PushDoorIcon, AddThreeIcon, FinishedIcon } from '@/components/Icons';
import clsx from 'clsx';
import Image from 'next/image';
import useSWR from 'swr';

import { RefetchIcon, StartTimeIcon, PushDoorIcon, AddThreeIcon, FinishedIcon } from '@/components/Icons';
import { NoData } from '@/components/NoData';
import { useMediaUrl } from '#/state/application/hooks';
import { fromNow } from '@/utils/date';
import useSWR from 'swr';
import { fetcher } from '@/utils/request';

import { useMediaUrl } from '#/state/application/hooks';

export function Activities({ id }) {
const { data } = useSWR(`ts/v1/build/general/bounties/${id}/events/activities`, fetcher, {suspense: true});
const mediaUrl = useMediaUrl();
Expand Down
14 changes: 6 additions & 8 deletions src/app/bounties/[id]/AgreeFinishedModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@
*/

import { useState } from 'react';
import { toast } from 'react-toastify';
import { useNetwork, useWalletClient } from 'wagmi';

import { Button } from '@/components/Button';
import { Modal } from '@/components/Modal';

import { useNetwork, useWalletClient } from 'wagmi';

import { toast } from 'react-toastify';

import { withdraw } from '@/constants/bounty';
import { revalidatePathAction } from '../../actions';
// import { writeContract } from '@wagmi/core';

import { useBountyEnvCheck } from '#/domain/bounty/hooks';
// import { writeContract } from '@wagmi/core';
import {
// termination,
finishConfirm,
finishDeny,
// arbitrate,
} from '#/services/bounties';
import { useBountyEnvCheck } from '#/domain/bounty/hooks';

import { revalidatePathAction } from '../../actions';

export function AgreeFinishedModal({open, close, bounty}) {
const [loading, setLoading] = useState(false);
Expand Down
29 changes: 13 additions & 16 deletions src/app/bounties/[id]/AppliedModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,31 @@
* limitations under the License.
*/

import { useState, useMemo, useCallback } from 'react';
import Image from 'next/image';
import useSWR from 'swr';
import { Button } from '@/components/Button';
import clsx from 'clsx';

import { parseUnits } from '@ethersproject/units';
import { writeContract } from '@wagmi/core';

import clsx from 'clsx';
import Image from 'next/image';
import { useState, useMemo, useCallback } from 'react';
import { toast } from 'react-toastify';
import useSWR from 'swr';
import { useAccount } from 'wagmi'; // useNetwork

import { toast } from 'react-toastify';
import { NoData } from '@/components/NoData';
import { Button } from '@/components/Button';
import { Modal } from '@/components/Modal';
import { Confirm } from '@/components/Modal/Confirm';

import { useMediaUrl, useConfig } from '#/state/application/hooks';
import { EXPERIENCE_OPTIONS } from '#/lib/user';
import { useAllowance, useApprove } from '@/hooks/useERC20';
import { contracts, payTokens } from '@/constants/contract';
import { NoData } from '@/components/NoData';
import { BountyABI } from '@/constants/abis/bounty';
import { BOUNTY_SUPPORTED_CHAIN } from '@/constants/chain';

import { contracts, payTokens } from '@/constants/contract';
import { useAllowance, useApprove } from '@/hooks/useERC20';
import { fetcher } from '@/utils/request';

import { useBountyEnvCheck } from '#/domain/bounty/hooks';
import { EXPERIENCE_OPTIONS } from '#/lib/user';
import { denyBuilder, approveBuilder } from '#/services/creator';
import { useMediaUrl, useConfig } from '#/state/application/hooks';

import { revalidatePathAction } from '../../actions';
import { useBountyEnvCheck } from '#/domain/bounty/hooks';

export function AppliedModal({ open, closeModal, bounty }) {
const { data, isLoading, mutate } = useSWR(`ts/v1/build/creator/bounties/${bounty.id}/builders?skip=${0}&take=${25}`, fetcher);
Expand Down
15 changes: 7 additions & 8 deletions src/app/bounties/[id]/ApplyFinishedModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@
* limitations under the License.
*/

import { parseUnits } from '@ethersproject/units';
import { useState } from 'react';
import { toast } from 'react-toastify';
import { useNetwork, useWalletClient } from 'wagmi';

import { Button } from '@/components/Button';
import { Modal } from '@/components/Modal';

import { useNetwork, useWalletClient } from 'wagmi';
import { BOUNTY_SUPPORTED_CHAIN } from '@/constants/chain';
import { contracts, payTokens } from '@/constants/contract';
import { currentTime } from '@/utils/date';
import { signBounty } from '@/utils/web3';

import { useBountyEnvCheck } from '#/domain/bounty/hooks';
import { biulderFinish } from '#/services/bounties';
import { toast } from 'react-toastify';
import { signBounty } from '@/utils/web3';

import { contracts, payTokens } from '@/constants/contract';
import { currentTime } from '@/utils/date';
import { parseUnits } from '@ethersproject/units';
import { revalidatePathAction } from '../../actions';
import { useBountyEnvCheck } from '#/domain/bounty/hooks';

export function ApplyFinishedModal({open, close, bounty}) {
const _contracts = contracts[BOUNTY_SUPPORTED_CHAIN()];
Expand Down
6 changes: 4 additions & 2 deletions src/app/bounties/[id]/ApplyModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
* limitations under the License.
*/

import { Modal } from '@/components/Modal';
import { useState } from 'react';
import { BASE_INPUT_STYLE } from '@/constants/config';
import { toast } from 'react-toastify';

import { Button } from '@/components/Button';
import { Modal } from '@/components/Modal';
import { BASE_INPUT_STYLE } from '@/constants/config';

import { applyAction } from './actions';

export function ApplyModal({ open, closeModal, id }) {
Expand Down
6 changes: 4 additions & 2 deletions src/app/bounties/[id]/BountiesDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

'use client';

import { useConfig } from '#/state/application/hooks';
import { OViewer } from '@/components/MarkDown';
import { useMemo } from 'react';

import { OViewer } from '@/components/MarkDown';

import { useConfig } from '#/state/application/hooks';

export function BountiesDetail({ data }) {
const config = useConfig();

Expand Down
Loading

0 comments on commit 5a09537

Please sign in to comment.