Skip to content

Commit 574349f

Browse files
homersimpsonsxjamundx
authored andcommittedDec 1, 2021
param-names: Update docs
1 parent 3a2f364 commit 574349f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed
 

‎CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 5.2.0
2+
3+
- Updated `param-names` rule to allow for unused params
4+
15
## 5.1.1
26

37
- Updated docs to include `no-callback-in-promise` reasons #215
@@ -6,7 +10,8 @@
610

711
- Included `catch()` and `finally()` in `prefer-await-to-then` #196
812
- Added some additional tests and upgraded some dev deps #196
9-
- Exempted array methods in prefer-await-to-callbacks ([#212](https://github.com/xjamundx/eslint-plugin-promise/issues/212))
13+
- Exempted array methods in prefer-await-to-callbacks
14+
([#212](https://github.com/xjamundx/eslint-plugin-promise/issues/212))
1015

1116
## 5.0.0
1217

‎docs/rules/param-names.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ Enforce standard parameter names for Promise constructors
77
```js
88
new Promise(function (resolve) { ... })
99
new Promise(function (resolve, reject) { ... })
10+
new Promise(function (_resolve, _reject) { ... }) // Unused marker for parameters are allowed
1011
```
1112

1213
#### Invalid
1314

1415
```js
1516
new Promise(function (reject, resolve) { ... }) // incorrect order
1617
new Promise(function (ok, fail) { ... }) // non-standard parameter names
18+
new Promise(function (_, reject) { ... }) // a simple underscore is not allowed
1719
```
1820

1921
Ensures that `new Promise()` is instantiated with the parameter names

‎rules/param-names.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ module.exports = {
2121

2222
if (
2323
(params[0].name !== 'resolve' && params[0].name !== '_resolve') ||
24-
(params[1] && params[1].name !== 'reject' && params[1].name !== '_reject')
24+
(params[1] &&
25+
params[1].name !== 'reject' &&
26+
params[1].name !== '_reject')
2527
) {
2628
context.report({
2729
node,

0 commit comments

Comments
 (0)
Please sign in to comment.