Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mattupham/fe 513 eslint disallow default exports #3297

Merged
merged 40 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
42e7fd9
add import/no-default-export
mattupham Jun 4, 2024
5fff601
Add overrides for next.js pages
mattupham Jun 4, 2024
6016516
wallet-tutorial
mattupham Jun 4, 2024
a0d46a0
QRCodeView
mattupham Jun 4, 2024
65d1011
useGetEarnStrategies
mattupham Jun 4, 2024
3bbedc2
useDraggableScroll
mattupham Jun 4, 2024
aea8a31
Markdown
mattupham Jun 4, 2024
80ff239
Modal
mattupham Jun 4, 2024
9643b23
ErrorFallback
mattupham Jun 4, 2024
efc7f17
Clipboard button
mattupham Jun 4, 2024
21da05f
AxelarTransfer
mattupham Jun 4, 2024
44fc37b
ClientOnly
mattupham Jun 4, 2024
6c03095
NavbarOsmoPrice
mattupham Jun 4, 2024
b99318f
use-steps
mattupham Jun 4, 2024
d42dd5f
NavbarOsmosisUpdates
mattupham Jun 4, 2024
cbeaea7
OneClickTradingSettings
mattupham Jun 4, 2024
fa28020
OneClickTradingIntroModal
mattupham Jun 4, 2024
e930325
QRCode
mattupham Jun 4, 2024
daaf4ba
AvatarIcon
mattupham Jun 4, 2024
007326f
OneClickTradingWelcomeBack
mattupham Jun 4, 2024
f581507
HistoricalPriceChart
mattupham Jun 4, 2024
e2aa8c6
PoolComposition
mattupham Jun 4, 2024
ab82eaf
IconButton
mattupham Jun 4, 2024
558b088
ConcentratedLiquidityDepthChart
mattupham Jun 4, 2024
d03cab6
LinkButton
mattupham Jun 4, 2024
90e72d4
OneClickTradingConnectToContinue
mattupham Jun 4, 2024
c336171
HistoricalPriceChartV2
mattupham Jun 4, 2024
58f689e
TokenDetails
mattupham Jun 4, 2024
bbf23d9
FiltersModal
mattupham Jun 4, 2024
38d5c05
ErrorBoundary
mattupham Jun 4, 2024
e7fb849
SkeletonLoader
mattupham Jun 4, 2024
9e6974a
get
mattupham Jun 4, 2024
002cb5c
SEO
mattupham Jun 4, 2024
444ca32
dayjs
mattupham Jun 4, 2024
a50fbc5
Cleanup 1
mattupham Jun 4, 2024
796391b
Merge branch 'stage' into mattupham/fe-513-eslint-disallow-default-ex…
mattupham Jun 6, 2024
d1f4f29
Fix QR code import
mattupham Jun 6, 2024
5b0758a
Clean up component name to match file
mattupham Jun 6, 2024
a4929da
Remove t value
mattupham Jun 6, 2024
b700ad2
Update remove value
mattupham Jun 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dayjs from "../../../../utils/dayjs";
import { dayjs } from "../../../../utils/dayjs";
import { AssetLists } from "../../../__tests__/mock-asset-lists";
import { isAssetInCategories } from "../categories";

Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/queries/complex/assets/categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import cachified, { CacheEntry } from "cachified";
import { LRUCache } from "lru-cache";

import { DEFAULT_LRU_OPTIONS } from "../../../utils";
import dayjs from "../../../utils/dayjs";
import { dayjs } from "../../../utils/dayjs";
import { queryUpcomingAssets } from "../../github";

