Formatters
Configure code formatting tools in OpenCode.
Configuration
{
"formatter": {
"prettier": {
"disabled": true
},
"custom-prettier": {
"command": ["npx", "prettier", "--write", "$FILE"],
"environment": {
"NODE_ENV": "development"
},
"extensions": [".js", ".ts", ".jsx", ".tsx"]
}
}
}Options
| Option | Purpose |
|---|---|
disabled | Disable a formatter |
command | Command to run |
environment | Environment variables |
extensions | File extensions to format |
Built-in Formatters
OpenCode includes support for popular formatters. Disable them to use custom configurations.