Skip to content

void-dom-elements-no-children checking every .createElement and crashing #1073

Closed
@daltones

Description

I've just updated to v6.10.0 and enabled void-dom-elements-no-children.

It's crashing with this error:

TypeError: Cannot read property 'properties' of undefined
    at EventEmitter.CallExpression ([...]/eslint-plugin-react/lib/rules/void-dom-elements-no-children.js:121:28)
[...]

It happens with this simple code:

document.createElement('img');

So here is the first problem:

  • The rule thinks that every .createElement( is the React.createElement.

Now testing with the actual React:

import React from 'react';

React.createElement('img');

The rule will crash too.

Second problem:

  • The rule doesn't treat incomplete number of createElement's arguments (as while typing React.createElement()).

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