Fix tools - jj-vcs/jj GitHub Wiki
jj fix allows you to run a "fix tool" like a formatter, linter, etc., against every commit in a branch all at once.
Protocol
- The tool must accept the original source code on standard input
- The tool must output the fixed source code on standard output
- The tool may output human-readable information on standard error, this will be displayed to the user
- The replacement variable
$pathmay be used to pass the file name to the fix tool. - The tool is executed with the workspace root as its working directory.
Tools
Biome
Biome is a JavaScript formatter and linter.
[fix.tools.biome]
command = ["biome", "check", "--stdin-file-path=$path", "--write"]
# run with npx:
# command = ["npx", "@biomejs/biome", "check", "--stdin-file-path=$path", "--write"]
# run from node_modules:
# command = ["$root/node_modules/.bin/biome", "check", "--stdin-file-path=$path", "--write"]
patterns = [
"glob:'**/*.js'",
"glob:'**/*.jsx'",
"glob:'**/*.ts'",
"glob:'**/*.tsx'",
"glob:'**/*.json'",
]
CSharpier
CSharpier is an opinionated formatter for C# files.
[fix.tools.csharpier]
command = ["dotnet", "csharpier", "--write-stdout"]
patterns = ["root-glob:'**/*.cs'"]
fish_indent
fish_indent is the official indenter and prettifier shipped with fish shell.
[fix.tools.fish_indent]
command = ["fish_indent"]
patterns = ["glob:'**/*.fish'"]
Gofmt, gofumpt
The trivial config works for many Go ecosystem tools.
[fix.tools.gofmt]
patterns = ["glob:'**/*.go'"]
command = ["gofmt"]
# [fix.tools.gofumpt]
# patterns = ["glob:'**/*.go'"]
# command = ["gofumpt"]
ktfmt
ktfmt is a Kotlin formatter, based on google-java-format.
[fix.tools.ktfmt]
command = ["ktfmt", "--kotlinlang-style", "--stdin-name=$path", "-"]
patterns = ["glob:'**/*.kt'"]
# --meta-style Use 2-space block indenting
# --google-style Google internal style (2 spaces)
# --kotlinlang-style Kotlin language guidelines style (4 spaces)
Prettier
Prettier is a JavaScript formatter. It supports related languages as well, such as HTML, CSS, and Markdown.
[fix.tools.prettier]
command = ["prettier", "--stdin-filepath", "$path"]
# run with npx:
# command = ["npx", "prettier", "--stdin-filepath", "$path"]
# run from node_modules:
# command = ["$root/node_modules/.bin/prettier", "--stdin-filepath", "$path"]
patterns = [
"glob:'**/*.js'",
"glob:'**/*.jsx'",
"glob:'**/*.ts'",
"glob:'**/*.tsx'",
"glob:'**/*.json'",
"glob:'**/*.html'",
"glob:'**/*.md'",
"glob:'**/*.css'",
]
Rubocop
Rubocop is a formatter and linter for Ruby files.
[fix.tools.rubocop]
command = ["rubocop", "--config", ".rubocop.yml", "--autocorrect", "--stdin", "$path", "--stderr"]
patterns = ["glob:'**/*.rb'"]
ruff
Ruff is a linter and formatter for Python files
[fix.tools.ruff]
command = ["ruff", "-", "--stdin-filename=$path"]
patterns = ["glob:'**/*.py'"]
Rustfmt
Rustfmt is a formatter for Rust files.
[fix.tools.rustfmt]
command = ["rustfmt", "--emit", "stdout", "--edition", "2024"]
patterns = ["glob:'**/*.rs'"]
shfmt
shfmt is a formatter for bash/zsh scripts.
[fix.tools.shfmt]
command = ["shfmt", "--filename=$path"]
patterns = ["glob:'**/*.sh'"]
Terraform
Terraform is an Infrastructure-as-Code tool.
[fix.tools.terraform]
command = ["terraform", "fmt", "-"]
patterns = ["glob:'**/*.tf'"]
yamlfmt
yamlfmt formats YAML files.
[fix.tools.yamlfmt]
command = ["yamlfmt", "-in"]
patterns = ["glob:'**/*.yml'", "glob:'**/*.yaml'"]