Thanks to visit codestin.com
Credit goes to github.com

Skip to content

πŸ› Plugin relative paths fail with "Cannot read file" when loading configurationΒ #8488

@deww400

Description

@deww400

Environment information

CLI:
  Version:                      2.3.9
  Color support:                false

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:                         unset
  JS_RUNTIME_VERSION:           v22.16.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         unset

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

Workspace:
  Open Documents:               0

What happened?

When using a relative path for a GritQL plugin in the root biome.json, Biome fails with "Cannot read file" error during configuration loading. Absolute paths work correctly. Steps to reproduce
Create a monorepo with a root biome.json:

{
    "$schema": "https://biomejs.dev/schemas/2.3.9/schema.json",
    "root": true,
    "plugins": ["./biome/my-plugin.grit"]
}

Create a plugin file at ./biome/my-plugin.grit:

engine biome(1.0)
language js(typescript, jsx)

`new Date($...)` as $expr where {
    register_diagnostic(span=$expr, message="Avoid new Date", severity="warn")
}

Run biome check .
Expected result: Plugin loads and diagnostics are reported.
Actual result:

βœ– Error(s) during loading of plugins:
Cannot read file.

βœ– Biome exited because the configuration resulted in errors. Please fix them.

Workaround: Using an absolute path works:

{
    "plugins": ["/absolute/path/to/biome/my-plugin.grit"]
}

Notes
The plugin file exists and has correct read permissions
This is different from #8360, which was about child configs with extends: "//"
The documentation shows "./path-to-plugin.grit" as the expected format

Expected result

Plugin loads successfully and reports diagnostics when running biome check ., biome lint ., or any other Biome command.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-PluginsArea: pluginsS-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