Skip to content

Commit

Permalink
docs: misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nopeless committed Jun 27, 2023
1 parent 274d3f2 commit a5fa6f5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions docs/src/rules/no-promise-executor-return.md
Expand Up @@ -60,6 +60,10 @@ new Promise((resolve, reject) => getSomething((err, data) => {
}
}));

new Promise(() => {
return 1;
});

new Promise(r => r(1));
```

Expand Down Expand Up @@ -95,15 +99,19 @@ new Promise((resolve, reject) => {
} else {
resolve(data);
}
}
}));
});
});

new Promise(r => { r(1) });
// or just use Promise.resolve
Promise.resolve(1);
```

The option `allowVoid` will additionally allow returning `void` from the executor function.
## Options

This rule takes one option, an object, with the following properties:

* `allowVoid`: If set to `true` (`false` by default), this rule will allow returning void values.

```js
/*eslint no-promise-executor-return: ["error", { allowVoid: true }]*/
Expand Down

0 comments on commit a5fa6f5

Please sign in to comment.