Skip to content

Commit fe11f6e

Browse files
authored
chore: prepare for consistent return eslint rule (#1107)
* chore: prepare for consistent return eslint rule * fix: export and type definition
1 parent 2ae21f0 commit fe11f6e

File tree

31 files changed

+83
-90
lines changed

31 files changed

+83
-90
lines changed

packages/jest-helpers/src/__tests__/index.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import makeHelpers from '..'
2-
import { RenderWithThemeFn } from '../helpers/renderWithTheme'
3-
import { ShouldMatchEmotionSnapshotFn } from '../helpers/shouldMatchEmotionSnapshot'
4-
import { ShouldMatchEmotionSnapshotWithPortalFn } from '../helpers/shouldMatchEmotionSnapshotWithPortal'
2+
import type { RenderWithThemeFn } from '../helpers/renderWithTheme'
3+
import type { ShouldMatchEmotionSnapshotFn } from '../helpers/shouldMatchEmotionSnapshot'
4+
import type { ShouldMatchEmotionSnapshotWithPortalFn } from '../helpers/shouldMatchEmotionSnapshotWithPortal'
55

66
describe('@jest-helpers', () => {
77
let renderWithTheme: RenderWithThemeFn<unknown>

packages/jest-helpers/src/helpers/renderWithTheme.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import createCache from '@emotion/cache'
22
import { CacheProvider } from '@emotion/react'
3-
import { RenderOptions, render } from '@testing-library/react'
4-
import { FC, ReactNode } from 'react'
3+
import type { RenderOptions } from '@testing-library/react'
4+
import { render } from '@testing-library/react'
5+
import type { FC, ReactNode } from 'react'
56

67
const emotionCache = createCache({
78
key: 'cache',

packages/jest-helpers/src/helpers/shouldMatchEmotionSnapshot.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { RenderOptions, render } from '@testing-library/react'
2-
import { ReactNode } from 'react'
3-
import { RenderWithThemeFn } from './renderWithTheme'
1+
import type { RenderOptions, render } from '@testing-library/react'
2+
import type { ReactNode } from 'react'
3+
import type { RenderWithThemeFn } from './renderWithTheme'
44

5-
interface Options<Theme> {
5+
type Options<Theme> = {
66
options?: RenderOptions
77
transform?: (node: ReturnType<typeof render>) => Promise<void> | void
88
theme?: Theme

packages/jest-helpers/src/helpers/shouldMatchEmotionSnapshotWithPortal.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { RenderOptions, render } from '@testing-library/react'
2-
import { ReactNode } from 'react'
3-
import { RenderWithThemeFn } from './renderWithTheme'
1+
import type { RenderOptions, render } from '@testing-library/react'
2+
import type { ReactNode } from 'react'
3+
import type { RenderWithThemeFn } from './renderWithTheme'
44

5-
interface Options<Theme> {
5+
type Options<Theme> = {
66
options?: RenderOptions
77
transform?: (node: ReturnType<typeof render>) => Promise<void> | void
88
theme?: Theme

packages/jest-helpers/src/index.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import { CreateSerializerOptions, createSerializer } from '@emotion/jest'
2-
import { FC, ReactNode } from 'react'
3-
import makeRenderWithTheme, {
4-
RenderWithThemeFn,
5-
} from './helpers/renderWithTheme'
6-
import makeShouldMatchEmotionSnapshot, {
7-
ShouldMatchEmotionSnapshotFn,
8-
} from './helpers/shouldMatchEmotionSnapshot'
9-
import makeShouldMatchEmotionSnapshotWithPortal, {
10-
ShouldMatchEmotionSnapshotWithPortalFn,
11-
} from './helpers/shouldMatchEmotionSnapshotWithPortal'
1+
import type { CreateSerializerOptions } from '@emotion/jest'
2+
import { createSerializer } from '@emotion/jest'
3+
import type { FC, ReactNode } from 'react'
4+
import type { RenderWithThemeFn } from './helpers/renderWithTheme'
5+
import makeRenderWithTheme from './helpers/renderWithTheme'
6+
import type { ShouldMatchEmotionSnapshotFn } from './helpers/shouldMatchEmotionSnapshot'
7+
import makeShouldMatchEmotionSnapshot from './helpers/shouldMatchEmotionSnapshot'
8+
import type { ShouldMatchEmotionSnapshotWithPortalFn } from './helpers/shouldMatchEmotionSnapshotWithPortal'
9+
import makeShouldMatchEmotionSnapshotWithPortal from './helpers/shouldMatchEmotionSnapshotWithPortal'
1210

1311
export { default as makeRenderWithTheme } from './helpers/renderWithTheme'
1412

packages/outdated-browser/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const STORAGE_KEY = '__outdated'
6262
const ignore = sessionStorage.getItem(STORAGE_KEY) || 'false'
6363

6464
declare global {
65+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
6566
interface Window {
6667
closeOutdated: () => void
6768
}

packages/use-dataloader/src/DataLoaderProvider.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
import PropTypes from 'prop-types'
2-
import {
3-
ReactElement,
4-
ReactNode,
5-
createContext,
6-
useCallback,
7-
useContext,
8-
useMemo,
9-
useRef,
10-
} from 'react'
2+
import type { ReactElement, ReactNode } from 'react'
3+
import { createContext, useCallback, useContext, useMemo, useRef } from 'react'
114
import {
125
DEFAULT_MAX_CONCURRENT_REQUESTS,
136
KEY_IS_NOT_STRING_ERROR,
147
} from './constants'
158
import DataLoader from './dataloader'
16-
import { OnErrorFn, PromiseType } from './types'
9+
import type { OnErrorFn, PromiseType } from './types'
1710

1811
type CachedData = Record<string, unknown>
1912
type Reloads = Record<string, () => Promise<void | unknown>>

packages/use-dataloader/src/__tests__/DataLoaderProvider.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { render, renderHook, screen, waitFor } from '@testing-library/react'
2-
import { ReactNode } from 'react'
2+
import type { ReactNode } from 'react'
33
import DataLoaderProvider, { useDataLoaderContext } from '../DataLoaderProvider'
44
import { KEY_IS_NOT_STRING_ERROR, StatusEnum } from '../constants'
55

packages/use-dataloader/src/__tests__/useDataLoader.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable no-console */
22
import { renderHook, waitFor } from '@testing-library/react'
3-
import { ReactNode } from 'react'
3+
import type { ReactNode } from 'react'
44
import DataLoaderProvider, { useDataLoaderContext } from '../DataLoaderProvider'
5-
import { KeyType, UseDataLoaderConfig } from '../types'
5+
import type { KeyType, UseDataLoaderConfig } from '../types'
66
import useDataLoader from '../useDataLoader'
77

88
type UseDataLoaderHookProps = {

packages/use-dataloader/src/__tests__/usePaginatedDataLoader.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* eslint-disable no-console */
22
import { act, renderHook, waitFor } from '@testing-library/react'
3-
import { ReactNode } from 'react'
3+
import type { ReactNode } from 'react'
44
import DataLoaderProvider from '../DataLoaderProvider'
5-
import { UsePaginatedDataLoaderMethodParams } from '../types'
5+
import type { UsePaginatedDataLoaderMethodParams } from '../types'
66
import usePaginatedDataLoader from '../usePaginatedDataLoader'
77

88
const PROMISE_TIMEOUT = 5

0 commit comments

Comments
 (0)