diff --git a/src/get-function-name-with-kind.js b/src/get-function-name-with-kind.js index fa58adc..f1089ff 100644 --- a/src/get-function-name-with-kind.js +++ b/src/get-function-name-with-kind.js @@ -83,6 +83,11 @@ export function getFunctionNameWithKind(node, sourceCode) { parent.left.type === "Identifier" ) { tokens.push(`'${parent.left.name}'`) + } else if ( + parent.type === "ExportDefaultDeclaration" && + parent.declaration === node + ) { + tokens.push("'default'") } return tokens.join(" ") diff --git a/test/get-function-name-with-kind.js b/test/get-function-name-with-kind.js index 4e9be41..9c2529b 100644 --- a/test/get-function-name-with-kind.js +++ b/test/get-function-name-with-kind.js @@ -64,6 +64,11 @@ describe("The 'getFunctionNameWithKind' function", () => { "class A { static async foo() {} }": "static async method 'foo'", "class A { static get foo() {} }": "static getter 'foo'", "class A { static set foo(a) {} }": "static setter 'foo'", + "export default async function* foo() {}": + "async generator function 'foo'", + "export default async function* () {}": + "async generator function 'default'", + "export default async () => {}": "async arrow function 'default'", ...(semver.gte(eslint.Linter.version, "8.0.0") ? { @@ -142,6 +147,7 @@ describe("The 'getFunctionNameWithKind' function", () => { ecmaVersion: semver.gte(eslint.Linter.version, "8.0.0") ? 2022 : 2020, + sourceType: "module", }, }) @@ -171,6 +177,7 @@ describe("The 'getFunctionNameWithKind' function", () => { ecmaVersion: semver.gte(eslint.Linter.version, "8.0.0") ? 2022 : 2020, + sourceType: "module", }, })