/** Filters an asset for whether it is included in the given list of categories. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import cachified, { CacheEntry } from "cachified";
import { LRUCache } from "lru-cache";

import { DEFAULT_LRU_OPTIONS } from "../../../../utils/cache";
import dayjs from "../../../../utils/dayjs";
import { dayjs } from "../../../../utils/dayjs";
import { queryMarketChart } from "../../../coingecko";
import {
queryTokenHistoricalChart,
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/queries/complex/earn/strategies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from "../../../queries/data-services/earn";
import { queryOsmosisCMS } from "../../../queries/github";
import { DEFAULT_LRU_OPTIONS } from "../../../utils/cache";
import dayjs from "../../../utils/dayjs";
import { dayjs } from "../../../utils/dayjs";
import { captureIfError } from "../../../utils/error";
import { type Asset, getAsset } from "../assets";
import { DEFAULT_VS_CURRENCY } from "../assets/config";
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/queries/complex/osmosis/lockup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Chain } from "@osmosis-labs/types";
import { Duration } from "dayjs/plugin/duration";

import dayjs from "../../../utils/dayjs";
import { dayjs } from "../../../utils/dayjs";
import { queryAccountLockedLongerDuration } from "../../osmosis/lockup";

export type UserLock = {
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/queries/complex/pools/bonding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CoinPretty, PricePretty, RatePretty } from "@keplr-wallet/unit";
import { AssetList, Chain } from "@osmosis-labs/types";
import type { Duration } from "dayjs/plugin/duration";

import dayjs from "../../../utils/dayjs";
import { dayjs } from "../../../utils/dayjs";
import { captureErrorAndReturn } from "../../../utils/error";
import { querySyntheticLockupsByLockId } from "../../osmosis/lockup";
import {
Expand Down
3 changes: 1 addition & 2 deletions packages/server/src/utils/dayjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ import duration from "dayjs/plugin/duration";

dayjs.extend(duration);

// eslint-disable-next-line import/no-default-export
export default dayjs;
export { dayjs };
15 changes: 13 additions & 2 deletions packages/web/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"unused-imports/no-unused-imports": "error",
"react/no-unescaped-entities": "off"
}
"react/no-unescaped-entities": "off",
"import/no-default-export": "error"
// see https://stackoverflow.com/questions/44378395/how-to-configure-eslint-so-that-it-disallows-default-exports
},
"overrides": [
// Pages router, config files
{
"files": ["pages/**/*", "playwright.config.ts"],
"rules": {
"import/no-default-export": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion packages/web/components/assets/highlights-categories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Link from "next/link";
import { FunctionComponent, ReactNode } from "react";

import { PriceChange } from "~/components/assets/price";
import SkeletonLoader from "~/components/loaders/skeleton-loader";
import { SkeletonLoader } from "~/components/loaders/skeleton-loader";
import { EventName } from "~/config";
import {
Breakpoint,
Expand Down
6 changes: 2 additions & 4 deletions packages/web/components/buttons/clipboard-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { useState } from "react";
import { Icon } from "~/components/assets";
import { SpriteIconId } from "~/config";

import IconButton from "./icon-button";
import { IconButton } from "./icon-button";

/**
* Renders an icon within a button.
*/
const ClipboardButton = forwardRef<
export const ClipboardButton = forwardRef<
HTMLButtonElement,
{
value?: string;
Expand Down Expand Up @@ -78,5 +78,3 @@ const ClipboardButton = forwardRef<
</IconButton>
);
});

export default ClipboardButton;
4 changes: 1 addition & 3 deletions packages/web/components/buttons/icon-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Button } from "~/components/buttons/button";
/**
* Renders an icon within a button.
*/
const IconButton = forwardRef<
export const IconButton = forwardRef<
HTMLButtonElement,
{
icon?: ReactNode;
Expand Down Expand Up @@ -41,5 +41,3 @@ const IconButton = forwardRef<
</Button>
);
});

export default IconButton;
2 changes: 1 addition & 1 deletion packages/web/components/buttons/link-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ReactElement } from "react";

import { Button } from "~/components/ui/button";

