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 - Cannot read properties of undefined (reading 'properties') #3733

Open
2 tasks done
dylang opened this issue Apr 9, 2024 · 1 comment
Open
2 tasks done
Labels

Comments

@dylang
Copy link

dylang commented Apr 9, 2024

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

@dylang dylang added the bug label Apr 9, 2024
@ljharb
Copy link
Member

ljharb commented Apr 9, 2024

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

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

No branches or pull requests

2 participants