Skip to content

consistent-boolean-name: possibly-async boolean-returning functions #3622

Description

@emmercm

Functions that return boolean | Promise<boolean> are not allowed to use boolean prefixes on v73.0.0:

async function compute<IN, OUT>(
  input: IN,
  callable: (input: IN) => OUT | Promise<OUT>,
  // unicorn/consistent-boolean-name reports an error on the "should" prefix, and I believe that's incorrect
  shouldDoSomethingAfter: (input: IN) => boolean | Promise<boolean>,
): Promise<OUT> {
  const result = await callable(input);
  if (await shouldDoSomethingAfter(input)) {
    // ...
  }
  return result;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions