Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore top-level awaits in prefer-await-to-then #126

Merged
merged 1 commit into from May 24, 2018

Conversation

macklinu
Copy link
Contributor

Resolves #122

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • New rule
  • Changes an existing rule
  • Add autofixing to a rule
  • Other, please explain:

What changes did you make? (Give an overview)

This commit updates the prefer-await-to-then rule to only lint await statements that exist within the scope of a function declaration. Top-level await statements are invalid. I've updated the tests to reflect what I believe the expected valid and invalid behaviors should be, but another couple sets of eyes on this would be great.

/cc @MrSwitch @xjamundx

@macklinu macklinu merged commit 4a3d5b8 into master May 24, 2018
@macklinu macklinu deleted the fix/prefer-await-only-inside-functions branch May 24, 2018 16:04
jimthedev pushed a commit to commitizen/cz-cli that referenced this pull request May 25, 2018
This Pull Request updates dependency [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise) from `v3.7.0` to `v3.8.0`



<details>
<summary>Release Notes</summary>

### [`v3.8.0`](https://github.com/xjamundx/eslint-plugin-promise/blob/master/CHANGELOG.md#&#8203;380)
[Compare Source](eslint-community/eslint-plugin-promise@v3.7.0...v3.8.0)
* Removed `promise/avoid-new` from recommended configuration
  ([#&#8203;119](`eslint-community/eslint-plugin-promise#119))
* Ignored event listener callbacks in `promise/prefer-await-to-callbacks`
  ([#&#8203;117](`eslint-community/eslint-plugin-promise#117))
* Ignored top-level awaits in `promise/prefer-await-to-then`
  ([#&#8203;126](`eslint-community/eslint-plugin-promise#126))
* Added docs for `promise/no-nesting` and `promise/prefer-await-to-then`
  ([#&#8203;120](`eslint-community/eslint-plugin-promise#120))
  ([#&#8203;121](`eslint-community/eslint-plugin-promise#121))

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should scope of prefer-await-to-then rule be limited to functions?
1 participant