export default function LinkButton({
export function LinkButton({
label,
icon,
ariaLabel,
Expand Down
10 changes: 8 additions & 2 deletions packages/web/components/cards/my-position/expanded.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,17 @@ import { formatPretty, getPriceExtendedFormatOptions } from "~/utils/formatter";
import { RouterOutputs } from "~/utils/trpc";

const ConcentratedLiquidityDepthChart = dynamic(
() => import("~/components/chart/concentrated-liquidity-depth"),
() =>
import("~/components/chart/concentrated-liquidity-depth").then(
(module) => module.ConcentratedLiquidityDepthChart
),
{ ssr: false }
);
const HistoricalPriceChart = dynamic(
() => import("~/components/chart/price-historical"),
() =>
import("~/components/chart/price-historical").then(
(module) => module.HistoricalPriceChart
),
{ ssr: false }
);

Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/cards/my-position/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { FunctionComponent, ReactNode, useState } from "react";
import { Icon, PoolAssetsIcon, PoolAssetsName } from "~/components/assets";
import { MyPositionCardExpandedSection } from "~/components/cards/my-position/expanded";
import { MyPositionStatus } from "~/components/cards/my-position/status";
import SkeletonLoader from "~/components/loaders/skeleton-loader";
import { SkeletonLoader } from "~/components/loaders/skeleton-loader";
import { EventName } from "~/config";
import { useFeatureFlags, useTranslation } from "~/hooks";
import { useAmplitudeAnalytics } from "~/hooks";
Expand Down
2 changes: 0 additions & 2 deletions packages/web/components/cards/validator-squad-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,3 @@ const AvatarIcon: React.FC<{ extraValidators?: number }> = ({
</div>
);
};

export default AvatarIcon;
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type DepthData = {
depth: number;
};

const ConcentratedLiquidityDepthChart: FunctionComponent<{
export const ConcentratedLiquidityDepthChart: FunctionComponent<{
min?: number;
max?: number;
yRange: [number, number];
Expand Down Expand Up @@ -252,6 +252,3 @@ const DragContainer: FunctionComponent<{
/>
</Annotation>
);

// needed for next/dynamic to avoid including visx in main bundle
export default ConcentratedLiquidityDepthChart;
4 changes: 1 addition & 3 deletions packages/web/components/chart/pool-composition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CoinPretty } from "@keplr-wallet/unit";
import Image from "next/image";
import { FunctionComponent } from "react";

const PoolComposition: FunctionComponent<{
export const PoolComposition: FunctionComponent<{
assets: CoinPretty[];
}> = ({ assets }) => {
return (
Expand All @@ -28,5 +28,3 @@ const PoolComposition: FunctionComponent<{
</ul>
);
};

export default PoolComposition;
4 changes: 1 addition & 3 deletions packages/web/components/chart/price-historical-v2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const seriesOpt: DeepPartial<AreaSeriesOptions> = {
crosshairMarkerRadius: 8,
};

const HistoricalPriceChartV2: FunctionComponent<{
export const HistoricalPriceChartV2: FunctionComponent<{
data: { close: number; time: number }[];
onPointerHover?: (price: number) => void;
onPointerOut?: () => void;
Expand Down Expand Up @@ -50,5 +50,3 @@ const HistoricalPriceChartV2: FunctionComponent<{
/>
);
});

export default HistoricalPriceChartV2;
6 changes: 2 additions & 4 deletions packages/web/components/chart/price-historical.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { observer } from "mobx-react-lite";
import React, { FunctionComponent, memo, useCallback, useMemo } from "react";

import { Icon } from "~/components/assets";
import SkeletonLoader from "~/components/loaders/skeleton-loader";
import { SkeletonLoader } from "~/components/loaders/skeleton-loader";
import { ChartButton } from "~/components/ui/button";
import { type PriceRange, useTranslation } from "~/hooks";
import { theme } from "~/tailwind.config";
Expand All @@ -33,7 +33,7 @@ import {
} from "~/utils/formatter";
import { getDecimalCount } from "~/utils/number";

const HistoricalPriceChart: FunctionComponent<{
export const HistoricalPriceChart: FunctionComponent<{
data: { close: number; time: number }[];
margin?: Partial<Margin>;
annotations: Dec[];
Expand Down Expand Up @@ -246,8 +246,6 @@ const HistoricalPriceChart: FunctionComponent<{
)
);

export default HistoricalPriceChart;

export const PriceChartHeader: FunctionComponent<{
historicalRange: PriceRange;
setHistoricalRange: (pr: PriceRange) => void;
Expand Down
6 changes: 3 additions & 3 deletions packages/web/components/client-only.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { PropsWithChildren, useEffect, useState } from "react";

const ClientOnly = (props: PropsWithChildren<{ className?: string }>) => {
export const ClientOnly = (
props: PropsWithChildren<{ className?: string }>
) => {
const [hasMounted, setHasMounted] = useState(false);

useEffect(() => {
Expand All @@ -13,5 +15,3 @@ const ClientOnly = (props: PropsWithChildren<{ className?: string }>) => {

return <div {...props} />;
};

export default ClientOnly;
12 changes: 9 additions & 3 deletions packages/web/components/complex/add-conc-liquidity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import React, {
} from "react";

import { Icon, PoolAssetsIcon, PoolAssetsName } from "~/components/assets";
import IconButton from "~/components/buttons/icon-button";
import { IconButton } from "~/components/buttons/icon-button";
import {
ChartUnavailable,
PriceChartHeader,
Expand Down Expand Up @@ -45,11 +45,17 @@ import { formatPretty, getPriceExtendedFormatOptions } from "~/utils/formatter";
import { Tooltip } from "../tooltip";

const ConcentratedLiquidityDepthChart = dynamic(
() => import("~/components/chart/concentrated-liquidity-depth"),
() =>
import("~/components/chart/concentrated-liquidity-depth").then(
(module) => module.ConcentratedLiquidityDepthChart
),
{ ssr: false }
);
const HistoricalPriceChart = dynamic(
() => import("~/components/chart/price-historical"),
() =>
import("~/components/chart/price-historical").then(
(module) => module.HistoricalPriceChart
),
{ ssr: false }
);

Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/complex/my-pools-card-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { observer } from "mobx-react-lite";
import { useCallback, useMemo, useRef, useState } from "react";

import { PoolCard } from "~/components/cards";
import SkeletonLoader from "~/components/loaders/skeleton-loader";
import { SkeletonLoader } from "~/components/loaders/skeleton-loader";
import { ShowMoreButton } from "~/components/ui/button";
import { EventName } from "~/config";
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/complex/my-positions-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { observer } from "mobx-react-lite";
import React, { FunctionComponent, useState } from "react";

import { MyPositionCard } from "~/components/cards";
import SkeletonLoader from "~/components/loaders/skeleton-loader";
import { SkeletonLoader } from "~/components/loaders/skeleton-loader";
import { ShowMoreButton } from "~/components/ui/button";
import { useWalletSelect } from "~/hooks";
import { useStore } from "~/stores";
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/complex/portfolio-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { api } from "~/utils/trpc";

import { CreditCardIcon } from "../assets/credit-card-icon";
import { Spinner } from "../loaders";
import SkeletonLoader from "../loaders/skeleton-loader";
import { SkeletonLoader } from "../loaders/skeleton-loader";
import { RecentTransfers } from "../transactions/recent-transfers";
import { CustomClasses } from "../types";
import { Button } from "../ui/button";
Expand Down
4 changes: 2 additions & 2 deletions packages/web/components/complex/transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import { useClickAway } from "react-use";

import { Icon } from "~/components/assets";
import { GradientView } from "~/components/assets/gradient-view";
import IconButton from "~/components/buttons/icon-button";
import { IconButton } from "~/components/buttons/icon-button";
import { SwitchWalletButton } from "~/components/buttons/switch-wallet";
import { BridgeFromToNetwork } from "~/components/complex/bridge-from-to-network";
import { MenuDropdown, MenuToggle } from "~/components/control";
import { InputBox } from "~/components/input";
import SkeletonLoader from "~/components/loaders/skeleton-loader";
import { SkeletonLoader } from "~/components/loaders/skeleton-loader";
import { Tooltip } from "~/components/tooltip";
import { Disableable, InputProps } from "~/components/types";
import { Button } from "~/components/ui/button";
Expand Down
4 changes: 2 additions & 2 deletions packages/web/components/drawers/token-select-drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { useLatest } from "react-use";

import { Icon } from "~/components/assets";
import IconButton from "~/components/buttons/icon-button";
import { IconButton } from "~/components/buttons/icon-button";
import { SearchBox } from "~/components/input";
import { Tooltip } from "~/components/tooltip";
import { useTranslation } from "~/hooks";
Expand All @@ -23,7 +23,7 @@ import { UnverifiedAssetsState } from "~/stores/user-settings";
import { formatPretty } from "~/utils/formatter";

import { useConst } from "../../hooks/use-const";
import useDraggableScroll from "../../hooks/use-draggable-scroll";
import { useDraggableScroll } from "../../hooks/use-draggable-scroll";
import { useKeyActions } from "../../hooks/use-key-actions";
import { useStateRef } from "../../hooks/use-state-ref";
import { useWindowKeyActions } from "../../hooks/window/use-window-key-actions";
Expand Down
4 changes: 1 addition & 3 deletions packages/web/components/earn/filters/filters-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface StrategiesFilter extends ListOption<string> {
icon: ReactNode;
}

const FiltersModal = (
export const FiltersModal = (
props: ModalBaseProps & {
rewardTypes: ListOption<string>[];
lockDurationTypes: ListOption<string>[];
Expand Down Expand Up @@ -130,5 +130,3 @@ const FiltersModal = (
</ModalBase>
);
};

export default FiltersModal;
2 changes: 1 addition & 1 deletion packages/web/components/earn/filters/top-filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Icon } from "~/components/assets";
import { DropdownWithLabel } from "~/components/dropdown-with-label";
import { DropdownWithMultiSelect } from "~/components/dropdown-with-multi-select";
import { FilterContext } from "~/components/earn/filters/filter-context";
import FiltersModal from "~/components/earn/filters/filters-modal";
import { FiltersModal } from "~/components/earn/filters/filters-modal";
import { ListOption } from "~/components/earn/table/types/filters";
import { getListOptions } from "~/components/earn/table/utils";
import { SearchBox } from "~/components/input";
Expand Down
Loading
Loading