Skip to content

[enhancement]: flat configs are possibly undefined #3878

@CHC383

Description

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

This is a follow up of #3874, since flat is Record<string, ReactFlatConfig>, flat.xxx or flat["xxx"] could be undefined. The fix might be explicitly list recommended, all and jsx-runtime as the key of the Record instead of using string.

Image
import tseslint from 'typescript-eslint'
import reactPlugin from 'eslint-plugin-react'

export default tseslint.config(
  reactPlugin.configs.flat.recommended
)
Argument of type 'ReactFlatConfig | undefined' is not assignable to parameter of type 'InfiniteDepthConfigWithExtends'.

Expected Behavior

No type error

eslint-plugin-react version

v7.37.4

eslint version

9.17.0

node version

v22.13.0

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions