Skip to content

Commit

Permalink
fix(eslint-plugin): [promise-function-async] Allow async get/set (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottohara authored and bradzacher committed Aug 23, 2019
1 parent 92e2b31 commit cddfdca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/eslint-plugin/src/rules/promise-function-async.ts
Expand Up @@ -103,6 +103,14 @@ export default util.createRule<Options, MessageIds>({
return;
}

if (
node.parent &&
node.parent.type === 'Property' &&
(node.parent.kind === 'get' || node.parent.kind === 'set')
) {
return;
}

context.report({
messageId: 'missingAsync',
node,
Expand Down
Expand Up @@ -63,6 +63,12 @@ const invalidAsyncModifiers = {
},
set asyncGetter(p: Promise<void>) {
return p;
},
get asyncGetterFunc() {
return async () => new Promise<void>();
},
set asyncGetterFunc(p: () => Promise<void>) {
return p;
}
}
`,
Expand Down

0 comments on commit cddfdca

Please sign in to comment.