Skip to content

[Bug]: react/boolean-prop-naming validateNested config doesn't work with typescript interfaces #3856

Open
@Phebonacci

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

The validateNested configuration option doesn't work for typescript interface props.

Sample code:

import React from 'react';

type ButtonProps = {
    children: React.ReactNode;
    foo: { bar: boolean };
    baz: boolean;
}

const Button = ({ children }: ButtonProps): JSX.Element => {
    return <button type="button">{children}</button>;
};

export default Button;

Link to sample repo: https://github.com/Phebonacci/sample-nextra

The react/boolean-prop-naming rule doesn't trigger for nested boolean props. I verified my setup by running eslint against a sample file with a top level boolean prop and a nested boolean prop. As can be seen on the screenshot below, the rule triggers for the top level boolean prop, however, it doesn't trigger for the nested boolean prop even with validateNested config set to true:
Image

To reproduce the issue, run:

yarn eslint src/components/Button.tsx

Expected Behavior

The react/boolean-prop-naming rule should also trigger for the nested boolean props.

eslint-plugin-react version

v7.37.2

eslint version

v8.57.1

node version

v18.19.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