Skip to content

🐛 Linting Svelte context module produces "unusually large amount of types" diagnostic since Biome 2.3.7 #8527

@metonym

Description

@metonym

Environment information

CLI:
  Version:                      2.3.10
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  BIOME_THREADS:                unset
  NO_COLOR:                     unset
  TERM:                         xterm-256color
  JS_RUNTIME_VERSION:           v22.14.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         bun/1.3.5

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         biome.json
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  false
  HTML full support enabled:    unset

Workspace:
  Open Documents:               0

What happened?

I use Biome to lint and format a Svelte component library: https://github.com/carbon-design-system/carbon-components-svelte

Repro: carbon-design-system/carbon-components-svelte#2439

When upgrading to Biome 2.3.7 or later, I experience a benign diagnostic, which flags TreeViewNode.svelte:

$ biome check --write .
  ⚠ Biome encountered an unusually large amount of types which exceeded the limit of 200,000.
    
    Either you are analyzing very large files (did you make sure to exclude your build/ or dist/ folder?), or you've encountered a bug in Biome.
    
    Please follow these instructions to discover if you are accidentally analyzing large files and what to do about them in the relative guide.
  
  ℹ In the meantime, you can force this file to be ignored using a `!!` pattern in the files.includes option in your configuration file.
  
  ℹ Refer to the documentation for more information.
  
  ℹ If you think this is a bug, please report it and include the following information:
  
  - source code of the file;
  - how the file is imported in the project (by a test file, a dependency, etc.);
  - if and how the file/folder is excluded.
  
  ⚠ Failing to provide this information won't allow the team to fix the issue.
  
  ⚠ This diagnostic was derived from an internal Biome error. Potential bug, please report it if necessary.
  

Checked 1059 files in 585ms. No fixes applied.

Through trial and error, the diagnostic disappears when commenting out the following code in the Svelte context script:

This diagnostic disappears when I comment out the following line:

<script context="module">
  export function computeTreeLeafDepth(node) {
    let depth = 0;

    if (node == null) return depth;

    let parentNode = node.parentNode;

    while (parentNode != null && parentNode.getAttribute("role") !== "tree") {
-     parentNode = parentNode.parentNode;
      if (parentNode.tagName === "LI") depth++;
    }

    return depth;
  }
</script>

This diagnostic is not reproducible in the Biome playground, since it seems related to the config files.includes.

Expected result

It should not print out the benign diagnostic warning message.

Biome 2.3.6: no error
Biome 2.3.7: with error
Biome 2.3.10: with error

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-Type-InferenceArea: type inferenceL-JavaScriptLanguage: JavaScript and super languagesS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions