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);
}