Skip to content

Lint RenderResult when returned from function #141

@HaveSpacesuit

Description

@HaveSpacesuit

When returning a RenderResult from a function, some destructured methods are caught by the linter, but others aren't.

it('displays a loader', () => {
  const { getByText, debug } = render(<MyLoader />);
  getByText('Loading'); // Caught by linter
  debug(); // Caught by linter
});

it('displays a loader', () => {
  function renderLoader(): RenderResult {
    return render(<MyLoader />);
  }

  const { getByText, debug } = renderLoader();
  getByText('Loading'); // Caught by linter
  debug(); // Linter doesn't care
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions