Volt.JS.Format (Volt v0.23.0)

Copy Markdown View Source

Loads JavaScript formatter configuration for oxfmt.

Summary

Functions

File-discovery options (:root, :sources, :ignore) for mix volt.js.format and mix volt.js.check, from the :volt key of .formatter.exs.

Read the options in the project's .formatter.exs, or [] without one.

Functions

discovery_config(formatter_opts \\ formatter_opts())

@spec discovery_config(keyword()) :: keyword()

File-discovery options (:root, :sources, :ignore) for mix volt.js.format and mix volt.js.check, from the :volt key of .formatter.exs.

format_files(files, opts \\ load_config())

formatter_opts()

@spec formatter_opts() :: keyword()

Read the options in the project's .formatter.exs, or [] without one.

load_config(formatter_opts \\ formatter_opts())

@spec load_config(keyword()) :: keyword()

Load oxfmt options.

Options come from the :volt key of .formatter.exs:

[
  plugins: [Volt.Formatter],
  volt: [semi: false, single_quote: true]
]

Without that key, they come from .oxfmtrc.json or .prettierrc.json. formatter_opts is the keyword list .formatter.exs evaluates to; mix format passes it to Volt.Formatter, and the Mix tasks read the file themselves.

load_json_config()