biomejs / biome

A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.

Home Page:https://biomejs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ› Impossible to satisfy biome.json schema for rules with no options

jtmueller opened this issue Β· comments

Environment information

CLI:
  Version:                      1.8.0
  Color support:                true

Platform:
  CPU Architecture:             aarch64
  OS:                           macos

Environment:
  BIOME_LOG_DIR:                unset
  NO_COLOR:                     unset
  TERM:                         "xterm-256color"
  JS_RUNTIME_VERSION:           "v20.14.0"
  JS_RUNTIME_NAME:              "node"
  NODE_PACKAGE_MANAGER:         "pnpm/9.2.0"

Biome Configuration:
  Status:                       Loaded successfully
  Formatter disabled:           false
  Linter disabled:              false
  Organize imports disabled:    false
  VCS disabled:                 false

Workspace:
  Open Documents:               0

What happened?

Specify an object instead of a string for a rule that does not include any options. For example, when configuring the "fix" level for "noUnusedImports".

{
  "$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
  "linter": {
    "rules": {
      "correctness": {
        "noUnusedImports": {
          "level": "error",
          "fix": "unsafe"
        }
      }
    }
  }
}

The json schema validation will surface a warning on the "noUnusedImports" line: Missing property "options".

I can't figure out any way to supply an "options" property that will satisfy schema validation:

  • "options": {} "options has an incorrect type, expected no value, but received an object"
  • "options": null "options has an incorrect type, expected no value, but received null"
  • "options": undefined "Value expected"

Is there a way for an "options" property that has no possible values to be optional?

Expected result

It should not warn about a missing "options" property for rules that are not configurable with an options property.

Code of Conduct

  • I agree to follow Biome's Code of Conduct