Skip to content

Commit

Permalink
feat(eslint-config-angular): add most useful rules for async-await (#…
Browse files Browse the repository at this point in the history
…195)
  • Loading branch information
splincode committed Apr 21, 2022
1 parent 74f4f5a commit 015e0d1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/eslint-config-angular/README.md
Expand Up @@ -19,7 +19,8 @@ necessary additional configs.
"@tinkoff/eslint-config/app",
"@tinkoff/eslint-config-angular",
"@tinkoff/eslint-config-angular/html",
"@tinkoff/eslint-config-angular/rxjs"
"@tinkoff/eslint-config-angular/rxjs",
"@tinkoff/eslint-config-angular/promise"
]
}
```
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config-angular/package.json
Expand Up @@ -12,6 +12,7 @@
"index.js",
"rxjs",
"html",
"promise",
"ts",
"README.md"
],
Expand Down
28 changes: 28 additions & 0 deletions packages/eslint-config-angular/promise/index.js
@@ -0,0 +1,28 @@
module.exports = {
overrides: [
{
files: ['*.ts'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
'require-await': 'off', // note you must disable the base rule as it can report incorrect errors
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/promise-function-async': [
'error',
{
allowedPromiseNames: ['Thenable'],
checkArrowFunctions: true,
checkFunctionDeclarations: true,
checkFunctionExpressions: true,
checkMethodDeclarations: true,
},
],
'@typescript-eslint/no-floating-promises': [
'error',
{ ignoreVoid: true, ignoreIIFE: true },
],
},
},
],
};

0 comments on commit 015e0d1

Please sign in to comment.