Skip to content

noReExportAll

诊断类别:lint/performance/noReExportAll

¥Diagnostic Category: lint/performance/noReExportAll

自从:v1.6.0 来源:

¥Since: v1.6.0 Sources:

避免重新导出所有内容。

¥Avoid re-export all.

模块化项目中深度嵌套的导入链(即一个 barrel 文件导入另一个 barrel 文件)会导致加载时间和复杂性增加。此结构导致许多模块不必要地加载,严重影响大型应用的性能。此外,它使代码库复杂化,使得导航和理解项目的依赖图变得困难。

¥Deeply nested import chains in modular projects, where a barrel file imports another barrel file, can lead to increased load times and complexity. This structure results in the unnecessary loading of many modules, significantly impacting performance in large-scale applications. Additionally, it complicates the codebase, making it difficult to navigate and understand the project’s dependency graph.

¥Examples

¥Invalid

export * from "foo";
code-block.js:1:8 lint/performance/noReExportAll ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Do not use export all ( export * from … ).

> 1 │ export * from “foo”;
^^^^^^^^^^^^^
2 │

Use named export instead.

export * as foo from "foo";
code-block.js:1:8 lint/performance/noReExportAll ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Do not use export all ( export * from … ).

> 1 │ export * as foo from “foo”;
^^^^^^^^^^^^^^^^^^^^
2 │

Use named export instead.

¥Valid

export { foo } from "foo";
export type * from "foo";
export type * as bar from "bar";

¥Related links