Skip to content

bug: biome format with --stdin-file-path fails if includes is missing the value in --stdin-file-path. #6783

@hhhapz

Description

@hhhapz

Environment information

Version:                      2.0.6
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:               unset
  BIOME_LOG_PREFIX_NAME:        unset
  BIOME_CONFIG_PATH:            unset
  BIOME_THREADS:                unset
  NO_COLOR:                     unset
  TERM:                         xterm-kitty
  JS_RUNTIME_VERSION:           v24.3.0
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         pnpm/10.12.4

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

Workspace:
  Open Documents:               0

What happened?

  1. create a biome.json with the following contents:
{
	"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
	"files": {
		"includes": [
			"apps/**/*.{json,md,toml,ts,tsx,yaml,yml}",
			"packages/**/*.{json,md,toml,ts,tsx,yaml,yml}"
		]
	},
	"formatter": {
		"enabled": true
	}
}
  1. run echo '' | biome format --stdin-file-path 'a.tsx' --files-ignore-unknown=false
  2. Observe
The content was not formatted because the formatter is currently disabled.
stdin ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ The contents aren't fixed. Use the `--write` flag to fix them.

Expected result

The fact that a.tsx isn't in my includes shouldn't cause format to stop working.

you have to put whatever file you have in stdin-file-path in your includes for it to work:

{
	"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
	"files": {
		"includes": [
			"apps/**/*.{json,md,toml,ts,tsx,yaml,yml}",
			"packages/**/*.{json,md,toml,ts,tsx,yaml,yml}",
			"a.tsx"
		]
	},
	"formatter": {
		"enabled": true
	}
}

however this is impractical for command line tools that integrate with biome outside of the editor directly

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-CLIArea: CLIS-Help-wantedStatus: you're familiar with the code base and want to help the projectgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions