Skip to content

Formatting

You can format generated source code using one of the supported code formatters, provided by prettier. This is done by specifying the formatUsing field in the template frontmatter.

Source code formatting is supported for the following languages:

  • babel (for JavaScript)
  • typescript (for TypeScript)
  • java (for Java)
  • graphql (for GraphQL)
  • sql (for SQL)
  • json (for JSON)
  • yaml (for YAML)
  • html (for HTML)
  • css (for CSS)
  • scss (for SCSS)

Example:

{
    "map": {
        "entities": "entities"
    },
    "filename": "packages/entities/src/index.ts",
    "formatUsing": "typescript"
}
---
{{#each entities}}
/** {{{description}}} */
export interface {{pascalCase name}}Entity {
    {{#each fields}}
    {{pascalCase name}}: {{type.ts}};
    {{/each}}
}
{{/each}}