diff --git a/lib/rules/hashbang.js b/lib/rules/hashbang.js index 5199e5b5..3b9a0fa1 100644 --- a/lib/rules/hashbang.js +++ b/lib/rules/hashbang.js @@ -50,7 +50,7 @@ function isNodeShebang(shebang, executableName) { * @returns {string} */ function getExpectedExecutableName(context) { - const extension = path.extname(context.filename) + const extension = path.extname(context.filename ?? context.getFilename()) /** @type {{ executableMap: Record }} */ const { executableMap = {} } = context.options?.[0] ?? {}