Closed
Description
openedon Nov 17, 2022
I noticed that the prefer-default-export rule only triggers when there is a single named export in a file. I would like for it to trigger for any file that doesn't have a default export: whether it has multiple named exports, a single named export, or no exports at all (but each of these could be configuration options for this rule).
The following patterns would be considered warnings:
// bad1.js
// There is only a single module export and it's a named export.
export const foo = 'foo';
// bad2.js
// There is more than one named export in the module.
export const foo = 'foo';
export const bar = 'bar';
The following patterns would not be considered warnings:
// good1.js
// There is a single export and it's a default export.
const foo = 'foo';
export default foo;
// good2.js
// There is a default export.
export const foo = 'foo';
const bar = 'bar';
export default bar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment