Skip to content

Commit

Permalink
👕 #252 @ianvs/prettier-plugin-sort-imports による並び替えを実行
Browse files Browse the repository at this point in the history
  • Loading branch information
keitakn committed Dec 30, 2023
1 parent 8d7a810 commit 84ce3df
Show file tree
Hide file tree
Showing 45 changed files with 107 additions and 140 deletions.
2 changes: 1 addition & 1 deletion .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Preview } from '@storybook/react';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
import type { Preview } from '@storybook/react';
import { initialize, mswDecorator } from 'msw-storybook-addon';

initialize();
Expand Down
20 changes: 10 additions & 10 deletions src/api/fetch/lgtmImage.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { httpStatusCode } from '@/constants';
import {
FetchLgtmImagesError,
IsAcceptableCatImageError,
UploadCatImageError,
UploadCatImageSizeTooLargeError,
UploadCatImageValidationError,
isLgtmImages,
createFailureResult,
createSuccessResult,
fetchLgtmImagesUrl,
FetchLgtmImagesError,
fetchLgtmImagesInRecentlyCreatedUrl,
fetchLgtmImagesUrl,
IsAcceptableCatImageError,
isAcceptableCatImageUrl,
uploadCatImageUrl,
isLgtmImages,
isUrl,
UploadCatImageError,
UploadCatImageSizeTooLargeError,
uploadCatImageUrl,
UploadCatImageValidationError,
type FetchLgtmImages,
type LgtmImage,
type IsAcceptableCatImage,
type IsAcceptableCatImageResponse,
type UploadCatImage,
type LgtmImage,
type LgtmImageUrl,
type UploadCatImage,
type Url,
} from '@/features';
import { mightSetRequestIdToSentry } from '@/utils';
Expand Down
3 changes: 1 addition & 2 deletions src/components/ErrorCatImages/InternalServerErrorImage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { FC } from 'react';
import Image from 'next/image';

import type { FC } from 'react';
import internalServerError from './images/internal_server_error.webp';

