noReExportAll
¥Summary
-
规则生效日期:
v1.6.0¥Rule available since:
v1.6.0 -
诊断类别:
lint/performance/noReExportAll¥Diagnostic Category:
lint/performance/noReExportAll -
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 warning。
¥The default severity of this rule is warning.
-
来源:
¥Sources:
¥How to configure
{ "linter": { "rules": { "performance": { "noReExportAll": "error" } } }}¥Description
避免重新导出所有内容。
¥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
Biome v2.1 中文网 - 粤ICP备13048890号