eslint-plugin

@masknet/no-then

Disallow Promise#then(...)

Rule Details

:x: Incorrect

promise.then(
  () => 1,
  () => 2,
)

:white_check_mark: Correct

try {
  await promise
  return 1
} catch {
  return 2
}

When Not To Use It

When you need to handle the promise directly, or it’s easier to read with “then”.

Attributes