no-named-default
March 27, 2026 ยท View on GitHub
๐ Disallow named usage of default import and export.
๐ผ This rule is enabled in the following configs: โ
recommended, โ๏ธ unopinionated.
๐ง This rule is automatically fixable by the --fix CLI option.
Enforces the use of the default import and default export syntax instead of named syntax.
Examples
// โ
import {default as foo} from 'foo';
// โ
import foo from 'foo';
// โ
import {default as foo, bar} from 'foo';
// โ
import foo, {bar} from 'foo';
// โ
export {foo as default};
// โ
export default foo;
// โ
export {foo as default, bar};
// โ
export default foo;
export {bar};
// โ
import foo, {default as anotherFoo} from 'foo';
function bar(foo) {
doSomeThing(anotherFoo, foo);
}
// โ
import foo from 'foo';
import anotherFoo from 'foo';
function bar(foo) {
doSomeThing(anotherFoo, foo);
}
// โ
import foo from 'foo';
const anotherFoo = foo;
function bar(foo) {
doSomeThing(anotherFoo, foo);
}