Skip to content

Commit 73969fe

Browse files
committed
Resolve remaining lint errors
1 parent f06295a commit 73969fe

File tree

86 files changed

+268
-240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+268
-240
lines changed

docs/virtual/petstore-api.generated/petstore-api.generated.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export const api = createApi({
123123
}),
124124
}),
125125
})
126+
type AnyNonNullishValue = NonNullable<unknown>
126127
export type UpdatePetApiResponse = /** status 200 Successful operation */ Pet
127128
export type UpdatePetApiArg = {
128129
/** Update an existent pet in the store */
@@ -174,10 +175,9 @@ export type UploadFileApiArg = {
174175
additionalMetadata?: string
175176
body: string
176177
}
177-
export type GetInventoryApiResponse = /** status 200 successful operation */ {
178-
[key: string]: number
179-
}
180-
export type GetInventoryApiArg = {}
178+
export type GetInventoryApiResponse =
179+
/** status 200 successful operation */ Record<string, number>
180+
export type GetInventoryApiArg = AnyNonNullishValue
181181
export type PlaceOrderApiResponse = /** status 200 successful operation */ Order
182182
export type PlaceOrderApiArg = {
183183
order: Order
@@ -211,7 +211,7 @@ export type LoginUserApiArg = {
211211
password?: string
212212
}
213213
export type LogoutUserApiResponse = unknown
214-
export type LogoutUserApiArg = {}
214+
export type LogoutUserApiArg = AnyNonNullishValue
215215
export type GetUserByNameApiResponse =
216216
/** status 200 successful operation */ User
217217
export type GetUserByNameApiArg = {

examples/action-listener/counter/src/components/App/App.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
import type { Unsubscribe } from '@reduxjs/toolkit'
12
import React, { useEffect } from 'react'
23
import { Provider } from 'react-redux'
3-
import type { Unsubscribe } from '@reduxjs/toolkit'
4-
import { setupThemeListeners } from '../../services/theme/listeners'
54
import { setupCounterListeners } from '../../services/counter/listeners'
5+
import { setupThemeListeners } from '../../services/theme/listeners'
6+
import { startAppListening, store } from '../../store'
67
import { ChangeThemeForm } from '../ChangeThemeForm/ChangeThemeForm'
78
import { CounterList } from '../CounterList/CounterList'
89
import { CreateCounterForm } from '../CreateCounterForm/CreateCounterForm'
9-
import { store, startAppListening } from '../../store'
1010

1111
export function App() {
1212
useEffect(() => {

examples/action-listener/counter/src/components/ChangeThemeForm/ChangeThemeForm.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { FormEvent, ChangeEvent } from 'react'
1+
import type { ChangeEvent, FormEvent } from 'react'
2+
import type { ThemeState } from '../../services/theme/slice'
3+
import { themeActions } from '../../services/theme/slice'
24
import { useAppDispatch, useAppSelector } from '../../store'
3-
import { themeActions, ThemeState } from '../../services/theme/slice'
45
import styles from './changeThemeForm.module.css'
56

67
function isChecked(theme: ThemeState): boolean {

examples/action-listener/counter/src/components/Counter/Counter.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { EntityId } from '@reduxjs/toolkit'
1+
import type { EntityId } from '@reduxjs/toolkit'
2+
import clsx from 'clsx'
23
import { memo } from 'react'
34
import { counterActions, counterSelectors } from '../../services/counter/slice'
45
import { useAppDispatch, useAppSelector } from '../../store'
56
import styles from './counter.module.css'
6-
import clsx from 'clsx'
77

88
export interface CounterProps {
99
counterId: EntityId

examples/action-listener/counter/src/components/CreateCounterForm/CreateCounterForm.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { FormEvent, useState } from 'react'
2-
import styles from './createCounter.module.css'
31
import clsx from 'clsx'
4-
import { useAppDispatch } from '../../store'
2+
import type { FormEvent } from 'react'
3+
import { useState } from 'react'
54
import { counterActions } from '../../services/counter/slice'
5+
import { useAppDispatch } from '../../store'
6+
import styles from './createCounter.module.css'
67

78
const sectionClassname = clsx('paper', styles.section)
89

examples/action-listener/counter/src/services/counter/listeners.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { counterActions, counterSelectors } from './slice'
2-
import {
3-
UnknownAction,
4-
isAllOf,
5-
isAnyOf,
1+
import type {
62
PayloadAction,
3+
UnknownAction,
74
Unsubscribe,
85
} from '@reduxjs/toolkit'
6+
import { isAllOf, isAnyOf } from '@reduxjs/toolkit'
97
import type { AppListenerEffectAPI, AppStartListening } from '../../store'
8+
import { counterActions, counterSelectors } from './slice'
109

1110
function shouldStopAsyncTasksOf(id: string) {
1211
return isAllOf(

examples/action-listener/counter/src/services/counter/slice.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import {
2-
createSlice,
3-
createEntityAdapter,
4-
nanoid,
5-
PayloadAction,
6-
} from '@reduxjs/toolkit'
1+
import type { PayloadAction } from '@reduxjs/toolkit'
2+
import { createEntityAdapter, createSlice, nanoid } from '@reduxjs/toolkit'
73

84
export interface Counter {
95
value: number
@@ -70,7 +66,9 @@ export const counterSlice = createSlice({
7066
updateByAsync(
7167
_,
7268
action: PayloadAction<{ id: string; delta: number; delayMs: number }>,
73-
) {},
69+
) {
70+
/* No-Op */
71+
},
7472
cancelAsyncUpdates(state, { payload }: PayloadAction<string>) {
7573
delete state.counters.entities[payload]?.intervalMs
7674
},

examples/action-listener/counter/src/services/counter/tests/listener.test.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { configureStore, createListenerMiddleware } from '@reduxjs/toolkit'
2-
import { setupCounterListeners } from '../listeners'
3-
import { counterSlice, counterActions, counterSelectors } from '../slice'
42
import type { AppStartListening } from '../../../store'
3+
import { setupCounterListeners } from '../listeners'
4+
import { counterActions, counterSelectors, counterSlice } from '../slice'
55

66
function delay(timerMs: number): Promise<number> {
77
return new Promise((resolve) => {
@@ -12,7 +12,9 @@ function delay(timerMs: number): Promise<number> {
1212
jest.useRealTimers()
1313

1414
describe('counter - listeners', () => {
15-
const onMiddlewareError = jest.fn((): void => {}) // https://jestjs.io/docs/mock-function-api
15+
const onMiddlewareError = jest.fn((): void => {
16+
/* No-Op */
17+
}) // https://jestjs.io/docs/mock-function-api
1618

1719
/**
1820
* @see https://redux-toolkit.js.org/api/createListenerMiddleware

examples/action-listener/counter/src/services/theme/listeners.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { themeActions } from './slice'
1+
import type { Unsubscribe } from '@reduxjs/toolkit'
22
import type { AppStartListening } from '../../store'
3-
import { Unsubscribe } from '@reduxjs/toolkit'
3+
import { themeActions } from './slice'
44

55
function onChangeColorScheme(
66
action: ReturnType<typeof themeActions.changeColorScheme>,

examples/action-listener/counter/src/store.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'
1+
import type {
2+
ListenerEffectAPI,
3+
TypedAddListener,
4+
TypedStartListening,
5+
} from '@reduxjs/toolkit'
26
import {
7+
addListener,
38
configureStore,
49
createListenerMiddleware,
5-
TypedStartListening,
6-
TypedAddListener,
7-
ListenerEffectAPI,
8-
addListener,
910
} from '@reduxjs/toolkit'
11+
import type { TypedUseSelectorHook } from 'react-redux'
12+
import { useDispatch, useSelector } from 'react-redux'
1013
import { counterSlice } from './services/counter/slice'
1114
import { themeSlice } from './services/theme/slice'
1215

examples/query/react/authentication-with-extrareducers/src/App.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { Routes, Route } from 'react-router-dom'
21
import { Box, Center, VStack } from '@chakra-ui/react'
3-
2+
import { Route, Routes } from 'react-router-dom'
43
import { Login } from './features/auth/Login'
5-
import { PrivateOutlet } from './utils/PrivateOutlet'
64
import { ProtectedComponent } from './features/auth/ProtectedComponent'
5+
import { PrivateOutlet } from './utils/PrivateOutlet'
76

87
function Hooray() {
98
return (

examples/query/react/authentication-with-extrareducers/src/app/services/auth.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
2-
import { RootState } from '../store'
2+
import type { RootState } from '../store'
33

44
export interface User {
55
first_name: string

examples/query/react/authentication-with-extrareducers/src/features/auth/Login.tsx

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
import * as React from 'react'
21
import {
2+
Box,
3+
Button,
4+
Center,
5+
Divider,
36
Input,
47
InputGroup,
58
InputRightElement,
69
VStack,
7-
Button,
8-
Divider,
9-
Center,
10-
Box,
1110
useToast,
1211
} from '@chakra-ui/react'
13-
import { useNavigate } from 'react-router-dom'
12+
import * as React from 'react'
1413
import { useDispatch } from 'react-redux'
15-
16-
import { ProtectedComponent } from './ProtectedComponent'
17-
import { useLoginMutation } from '../../app/services/auth'
14+
import { useNavigate } from 'react-router-dom'
1815
import type { LoginRequest } from '../../app/services/auth'
16+
import { useLoginMutation } from '../../app/services/auth'
17+
import { ProtectedComponent } from './ProtectedComponent'
1918

2019
function PasswordInput({
2120
name,

examples/query/react/authentication-with-extrareducers/src/features/auth/ProtectedComponent.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Center, VStack, Box, Button } from '@chakra-ui/react'
1+
import { Box, Button, Center, VStack } from '@chakra-ui/react'
22
import { useProtectedMutation } from '../../app/services/auth'
33

44
export function ProtectedComponent() {

examples/query/react/authentication-with-extrareducers/src/features/auth/authSlice.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createSlice } from '@reduxjs/toolkit'
2-
import { api, User } from '../../app/services/auth'
2+
import type { User } from '../../app/services/auth'
3+
import { api } from '../../app/services/auth'
34
import type { RootState } from '../../app/store'
45

56
type AuthState = {

examples/query/react/authentication-with-extrareducers/src/hooks/store.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'
1+
import type { TypedUseSelectorHook } from 'react-redux'
2+
import { useDispatch, useSelector } from 'react-redux'
23
import type { AppDispatch, RootState } from '../app/store'
34

45
export const useTypedSelector: TypedUseSelectorHook<RootState> = useSelector

examples/query/react/authentication/src/App.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { Routes, Route } from 'react-router-dom'
21
import { Box, Center, VStack } from '@chakra-ui/react'
3-
2+
import { Route, Routes } from 'react-router-dom'
43
import { Login } from './features/auth/Login'
5-
import { PrivateOutlet } from './utils/PrivateOutlet'
64
import { ProtectedComponent } from './features/auth/ProtectedComponent'
5+
import { PrivateOutlet } from './utils/PrivateOutlet'
76

87
function Hooray() {
98
return (

examples/query/react/authentication/src/app/services/auth.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
2-
import { RootState } from '../store'
2+
import type { RootState } from '../store'
33

44
export interface User {
55
first_name: string

examples/query/react/authentication/src/features/auth/Login.tsx

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
import * as React from 'react'
21
import {
2+
Box,
3+
Button,
4+
Center,
5+
Divider,
36
Input,
47
InputGroup,
58
InputRightElement,
69
VStack,
7-
Button,
8-
Divider,
9-
Center,
10-
Box,
1110
useToast,
1211
} from '@chakra-ui/react'
13-
import { useNavigate } from 'react-router-dom'
12+
import * as React from 'react'
1413
import { useDispatch } from 'react-redux'
14+
import { useNavigate } from 'react-router-dom'
15+
import type { LoginRequest } from '../../app/services/auth'
16+
import { useLoginMutation } from '../../app/services/auth'
1517
import { setCredentials } from './authSlice'
16-
1718
import { ProtectedComponent } from './ProtectedComponent'
18-
import { useLoginMutation } from '../../app/services/auth'
19-
import type { LoginRequest } from '../../app/services/auth'
2019

2120
function PasswordInput({
2221
name,

examples/query/react/authentication/src/features/auth/ProtectedComponent.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Center, VStack, Box, Button } from '@chakra-ui/react'
1+
import { Box, Button, Center, VStack } from '@chakra-ui/react'
22
import { useProtectedMutation } from '../../app/services/auth'
33

44
export function ProtectedComponent() {

examples/query/react/authentication/src/hooks/store.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'
1+
import type { TypedUseSelectorHook } from 'react-redux'
2+
import { useDispatch, useSelector } from 'react-redux'
23
import type { AppDispatch, RootState } from '../app/store'
34

45
export const useTypedSelector: TypedUseSelectorHook<RootState> = useSelector

examples/query/react/basic/src/test/test-utils.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { render } from '@testing-library/react'
1+
import type { PreloadedState } from '@reduxjs/toolkit'
22
import type { RenderOptions } from '@testing-library/react'
3+
import { render } from '@testing-library/react'
34
import type React from 'react'
4-
import type { PropsWithChildren, JSX } from 'react'
5+
import type { JSX, PropsWithChildren } from 'react'
56
import { Provider } from 'react-redux'
6-
import { setupStore } from '../store'
77
import type { AppStore, RootState } from '../store'
8-
import type { PreloadedState } from '@reduxjs/toolkit'
8+
import { setupStore } from '../store'
99

1010
// This type interface extends the default options for render from RTL, as well
1111
// as allows the user to specify other things such as initialState, store. For
@@ -24,7 +24,7 @@ function renderWithProviders(
2424
...renderOptions
2525
}: ExtendedRenderOptions = {},
2626
) {
27-
function Wrapper({ children }: PropsWithChildren<{}>): JSX.Element {
27+
function Wrapper({ children }: PropsWithChildren): JSX.Element {
2828
return <Provider store={store}>{children}</Provider>
2929
}
3030
return { store, ...render(ui, { wrapper: Wrapper, ...renderOptions }) }

examples/query/react/conditional-fetching/src/App.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react'
22
import { Pokemon } from './Pokemon'
3-
import { PokemonName, POKEMON_NAMES } from './pokemon.data'
3+
import type { PokemonName } from './pokemon.data'
4+
import { POKEMON_NAMES } from './pokemon.data'
45
import './styles.css'
56

67
const getRandomPokemonName = () =>

examples/query/react/graphql-codegen/src/app/services/types.generated.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export type Maybe<T> = T
2-
export type Exact<T extends { [key: string]: unknown }> = {
2+
export type Exact<T extends Record<string, unknown>> = {
33
[K in keyof T]: T[K]
44
}
55
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
@@ -30,9 +30,9 @@ export type Mutation = {
3030
__typename?: 'Mutation'
3131
createPost?: Maybe<Post>
3232
updatePost?: Maybe<Post>
33-
updatePosts?: Maybe<Array<Maybe<Post>>>
33+
updatePosts?: Maybe<Maybe<Post>[]>
3434
deletePost?: Maybe<Post>
35-
deletePosts?: Maybe<Array<Maybe<Post>>>
35+
deletePosts?: Maybe<Maybe<Post>[]>
3636
}
3737

3838
export type MutationCreatePostArgs = {
@@ -94,7 +94,7 @@ export type PostQueryInput = {
9494
export type Query = {
9595
__typename?: 'Query'
9696
post?: Maybe<Post>
97-
posts?: Maybe<Array<Maybe<Post>>>
97+
posts?: Maybe<Maybe<Post>[]>
9898
}
9999

100100
export type QueryPostArgs = {

examples/query/react/graphql-codegen/src/features/posts/PostsManager.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import * as React from 'react'
21
import {
32
Badge,
43
Box,
54
Button,
65
Divider,
76
Flex,
8-
Heading,
97
HStack,
8+
Heading,
109
Icon,
1110
List,
1211
ListIcon,
@@ -16,6 +15,7 @@ import {
1615
StatLabel,
1716
StatNumber,
1817
} from '@chakra-ui/react'
18+
import * as React from 'react'
1919
import { MdArrowBack, MdArrowForward, MdBook } from 'react-icons/md'
2020
import { useGetPostsQuery } from './GetPosts.generated'
2121

0 commit comments

Comments
 (0)