# `Spark.Formatter`
[🔗](https://github.com/ash-project/spark/blob/v2.7.2/lib/spark/formatter.ex#L6)

Formats Spark modules.

Currently, it is very simple, and will only reorder the outermost sections according to some rules.

# Plugin

Include the plugin into your `.formatter.exs` like so `plugins: [Spark.Formatter]`.

If no configuration is provided, it will sort all top level DSL sections *alphabetically*.

# Section Order

To provide a custom section order, add configuration to your app, for example:

```elixir
config :spark, :formatter,
  remove_parens?: true,
  "Ash.Resource": [
    section_order: [
      :resource,
      :postgres,
      :attributes,
      :relationships,
      :aggregates,
      :calculations
    ]
  ],
  "MyApp.Resource": [
    # Use this if you use a module that is not the spark DSL itself.
    # For example, you might have a "base" that you use instead that sets some simple defaults.

    # This tells us what the actual thing is so we know what extensions are included automatically.
    type: Ash.Resource,

    # Tell us what extensions might be added under the hood
    extensions: [MyApp.ResourceExtension],
    section_order: [...]
  ]
```

Any sections found that aren't in that list will be left in the order that they were in, the sections
in the list will be sorted "around" those sections. E.g the following list: `[:code_interface, :attributes]` can be interpreted as
"ensure that code_interface comes before attributes, and don't change the rest".

# `entity_builders`

# `features`

# `format`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
