Skip to content

Commit

Permalink
Configured eslint-plugin-promise 🪆 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
01taylop authored Jul 17, 2024
1 parent 25334ea commit 589a2a6
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions .depcheckrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ignores: [
"eslint-plugin-eslint-comments",
"eslint-plugin-inclusive-language",
"eslint-plugin-promise",
"eslint-plugin-sort-destructure-keys",
"eslint-plugin-sort-exports",
"@types/jest",
Expand Down
3 changes: 3 additions & 0 deletions config/eslint/build-config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import ESLintComments from './rules/eslint-comments'
import InclusiveLanguage from './rules/inclusive-language'
import PromiseRules from './rules/promise'
import SortDestructureKeys from './rules/sort-destructure-keys'
import SortExports from './rules/sort-exports'

const buildConfig = () => ({
plugins: [
'eslint-comments',
'inclusive-language',
'promise',
'sort-destructure-keys',
'sort-exports',
],
rules: {
...ESLintComments,
...InclusiveLanguage,
...PromiseRules,
...SortDestructureKeys,
...SortExports,
},
Expand Down
22 changes: 22 additions & 0 deletions config/eslint/rules/promise.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// https://github.com/eslint-community/eslint-plugin-promise

export default {
'promise/always-return': 2,
'promise/avoid-new': 0,
'promise/catch-or-return': 2,
'promise/no-callback-in-promise': 2,
'promise/no-multiple-resolved': 2,
'promise/no-native': 0,
'promise/no-nesting': 2,
'promise/no-new-statics': 2,
'promise/no-promise-in-callback': 2,
'promise/no-return-in-finally': 2,
'promise/no-return-wrap': 2,
'promise/param-names': [2, {
rejectPattern: '^_?reject',
resolvePattern: '^_?resolve',
}],
'promise/prefer-await-to-callbacks': 0,
'promise/prefer-await-to-then': 0,
'promise/valid-params': 2,
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"eslint": "9.4.0",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-inclusive-language": "2.2.1",
"eslint-plugin-promise": "6.4.0",
"eslint-plugin-sort-destructure-keys": "2.0.0",
"eslint-plugin-sort-exports": "0.9.1",
"glob": "10.4.1",
Expand Down Expand Up @@ -61,6 +62,7 @@
"eslint",
"eslint-plugin-eslint-comments",
"eslint-plugin-inclusive-language",
"eslint-plugin-promise",
"eslint-plugin-sort-destructure-keys",
"eslint-plugin-sort-exports",
"lint",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2409,6 +2409,11 @@ [email protected]:
dependencies:
humps "^2.0.1"

[email protected]:
version "6.4.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-6.4.0.tgz#54926d53c79541efe9cea6ac1d823a58bbed1106"
integrity sha512-/KWWRaD3fGkVCZsdR0RU53PSthFmoHVhZl+y9+6DqeDLSikLdlUVpVEAmI6iCRR5QyOjBYBqHZV/bdv4DJ4Gtw==

[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-sort-destructure-keys/-/eslint-plugin-sort-destructure-keys-2.0.0.tgz#23d26e3db4a8fb73fcd0dfceb2de4c517e6d603f"
Expand Down

0 comments on commit 589a2a6

Please sign in to comment.