Skip to content

False positives on "Declare only one React component per file" (react/no-multi-comp) #1088

Description

@MoOx
import test from "jest-ava-api"
import React, { createElement } from "react"
import { createRenderer } from "react-addons-test-utils"

const renderer = (...args) => { // I guess this is detected as a component
  const render = createRenderer()
  render.render(...args)
  return render.getRenderOutput()
}

test("what", () => {
  return {
    isActive: () => false, // what?
  }
})

react/no-multi-comp is detecting 2 components here since I get a warning on the last () => false.
Both are wrong.

Ps: the code does not make sense as it is as I removed some part to make the debugging more easy.

Not that if I does not import createElement, the error seems to disappear (but I need this...)

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions