Skip to content

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

Closed
@dylang

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

Activity

ljharb

ljharb commented on Apr 9, 2024

@ljharb
Member

#3717 seems to be the same problem but perhaps with a different cause; this simplified code might help solve both :-) Thanks!

added a commit that references this issue on May 31, 2024
a79beb3

204 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ljharb@dylang

        Issue actions

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