Skip to content

exportFromImports

Reports imports that are re-exported and could use export...from syntax instead.

✅ This rule is included in the ts stylistic and stylisticStrict presets.

When re-exporting from a module without otherwise using the imported value, it’s unnecessary to import and then export. It can be done in a single export...from declaration, which is more concise and makes the re-export intent clearer.

import
import defaultExport
defaultExport
from "./foo.js";
export default
import defaultExport
defaultExport
;
import {
const named: "named"
named
} from "./foo.js";
export {
const named: "named"
export named
named
};
import * as
import namespace
namespace
from "./foo.js";
export {
export namespace
namespace
};
import
import defaultExport
defaultExport
, {
const named: "named"
named
} from "./foo.js";
export default
import defaultExport
defaultExport
;
export {
import defaultExport
defaultExport
as
export renamedDefault
renamedDefault
,
const named: "named"
export named
named
,
const named: "named"
named
as
const renamedNamed: "named"
export renamedNamed
renamedNamed
};

This rule is not configurable.

If you prefer the explicit import/export pattern for clarity in your codebase, this rule may not be for you.

Made with ❤️‍🔥 around the world by the Flint team and contributors.