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;