Skip to content

Commit

Permalink
Add eslint-plugin-promise and enable no-multiple-resolved (#287)
Browse files Browse the repository at this point in the history
* Add eslint-plugin-promise to base package

The plugin is added to the eslint configuration, with the no-multiple-resolved rule enabled. This avoids situations where both `resolve()` and `reject()` can be called, due to a missing `return` statement.

* Update `rules-snapshot.json` to include the new rule

* Update all READMEs to include the new plugin
  • Loading branch information
Mrtenz authored May 4, 2023
1 parent fe28fb3 commit a973564
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ yarn add --dev \
eslint-plugin-import@^2.26.0 \
eslint-plugin-jsdoc@^39.6.2 \
eslint-plugin-prettier@^4.2.1 \
eslint-plugin-promise@^6.1.1 \
prettier@^2.7.1
```

Expand Down
2 changes: 2 additions & 0 deletions packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.6.2",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"prettier": "^2.7.1"
},
"peerDependencies": {
Expand All @@ -36,6 +37,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.6.2",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"prettier": "^2.7.1"
},
"engines": {
Expand Down
1 change: 1 addition & 0 deletions packages/base/rules-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -3320,6 +3320,7 @@
"usePrettierrc": true
}
],
"promise/no-multiple-resolved": "error",
"quote-props": "off",
"quotes": "off",
"radix": "error",
Expand Down
4 changes: 3 additions & 1 deletion packages/base/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
sourceType: 'script',
},

plugins: ['jsdoc', 'prettier'],
plugins: ['jsdoc', 'prettier', 'promise'],

extends: [
'eslint:recommended',
Expand Down Expand Up @@ -394,5 +394,7 @@ module.exports = {
'jsdoc/require-yields-check': 'error',
'jsdoc/tag-lines': 'error',
'jsdoc/valid-types': 'error',

'promise/no-multiple-resolved': 'error',
},
};
1 change: 1 addition & 0 deletions packages/browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ yarn add --dev \
eslint-plugin-import@^2.26.0 \
eslint-plugin-jsdoc@^39.6.2 \
eslint-plugin-prettier@^4.2.1 \
eslint-plugin-promise@^6.1.1 \
prettier@^2.7.1
```

Expand Down
1 change: 1 addition & 0 deletions packages/commonjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ yarn add --dev \
eslint-plugin-import@^2.26.0 \
eslint-plugin-jsdoc@^39.6.2 \
eslint-plugin-prettier@^4.2.1 \
eslint-plugin-promise@^6.1.1 \
prettier@^2.7.1
```

Expand Down
1 change: 1 addition & 0 deletions packages/jest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ yarn add --dev \
eslint-plugin-jsdoc@^39.6.2 \
eslint-plugin-jest@^27.1.5 \
eslint-plugin-prettier@^4.2.1 \
eslint-plugin-promise@^6.1.1 \
prettier@^2.7.1
```

Expand Down
1 change: 1 addition & 0 deletions packages/mocha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ yarn add --dev \
eslint-plugin-jsdoc@^39.6.2 \
eslint-plugin-mocha@^10.1.0 \
eslint-plugin-prettier@^4.2.1 \
eslint-plugin-promise@^6.1.1 \
prettier@^2.7.1
```

Expand Down
1 change: 1 addition & 0 deletions packages/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ yarn add --dev \
eslint-plugin-jsdoc@^39.6.2 \
eslint-plugin-node@^11.1.0 \
eslint-plugin-prettier@^4.2.1 \
eslint-plugin-promise@^6.1.1 \
prettier@^2.7.1
```

Expand Down
1 change: 1 addition & 0 deletions packages/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ yarn add --dev \
eslint-plugin-import@^2.26.0 \
eslint-plugin-jsdoc@^39.6.2 \
eslint-plugin-prettier@^4.2.1 \
eslint-plugin-promise@^6.1.1 \
prettier@^2.7.1
```

Expand Down
11 changes: 11 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1033,13 +1033,15 @@ __metadata:
eslint-plugin-import: ^2.26.0
eslint-plugin-jsdoc: ^39.6.2
eslint-plugin-prettier: ^4.2.1
eslint-plugin-promise: ^6.1.1
prettier: ^2.7.1
peerDependencies:
eslint: ^8.27.0
eslint-config-prettier: ^8.5.0
eslint-plugin-import: ^2.26.0
eslint-plugin-jsdoc: ^39.6.2
eslint-plugin-prettier: ^4.2.1
eslint-plugin-promise: ^6.1.1
prettier: ^2.7.1
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -2717,6 +2719,15 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-promise@npm:^6.1.1":
version: 6.1.1
resolution: "eslint-plugin-promise@npm:6.1.1"
peerDependencies:
eslint: ^7.0.0 || ^8.0.0
checksum: 46b9a4f79dae5539987922afc27cc17cbccdecf4f0ba19c0ccbf911b0e31853e9f39d9959eefb9637461b52772afa1a482f1f87ff16c1ba38bdb6fcf21897e9a
languageName: node
linkType: hard

"eslint-scope@npm:^5.1.1":
version: 5.1.1
resolution: "eslint-scope@npm:5.1.1"
Expand Down

0 comments on commit a973564

Please sign in to comment.