Skip to content

3.13.0 jsx-keys Errors #373

Closed
Closed
@craigklem

Description

@craigklem

Using latest version 3.13.0, I see several issues when exceptions in jsx-keys when running eslint with our code. Errors 2 & 3 happen after adding if checks to avoid the exceptions. Could not identify code that made 3 happen - no WebStorm call stack :(

  1. TypeError: Cannot read property 'name' of undefined
    line 49 - if (node.callee.property.name !== 'map') {
  2. TypeError: Cannot read property 'type' of undefined
    line 54 - var isFn = fn.type === 'FunctionExpression';
  3. TypeError: Cannot read property 'argument' of undefined
    line 64 - getReturnStatement(fn.body.body).argument

Code that caused issues:

class MyComponent extends React.Component {
constructor(props) {
    super(props);//number 1 happens here
}
var IconRenderer= function() {
  this.fontsLoaded = false;
  this.checkFonts = function(loadedCallback) {
    this.fontsLoaded = lib.fontsLoaded();

    if (this.fontsLoaded) {
      if (loadedCallback) {
        loadedCallback();//number 2 happens here
      }
}

WebStorm watches below:
image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions