Package com.diffplug.spotless.biome
Class BiomeStep
java.lang.Object
com.diffplug.spotless.biome.BiomeStep
formatter step that formats JavaScript and TypeScript code with Biome:
https://github.com/biomejs/biome.
It delegates to the Biome executable. The Biome executable is downloaded from
the network when no executable path is provided explicitly.
-
Method Summary
Modifier and TypeMethodDescriptioncreate()Creates a formatter step with the current configuration, which formats code by passing it to the Biome executable.name()withConfigPath(String configPath) Sets the path to the Biome configuration.static BiomeStepwithExeDownload(String version, String downloadDir) Creates a Biome step that format code by downloading to the given Biome version.static BiomeStepwithExePath(String pathToExe) Creates a Biome step that formats code by delegating to the Biome executable located at the given path.withLanguage(String language) Sets the language of the files to format When no language is set, it is determined automatically from the file name.
-
Method Details
-
name
- Returns:
- The name of this format step, i.e.
biomeorrome.
-
withExeDownload
Creates a Biome step that format code by downloading to the given Biome version. The executable is downloaded from the network.- Parameters:
version- Version of the Biome executable to download.downloadDir- Directory where to place the downloaded executable.- Returns:
- A new Biome step that download the executable from the network.
-
withExePath
Creates a Biome step that formats code by delegating to the Biome executable located at the given path.- Parameters:
pathToExe- Path to the Biome executable to use.- Returns:
- A new Biome step that format with the given executable.
-
create
Creates a formatter step with the current configuration, which formats code by passing it to the Biome executable.- Returns:
- A new formatter step for formatting with Biome.
-
withConfigPath
Sets the path to the Biome configuration. Must be either a directory with a file namedbiome.json, or a file with the Biome config as JSON. When no config path is set, the default configuration is used.- Parameters:
configPath- Config path to use.- Returns:
- This builder instance for chaining method calls.
-
withLanguage
Sets the language of the files to format When no language is set, it is determined automatically from the file name. The following languages are currently supported by Biome.- js (JavaScript)
- jsx (JavaScript + JSX)
- js? (JavaScript or JavaScript + JSX, depending on the file extension)
- ts (TypeScript)
- tsx (TypeScript + JSX)
- ts? (TypeScript or TypeScript + JSX, depending on the file extension)
- css (CSS, requires biome >= 1.9.0)
- json (JSON)
- jsonc (JSON + comments)
- Parameters:
language- The language of the files to format.- Returns:
- This builder instance for chaining method calls.
-