Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yakovenkodenis/eslint-plugin-parentheses-around-await
The ESLint plugin to ensure you don't try to use properties on a not-yet-awaited values.
https://github.com/yakovenkodenis/eslint-plugin-parentheses-around-await
eslint eslint-plugin eslint-rules
Last synced: 3 days ago
JSON representation
The ESLint plugin to ensure you don't try to use properties on a not-yet-awaited values.
- Host: GitHub
- URL: https://github.com/yakovenkodenis/eslint-plugin-parentheses-around-await
- Owner: yakovenkodenis
- License: mit
- Created: 2021-01-23T13:32:27.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-18T13:30:48.000Z (almost 4 years ago)
- Last Synced: 2025-01-27T05:01:59.003Z (10 days ago)
- Topics: eslint, eslint-plugin, eslint-rules
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/eslint-plugin-parentheses-around-await
- Size: 141 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [WIP] Parentheses around await
This plugin helps you to avoid a common mistake when using `async/await`: trying to access properties on an awaited value without wrapping it with parenthesis.
### Example:
```javascript
const method = async () => ({
id: 25
});const wrongId = await createModel().id; // wrongId === undefined
const correctId = (await createModel()).id; // correctId === 25
```### Install
```bash
npm install eslint-plugin-parentheses-around-await
# or
yarn add eslint-plugin-parentheses-around-await
```### Usage
`.eslintrc.js`:
```javascript
module.exports = {
"plugins": [
"eslint-plugin-parentheses-around-await"
],
"rules": {
"parentheses-around-await": 1 // 2 - error, 1 - warn, 0 - off.
}
};```