Skip to content

Commit 3db77a5

Browse files
authored
chore: Fix broken eslint rule (#29727)
1 parent d85638f commit 3db77a5

File tree

11 files changed

+29
-20
lines changed

11 files changed

+29
-20
lines changed

.eslintrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ module.exports = {
116116
{
117117
extendDefaults: true,
118118
types: {
119-
"{}": false,
119+
"{}": {
120+
fixWith: "Record<string, unknown>",
121+
},
120122
object: {
121123
fixWith: "Record<string, unknown>",
122124
},

packages/create-gatsby/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ ${center(c.blueBright.bold.underline(`Welcome to Gatsby!`))}
307307

308308
trackCli(`CREATE_GATSBY_SET_PLUGINS_START`)
309309

310-
const enquirer = new Enquirer<Record<string, {}>>()
310+
const enquirer = new Enquirer<Record<string, Record<string, unknown>>>()
311311
enquirer.use(plugin)
312312

313313
pluginConfig = { ...pluginConfig, ...(await enquirer.prompt(config)) }

packages/gatsby-admin/src/components/plugin-search.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const SearchCombobox: React.FC<{
3737
))
3838

3939
// the search bar holds the Search component in the InstantSearch widget
40-
const PluginSearchInput: React.FC<{}> = () => (
40+
const PluginSearchInput: React.FC<Record<string, unknown>> = () => (
4141
<div>
4242
<InstantSearchProvider>
4343
<SearchCombobox

packages/gatsby-admin/src/components/providers.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const theme = merge(recipesTheme, {
133133
},
134134
})
135135

136-
const GraphQLProvider: React.FC<{}> = ({ children }) => {
136+
const GraphQLProvider: React.FC<Record<string, unknown>> = ({ children }) => {
137137
const services = useServices()
138138
const [client, setClient] = React.useState<Client | null>(() =>
139139
services
@@ -158,7 +158,7 @@ const GraphQLProvider: React.FC<{}> = ({ children }) => {
158158
return <Provider value={client}>{children}</Provider>
159159
}
160160

161-
const Providers: React.FC<{}> = ({ children }) => (
161+
const Providers: React.FC<Record<string, unknown>> = ({ children }) => (
162162
<StrictUIProvider theme={theme}>
163163
<ThemeProvider theme={theme}>
164164
{/* NOTE(@mxstbr): The GraphQLProvider needs to be in the ServicesProvider */}

packages/gatsby-admin/src/utils/use-npm-data.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function useNpmPackageData(
1919
): IUseNpmPackageDataResult {
2020
const [fetching, setFetching] = React.useState(true)
2121
const [error, setError] = React.useState<Error | null>(null)
22-
const [data, setData] = React.useState<{} | null>(null)
22+
const [data, setData] = React.useState<Record<string, unknown> | null>(null)
2323

2424
React.useEffect(() => {
2525
setFetching(true)

packages/gatsby-cli/src/reporter/reporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class Reporter {
109109
): IStructuredError | Array<IStructuredError> => {
110110
let details: {
111111
error?: Error
112-
context: {}
112+
context: Record<string, string>
113113
} = {
114114
context: {},
115115
}

packages/gatsby-plugin-image/src/components/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export interface IUrlBuilderArgs<OptionsType> {
126126
format: ImageFormat
127127
options: OptionsType
128128
}
129-
export interface IGetImageDataArgs<OptionsType = {}> {
129+
export interface IGetImageDataArgs<OptionsType = Record<string, unknown>> {
130130
baseUrl: string
131131
/**
132132
* For constrained and fixed images, the size of the image element

packages/gatsby-plugin-image/src/components/later-hydrator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react"
22
export function LaterHydrator({
33
children,
4-
}: React.PropsWithChildren<{}>): React.ReactNode {
4+
}: React.PropsWithChildren<Record<string, unknown>>): React.ReactNode {
55
React.useEffect(() => {
66
// eslint-disable-next-line no-unused-expressions
77
import(`./lazy-hydrate`)

packages/gatsby-plugin-image/src/components/placeholder.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { FunctionComponent, ImgHTMLAttributes } from "react"
22
import * as PropTypes from "prop-types"
33
import { Picture, SourceProps } from "./picture"
44

5-
export type PlaceholderProps = ImgHTMLAttributes<{}> & {
5+
export type PlaceholderProps = ImgHTMLAttributes<HTMLImageElement> & {
66
fallback?: string
77
sources?: Array<SourceProps>
88
}

packages/gatsby/src/redux/actions/restricted.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,12 @@ export const actions = {
264264
extension: GraphQLFieldExtensionDefinition,
265265
plugin: IGatsbyPlugin,
266266
traceId?: string
267-
): ThunkAction<void, IGatsbyState, {}, ICreateFieldExtension> => (
268-
dispatch,
269-
getState
270-
): void => {
267+
): ThunkAction<
268+
void,
269+
IGatsbyState,
270+
Record<string, unknown>,
271+
ICreateFieldExtension
272+
> => (dispatch, getState): void => {
271273
const { name } = extension || {}
272274
const { fieldExtensions } = getState().schemaCustomization
273275

@@ -389,9 +391,12 @@ export const actions = {
389391
context: IGatsbyPluginContext,
390392
plugin: IGatsbyPlugin,
391393
traceId?: string
392-
): ThunkAction<void, IGatsbyState, {}, ICreateResolverContext> => (
393-
dispatch
394-
): void => {
394+
): ThunkAction<
395+
void,
396+
IGatsbyState,
397+
Record<string, unknown>,
398+
ICreateResolverContext
399+
> => (dispatch): void => {
395400
if (!context || typeof context !== `object`) {
396401
report.error(
397402
`Expected context value passed to \`createResolverContext\` to be an object. Received "${context}".`

0 commit comments

Comments
 (0)