noBarrelFile
Esta página aún no está disponible en tu idioma.
Summary
Section titled “Summary”- Rule available since: 
v1.6.0 - Diagnostic Category: 
lint/performance/noBarrelFile - This rule doesn’t have a fix.
 - The default severity of this rule is warning.
 - Sources:
- Inspired from 
barrel-files/avoid-barrel-files 
 - Inspired from 
 
How to configure
Section titled “How to configure”{  "linter": {    "rules": {      "performance": {        "noBarrelFile": "error"      }    }  }}Description
Section titled “Description”Disallow the use of barrel file.
A barrel file is a file that re-exports all of the exports from other files in a directory. 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. This rule ignores .d.ts files and type-only exports.
For a more detailed explanation, check out https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7/
Examples
Section titled “Examples”Invalid
Section titled “Invalid”export * from "foo";export * from "bar";code-block.js:1:1 lint/performance/noBarrelFile ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ⚠ Avoid barrel files, they slow down performance, and cause large module graphs with modules that go unused.
  
  > 1 │ export * from “foo”;
      │ ^^^^^^^^^^^^^^^^^^^^
    2 │ export * from “bar”;
    3 │ 
  
  ℹ Check this thorough explanation to better understand the context.
  
export { foo } from "foo";export { bar } from "bar";code-block.js:1:1 lint/performance/noBarrelFile ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ⚠ Avoid barrel files, they slow down performance, and cause large module graphs with modules that go unused.
  
  > 1 │ export { foo } from “foo”;
      │ ^^^^^^^^^^^^^^^^^^^^^^^^^^
    2 │ export { bar } from “bar”;
    3 │ 
  
  ℹ Check this thorough explanation to better understand the context.
  
export { default as module1 } from "./module1";code-block.js:1:1 lint/performance/noBarrelFile ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ⚠ Avoid barrel files, they slow down performance, and cause large module graphs with modules that go unused.
  
  > 1 │ export { default as module1 } from “./module1”;
      │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    2 │ 
  
  ℹ Check this thorough explanation to better understand the context.
  
export type * from "foo";export type { foo } from "foo";Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.