This rule raises an issue when using named import or export syntax to handle default values instead of the dedicated default syntax.

Why is this an issue?

JavaScript provides two ways to import and export default values: the dedicated default syntax and the named syntax with explicit default naming.

The dedicated default syntax (import foo from 'module' and export default foo) is the conventional and recommended approach because:

Using the named syntax for defaults (import {default as foo} or export {foo as default}) is unnecessarily verbose and can confuse developers who expect the standard default syntax.

What is the potential impact?

Using non-standard syntax for default imports and exports reduces code readability and consistency. While this doesn’t cause runtime issues, it can slow down code comprehension and make the codebase harder to maintain, especially for teams with varying JavaScript experience levels.

How to fix?

Replace named import of default with dedicated default import syntax.

Non-compliant code example

import {default as foo} from 'module'; // Noncompliant

Compliant code example

import foo from 'module';

Documentation