Skip to content

Commit

Permalink
Update eslint-plugin-promise to v7.2.1
Browse files Browse the repository at this point in the history
- Enable `promise/prefer-catch` as a warning.
  • Loading branch information
amikheychik committed Dec 1, 2024
1 parent cd65336 commit 15bbf18
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 20 deletions.
13 changes: 8 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"eslint-plugin-jsdoc": "^50.6.0",
"eslint-plugin-n": "^17.14.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-promise": "^7.1.0",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-rxjs": "^5.0.3",
"eslint-plugin-security": "^3.0.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
Expand Down Expand Up @@ -98,7 +98,7 @@
"eslint-plugin-jsdoc": "50.6.0",
"eslint-plugin-n": "17.14.0",
"eslint-plugin-prefer-arrow": "1.2.3",
"eslint-plugin-promise": "7.1.0",
"eslint-plugin-promise": "7.2.1",
"eslint-plugin-rxjs": "5.0.3",
"eslint-plugin-security": "3.0.1",
"eslint-plugin-simple-import-sort": "12.1.1",
Expand Down
25 changes: 15 additions & 10 deletions src/rules/promise/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,11 @@ to enforce best practices for JavaScript promises.
| Error


| `link:{eslint-promise-rules}/spec-only.md[promise/spec-only]`
|
|
| Error

| `link:{eslint-promise-rules}/valid-params.md[promise/valid-params]`
| `link:{eslint-promise-rules}/prefer-await-to-callbacks.md[promise/prefer-await-to-callbacks]`
|
|
| Error
| Off
4+| Requires ES2017 `async`/`await`.

| `link:{eslint-promise-rules}/prefer-await-to-then.md[promise/prefer-await-to-then]`
|
Expand All @@ -88,10 +84,19 @@ to enforce best practices for JavaScript promises.
and would be turned off either way,
as Promises should be preferred.

| `link:{eslint-promise-rules}/prefer-await-to-callbacks.md[promise/prefer-await-to-callbacks]`
| `link:{eslint-promise-rules}/prefer-catch.md[promise/prefer-catch]`
|
|
| Off
4+| Requires ES2017 `async`/`await`.
| Warning

| `link:{eslint-promise-rules}/spec-only.md[promise/spec-only]`
|
|
| Error

| `link:{eslint-promise-rules}/valid-params.md[promise/valid-params]`
|
|
| Error

|===
17 changes: 14 additions & 3 deletions src/rules/promise/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,29 @@ export const promiseConfig = {
promise: eslintPluginPromise,
},
rules: {
'promise/catch-or-return': 'error',
'promise/catch-or-return': ['error', {
allowThen: false,
allowThenStrict: false,
allowFinally: true,
}],
'promise/no-return-wrap': 'error',
'promise/param-names': 'warn',
'promise/always-return': 'error',
'promise/always-return': ['error', {
ignoreAssignmentVariable: [
'globalThis',
],
}],
'promise/no-multiple-resolved': 'error',
'promise/no-native': 'off',
'promise/no-nesting': 'error',
'promise/no-promise-in-callback': 'error',
'promise/no-callback-in-promise': 'error',
'promise/no-callback-in-promise': ['error', {
timeoutsErr: false,
}],
'promise/avoid-new': 'off',
'promise/no-new-statics': 'warn',
'promise/no-return-in-finally': 'error',
'promise/prefer-catch': 'warn',
'promise/spec-only': ['error', {
allowedMethods: [],
}],
Expand Down

0 comments on commit 15bbf18

Please sign in to comment.