Skip to content

Commit 326572f

Browse files
committed
Use parents to find current function
1 parent 0c4e721 commit 326572f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/rules/async-server-action.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,9 @@ module.exports = {
3333
},
3434

3535
create(context) {
36-
let currentFunction = null;
37-
3836
return {
39-
':function'(node) {
40-
currentFunction = node;
41-
},
42-
':function[async=false]>BlockStatement>:first-child[expression.value="use server"]'() {
37+
':function[async=false]>BlockStatement>:first-child[expression.value="use server"]'(node) {
38+
const currentFunction = node.parent.parent;
4339
report(context, messages.asyncServerAction, 'asyncServerAction', {
4440
node: currentFunction,
4541
fix(fixer) {

0 commit comments

Comments
 (0)