Skip to main content

Crate dprint_config

Crate dprint_config 

Source
Expand description

§dprint-config

Crates.io docs.rs GitHub License

Strongly-typed configuration structs and JSON Schema for dprint formatter plugins (TypeScript, JSON, TOML, Markdown). Used by Lintel to pass user formatting options through to dprint.

§Features

  • Typed configuration structs for dprint global settings and per-plugin options
  • Covers TypeScript, JSON, TOML, and Markdown plugins
  • Unknown plugins fall through to a generic PluginConfig with arbitrary settings
  • JSON Schema generation via schemars
  • #[no_std] compatible

§Usage

use dprint_config::DprintConfig;

let json = r#"{ "lineWidth": 100, "json": { "indentWidth": 4 } }"#;
let config: DprintConfig = serde_json::from_str(json).unwrap();
assert_eq!(config.line_width, Some(100));

§License

Apache-2.0

Modules§

json
Configuration for the dprint JSON plugin.
markdown
Configuration for the dprint Markdown plugin.
toml
Configuration for the dprint TOML plugin.
typescript
Configuration for the dprint TypeScript / JavaScript plugin.

Structs§

DprintConfig
dprint configuration file (dprint.json / .dprint.json).
PluginConfig
Configuration for a dprint plugin not covered by the typed plugin structs.

Enums§

Extends
One or more configuration files to extend.
NewLineKind
The newline character style to use when formatting files.

Functions§

schema
Generate the JSON Schema for DprintConfig as a serde_json::Value.