Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
Phebonacci opened this issue Nov 26, 2024 · 1 comment

Comments

@Phebonacci
Copy link

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

@Phebonacci Phebonacci added the bug label Nov 26, 2024
@ljharb
Copy link
Member

ljharb commented Nov 29, 2024

type and interface are different things - i assume it fails to work with either?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants