Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular inline styles are not formatted if specified as single string (new in v17) #15934

Closed
matthias-dev opened this issue Jan 15, 2024 · 0 comments · Fixed by #15968
Closed
Labels
lang:angular Issues affecting Angular template (not general JS/TS issues used for Angular) locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:enhancement A potential new feature to be added, or an improvement to how we print something

Comments

@matthias-dev
Copy link

Prettier 3.2.2
Playground link

--parser babel

Input:

import {Component} from '@angular/core';

@Component({
  selector: 'app-root',
  template: `Hello`,
  styles: `
    :host{
      color:blue;}
  `,
})
export class AppComponent {}

Output:

import { Component } from "@angular/core";

@Component({
  selector: "app-root",
  template: `Hello`,
  styles: `
    :host{
      color:blue;}
  `,
})
export class AppComponent {}

Expected output:

Why?

Since Angular v17 it is possible to specify an inline style with a single string rather than an array of strings. If specified as array prettier formats the css. If specified as string prettier does nothing with the css.

@sosukesuzuki sosukesuzuki added type:enhancement A potential new feature to be added, or an improvement to how we print something lang:angular Issues affecting Angular template (not general JS/TS issues used for Angular) labels Jan 21, 2024
@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Apr 21, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:angular Issues affecting Angular template (not general JS/TS issues used for Angular) locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:enhancement A potential new feature to be added, or an improvement to how we print something
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants