Skip to content

[Bug]: react/boolean-prop-naming - Cannot read properties of undefined (reading 'properties') #3733

Description

@dylang

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

Exception during linting

TypeError: Cannot read properties of undefined (reading 'properties')
Occurred while linting /example..tsx:5
Rule: "react/boolean-prop-naming"
    at ./node_modules/eslint-plugin-react/lib/rules/boolean-prop-naming.js:396:24
    at Array.forEach (<anonymous>)
    at ./node_modules/eslint-plugin-react/lib/rules/boolean-prop-naming.js:393:35

Rule

        'react/boolean-prop-naming': [
            1,
            { rule: '(^(is|has|should|without)[A-Z]([A-Za-z0-9]?)+|disabled|required|checked|defaultChecked)' }
        ],

Code

import type React from 'react';

export const DataRow = (props: { label: string; value: string; } & React.HTMLAttributes<HTMLDivElement>) => {
    const { label, value, ...otherProps } = props;
    return (
        <div {...otherProps}>
            <span>{label}</span>
            <span>{value}</span>
        </div>
    );
};

Note: I found #3717 but it seems to be a different problem.

Expected Behavior

No exception thrown.

eslint-plugin-react version

v7.34.1

eslint version

v8.57.0

node version

v20.11.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions