no-anonymous-default-export
March 27, 2026 ยท View on GitHub
๐ Disallow anonymous functions and classes as the default export.
๐ผ This rule is enabled in the following configs: โ
recommended, โ๏ธ unopinionated.
๐ก This rule is manually fixable by editor suggestions.
Naming default exports improves codebase searchability by ensuring consistent identifier use for a module's default export, both where it's declared and where it's imported.
Examples
// โ
export default class {}
// โ
export default class Foo {}
// โ
export default function () {}
// โ
export default function foo () {}
// โ
export default () => {};
// โ
const foo = () => {};
export default foo;
// โ
module.exports = class {};
// โ
module.exports = class Foo {};
// โ
module.exports = function () {};
// โ
module.exports = function foo () {};
// โ
module.exports = () => {};
// โ
const foo = () => {};
module.exports = foo;