diff --git a/lib/rules/no-hooks-from-ancestor-modules.js b/lib/rules/no-hooks-from-ancestor-modules.js index bf0176bc..e268dd85 100644 --- a/lib/rules/no-hooks-from-ancestor-modules.js +++ b/lib/rules/no-hooks-from-ancestor-modules.js @@ -63,7 +63,7 @@ module.exports = { function getCallbackArg(args) { // Callback can be either args[1] or args[2] // https://api.qunitjs.com/QUnit/module/ - return args.slice(1, 3).find(arg => arg.type === "FunctionExpression"); + return args.slice(1, 3).find(arg => ["FunctionExpression", "ArrowFunctionExpression"].includes(arg.type)); } function getHooksIdentifierFromParams(params) { diff --git a/tests/lib/rules/no-hooks-from-ancestor-modules.js b/tests/lib/rules/no-hooks-from-ancestor-modules.js index cac61599..f4e44787 100644 --- a/tests/lib/rules/no-hooks-from-ancestor-modules.js +++ b/tests/lib/rules/no-hooks-from-ancestor-modules.js @@ -45,6 +45,12 @@ ruleTester.run("no-hooks-from-ancestor-modules", rule, { QUnit.module("module", function(hooks) { hooks.beforeEach(function() {}); }); `, ` + QUnit.module("module", (hooks) => { hooks.beforeEach(() => {}); }); + `, + ` + QUnit.module("module", (hooks) => { QUnit.module("module", (hooks) => { hooks.beforeEach(() => {}); }) }); + `, + ` QUnit.module("module", function(hooks) { hooks.afterEach(function() {}); }); `, `