export const InternalServerErrorImage: FC = () => (
Expand Down
3 changes: 1 addition & 2 deletions src/components/ErrorCatImages/NotFoundImage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { FC } from 'react';
import Image from 'next/image';

import type { FC } from 'react';
import notFound from './images/not_found.webp';

export const NotFoundImage: FC = () => (
Expand Down
3 changes: 1 addition & 2 deletions src/components/ErrorCatImages/ServiceUnavailableImage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { FC } from 'react';
import Image from 'next/image';

import type { FC } from 'react';
import serviceUnavailable from './images/service_unavailable.webp';

export const ServiceUnavailableImage: FC = () => (
Expand Down
5 changes: 2 additions & 3 deletions src/components/GoogleTagManager/GoogleTagManager.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { FC } from 'react';
import Script from 'next/script';

import { type GoogleTagManagerId } from '@/utils';
import Script from 'next/script';
import type { FC } from 'react';

type Props = {
googleTagManagerId: GoogleTagManagerId;
Expand Down
1 change: 1 addition & 0 deletions src/features/language.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Language as OrgLanguage } from '@nekochans/lgtm-cat-ui';

export type Language = OrgLanguage;

export const languages = ['en', 'ja'] as const;
7 changes: 3 additions & 4 deletions src/features/lgtmImage.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import type {
AcceptedTypesImageExtension as OrgAcceptedTypesImageExtension,
LgtmImage as OrgLgtmImage,
LgtmImageUrl as OrgLgtmImageUrl,
CatImagesFetcher as OrgCatImagesFetcher,
ImageUploader as OrgImageUploader,
ImageValidator as OrgImageValidator,
CatImagesFetcher as OrgCatImagesFetcher,
LgtmImage as OrgLgtmImage,
LgtmImageUrl as OrgLgtmImageUrl,
} from '@nekochans/lgtm-cat-ui';
import {
type UploadCatImageError,
type UploadCatImageSizeTooLargeError,
type UploadCatImageValidationError,
} from './errors';
import { imageData } from './imageData';

import type { Result } from './result';

export type LgtmImage = OrgLgtmImage;
Expand Down
1 change: 0 additions & 1 deletion src/features/metaTag.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { assertNever } from '@/utils';

import type { Language } from './language';
import { appUrlList, type AppPathName, type AppUrl } from './url';

Expand Down
4 changes: 2 additions & 2 deletions src/hooks/__tests__/useCatImageUploader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* @jest-environment jsdom
*/
import 'whatwg-fetch';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import {
UploadCatImageError,
uploadCatImageUrl,
Expand All @@ -17,6 +15,8 @@ import {
mockUploadCatImagePayloadTooLarge,
mockUploadCatImageUnprocessableEntity,
} from '@/mocks';
import { rest } from 'msw';
import { setupServer } from 'msw/node';

const mockHandlers = [rest.post(uploadCatImageUrl(), mockUploadCatImage)];

Expand Down
6 changes: 3 additions & 3 deletions src/hooks/__tests__/useCatImageValidator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
* @jest-environment jsdom
*/
import 'whatwg-fetch';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import {
IsAcceptableCatImageError,
isSuccessResult,
isAcceptableCatImageUrl,
isSuccessResult,
type AcceptedTypesImageExtension,
type Language,
} from '@/features';
Expand All @@ -22,6 +20,8 @@ import {
mockIsAcceptableCatImagePayloadTooLargeError,
mockIsAcceptableCatImagePersonFaceInImage,
} from '@/mocks';
import { rest } from 'msw';
import { setupServer } from 'msw/node';

const mockHandlers = [
rest.post(isAcceptableCatImageUrl(), mockIsAcceptableCatImage),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* @jest-environment jsdom
*/
import 'whatwg-fetch';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import { fetchLgtmImagesUrl, FetchLgtmImagesError } from '@/features';
import { FetchLgtmImagesError, fetchLgtmImagesUrl } from '@/features';
import { useCatImagesFetcher } from '@/hooks/useCatImagesFetcher';
import {
mockInternalServerError,
mockFetchLgtmImages,
fetchLgtmImagesMockBody,
mockFetchLgtmImages,
mockInternalServerError,
} from '@/mocks';
import { rest } from 'msw';
import { setupServer } from 'msw/node';

const mockHandlers = [rest.get(fetchLgtmImagesUrl(), mockFetchLgtmImages)];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
* @jest-environment jsdom
*/
import 'whatwg-fetch';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import {
fetchLgtmImagesInRecentlyCreatedUrl,
FetchLgtmImagesError,
fetchLgtmImagesInRecentlyCreatedUrl,
} from '@/features';
import { useCatImagesFetcher } from '@/hooks/useCatImagesFetcher';
import {
mockInternalServerError,
mockFetchLgtmImages,
fetchLgtmImagesMockBody,
mockFetchLgtmImages,
mockInternalServerError,
} from '@/mocks';
import { rest } from 'msw';
import { setupServer } from 'msw/node';

const mockHandlers = [
rest.get(fetchLgtmImagesInRecentlyCreatedUrl(), mockFetchLgtmImages),
Expand Down
7 changes: 3 additions & 4 deletions src/hooks/useCatImageUploader.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { uploadCatImage } from '@/api';
import {
UploadCatImageSizeTooLargeError,
UploadCatImageValidationError,
createSuccessResult,
isFailureResult,
type Language,
UploadCatImageSizeTooLargeError,
UploadCatImageValidationError,
type AcceptedTypesImageExtension,
type ImageUploader,
type Language,
} from '@/features';

import {
createCatImageSizeTooLargeErrorMessages,
createUnexpectedErrorMessages,
Expand Down
5 changes: 2 additions & 3 deletions src/hooks/useCatImageValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { isAcceptableCatImage } from '@/api';
import {
createSuccessResult,
isFailureResult,
type Language,
type AcceptedTypesImageExtension,
type IsAcceptableCatImageNotAcceptableReason,
type ImageValidator,
type IsAcceptableCatImageNotAcceptableReason,
type Language,
} from '@/features';
import { assertNever } from '@/utils';

import {
createCatImageSizeTooLargeErrorMessages,
createUnexpectedErrorMessages,
Expand Down
4 changes: 1 addition & 3 deletions src/hooks/useCatImagesFetcher.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import throttle from 'lodash/throttle';

import {
fetchLgtmImagesInRandom,
fetchLgtmImagesInRecentlyCreated,
} from '@/api';

import type { CatImagesFetcher, LgtmImage } from '@/features';
import throttle from 'lodash/throttle';

const randomCatImagesFetcher = async (): Promise<LgtmImage[]> => {
return await fetchLgtmImagesInRandom();
Expand Down
5 changes: 2 additions & 3 deletions src/layouts/DefaultLayout/DefaultLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { FC, ReactNode } from 'react';
import Head from 'next/head';

import type { Language, MetaTag, Url } from '@/features';
import Head from 'next/head';
import type { FC, ReactNode } from 'react';

type Props = {
metaTag: MetaTag;
Expand Down
5 changes: 2 additions & 3 deletions src/layouts/ErrorLayout/ErrorLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { FC, ReactNode } from 'react';
import Head from 'next/head';

import type { MetaTag } from '@/features';
import Head from 'next/head';
import type { FC, ReactNode } from 'react';

type Props = {
title: string;
Expand Down
5 changes: 2 additions & 3 deletions src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { isBanCountry, isInMaintenance } from '@/edge';
import {
NextResponse,
type NextMiddleware,
type NextRequest,
NextResponse,
} from 'next/server';

import { isBanCountry, isInMaintenance } from '@/edge';

export const config = {
matcher: ['/', '/upload', '/terms', '/privacy', '/maintenance'],
};
Expand Down
5 changes: 2 additions & 3 deletions src/mocks/api/error/mockInternalServerError.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { httpStatusCode } from '@/constants';
import {
type ResponseResolver,
type MockedRequest,
type ResponseResolver,
type restContext,
} from 'msw';

import { httpStatusCode } from '@/constants';

export const mockInternalServerError: ResponseResolver<
MockedRequest,
typeof restContext
Expand Down
5 changes: 2 additions & 3 deletions src/mocks/api/error/mockUnauthorizedError.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { httpStatusCode } from '@/constants';
import {
type ResponseResolver,
type MockedRequest,
type ResponseResolver,
type restContext,
} from 'msw';

import { httpStatusCode } from '@/constants';

export const mockUnauthorizedError: ResponseResolver<
MockedRequest,
typeof restContext
Expand Down
7 changes: 3 additions & 4 deletions src/mocks/api/external/lgtmeow/mockFetchLgtmImages.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { httpStatusCode } from '@/constants';
import { fetchLgtmImagesMockBody } from '@/mocks';
import {
type ResponseResolver,
type MockedRequest,
type ResponseResolver,
type restContext,
} from 'msw';

import { httpStatusCode } from '@/constants';
import { fetchLgtmImagesMockBody } from '@/mocks';

export const mockFetchLgtmImages: ResponseResolver<
MockedRequest,
typeof restContext
Expand Down
5 changes: 2 additions & 3 deletions src/mocks/api/external/lgtmeow/mockUploadCatImage.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { httpStatusCode } from '@/constants';
import {
type ResponseResolver,
type MockedRequest,
type ResponseResolver,
type restContext,
} from 'msw';

import { httpStatusCode } from '@/constants';

export const mockUploadCatImage: ResponseResolver<
MockedRequest,
typeof restContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { httpStatusCode } from '@/constants';
import {
type ResponseResolver,
type MockedRequest,
type ResponseResolver,
type restContext,
} from 'msw';

import { httpStatusCode } from '@/constants';

export const mockUploadCatImagePayloadTooLarge: ResponseResolver<
MockedRequest,
typeof restContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { httpStatusCode } from '@/constants';
import {
type ResponseResolver,
type MockedRequest,
type ResponseResolver,
type restContext,
} from 'msw';

import { httpStatusCode } from '@/constants';

export const mockUploadCatImageUnprocessableEntity: ResponseResolver<
MockedRequest,
typeof restContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { httpStatusCode } from '@/constants';
import {
type ResponseResolver,
type MockedRequest,
type ResponseResolver,
type restContext,
} from 'msw';

import { httpStatusCode } from '@/constants';

export const mockIsAcceptableCatImage: ResponseResolver<
MockedRequest,
typeof restContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { httpStatusCode } from '@/constants';
import {
type ResponseResolver,
type MockedRequest,
type ResponseResolver,
type restContext,
} from 'msw';

import { httpStatusCode } from '@/constants';

export const mockIsAcceptableCatImageError: ResponseResolver<
MockedRequest,
typeof restContext
Expand Down
Loading

0 comments on commit 84ce3df

Please sign in to comment.