Skip to content

Latest commit

 

History

History
64 lines (46 loc) · 1.14 KB

no-anonymous-default-export.md

File metadata and controls

64 lines (46 loc) · 1.14 KB

Disallow anonymous functions and classes as the default export

💼 This rule is enabled in the ✅ recommended config.

💡 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.

Fail

export default class {}
export default function () {}
export default () => {};
module.exports = class {};
module.exports = function () {};
module.exports = () => {};

Pass

export default class Foo {}
export default function foo () {}
const foo = () => {};
export default foo;
module.exports = class Foo {};
module.exports = function foo () {};
const foo = () => {};
module.exports = foo;