Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Relax promise-function-async for short parenthesized arrow functions #4757

Closed
ghost opened this issue Jun 7, 2019 · 3 comments · Fixed by #4765
Closed

Relax promise-function-async for short parenthesized arrow functions #4757

ghost opened this issue Jun 7, 2019 · 3 comments · Fixed by #4765

Comments

@ghost
Copy link

ghost commented Jun 7, 2019

Feature request

Is your feature request related to a problem? Please describe.
Related #2637

Describe the solution you'd like
Same as #2637

Additional context
My reasoning is that if TSLint permit this:

async function foo() {
  return 1;
}

const bar = () => foo();

then too should to permit:

async function foo() {
  return 1;
}

const bar = () => (
  foo()
);

with tslint.json configuration:

{
  "rules": {
    "promise-function-async": true
  }
}
@JoshuaKGoldberg
Copy link
Contributor

Heya @localnet, I'm confused. #2637 was resolved by #4553. This feature should be available.

Is there a separate thing you're looking for? Specifically, what's the difference between this issue and #2637?

@ghost
Copy link
Author

ghost commented Jun 15, 2019

Excuse me if I have not explained myself well @JoshuaKGoldberg

Yes, #4553 solved the issue #2637 and permit this:

async function foo() {
  return 1;
}

const bar = () => foo();

But it don't permit this:

async function foo() {
  return 1;
}

const bar = () => (
  foo()
);

And to me seems it the same, practically (I use it, sometimes, to don't exceed the max line length).

@JoshuaKGoldberg
Copy link
Contributor

Got it - totally reasonable. Thanks for the clarification! 😊

@JoshuaKGoldberg JoshuaKGoldberg changed the title Relax promise-function-async for short arrow functions Relax promise-function-async for short parenthesized arrow functions Jun 15, 2019
JoshuaKGoldberg pushed a commit that referenced this issue Jul 27, 2019
…ons (#4765)

* Allowed parenthesis bodies for one-line promise-function-async functions

Fixes #4757.

* Used tsutils intead of ts for new parenthesized expression method

Gets me every time...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant