Skip to content

Commit cddfdca

Browse files
scottoharabradzacher
authored andcommitted
fix(eslint-plugin): [promise-function-async] Allow async get/set (#820)
1 parent 92e2b31 commit cddfdca

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

packages/eslint-plugin/src/rules/promise-function-async.ts

+8
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ export default util.createRule<Options, MessageIds>({
103103
return;
104104
}
105105

106+
if (
107+
node.parent &&
108+
node.parent.type === 'Property' &&
109+
(node.parent.kind === 'get' || node.parent.kind === 'set')
110+
) {
111+
return;
112+
}
113+
106114
context.report({
107115
messageId: 'missingAsync',
108116
node,

packages/eslint-plugin/tests/rules/promise-function-async.test.ts

+6
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ const invalidAsyncModifiers = {
6363
},
6464
set asyncGetter(p: Promise<void>) {
6565
return p;
66+
},
67+
get asyncGetterFunc() {
68+
return async () => new Promise<void>();
69+
},
70+
set asyncGetterFunc(p: () => Promise<void>) {
71+
return p;
6672
}
6773
}
6874
`,

0 commit comments

Comments
 (0)