Skip to content

Feature Request: Control flow schematic formatter option to preserve newlines #53494

Description

@TimUnderhay

Which @angular/* package(s) are relevant/related to the feature request?

core

Description

The new control flow migration is a marvellous bit of engineering, however the formatter has a troublesome side-effect of removing all newlines from the templates. It would be preferable were the migration formatter to take a more minimalistic approach to formatting, only adding newlines / whitespace where the control flow code is added to the html templates.

Proposed solution

Add a property to the control migration schema to preserve existing newlines when formatting. And naturally, the formatter should thus obey this.

Something like:

"preserveNewLines": {
      "type": "boolean",
      "description": "Preserve newlines when formatting",
      "x-prompt": "Should existing newlines be preserved when formatting?",
      "default": "false"
    }

Alternatives considered

There are other formatters such as prettier, which is too opinionated, or beautify-js does not yet support the new control flow syntax.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: migrationsIssues related to `ng update`/`ng generate` migrationscore: control flowIssues related to the built-in control flow (@if, @for, @switch)

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions