💼 This rule is enabled in the ✅ recommended
config.
🔧 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.
// ❌
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);
}