Comment Directive

Tombi supports comment directives to control the behavior of the document.

There are two types of comment directives with different scopes of application, as follows.

TypeDirectiveScope
Document Comment Directive#:tombiDocument
Value Comment Directive# tombi:Value

Document Comment Directive

Document comment directives are comments that apply to the entire document.

This only works in the comment group at the beginning of the document, so you need to add a blank line before the document value.

#:schema

Same as Taplo, #:schema is used to specify the schema to use for the document. However, Tombi only allows document comment directives at the beginning of the document, so you need to add a blank line after the directive.

#:schema tombi://json.schemastore.org/pyproject.json

[project]
name = "tombi"

#:tombi

#:tombi adds instructions to Tombi. The instructions can be written in the TOML syntax, and can specify the TOML version information, etc.

The following instructions are currently available.

#:tombi toml-version = "v1.0.0"
#:tombi format.disabled = true
#:tombi lint.disabled = true
#:tombi schema.strict = false

Value Comment Directive

Value comment directives are comments that apply to a specific value.

You can add settings to ignore validation errors generated by the linter.

# tombi: lint.rules.key-empty.disabled = true
"" = "value"

You can disable the automatic table key sorting that is applied when using JSON Schema for validation. Additionally, you can enable automatic sorting of table keys even if you are not using JSON Schema.

# tombi: format.rules.table-keys-order.disabled = true
[project]
name = "tombi"
readme = "README.md"
version = "0.1.0"

# tombi: format.rules.table-keys-order = "ascending"
[tool.uv]
cache-dir = "~/.cache/uv"
offline = true