Format code with dprint.
Run dprint to format code.
{
"@ben_12/dprint/json": [
"error",
{
// Use dprint JSON configuration file (default: "dprint.json")
// It may be created using `dprint init` command
// See also https://dprint.dev/config/
"configFile": "dprint.json",
"config": {
// The json configuration of dprint
// See also https://dprint.dev/plugins/json/config/
},
},
],
}
The plugin can also be given a pre-resolved dprint formatter via ESLint’s settings, which is
useful when the dprint plugin packages are not directly require()-able (e.g. bundled configs).
See the main README for the full
explanation and the accepted shapes. Minimal example for this rule:
import jsonFormatter from "@dprint/json";
export default [{
settings: {
"@ben_12/dprint": {
formatters: { json: jsonFormatter },
},
},
rules: {
"@ben_12/dprint/json": ["error", { config: { /* dprint config */ } }],
},
}];