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

Support Angular inline styles as single template literal #15968

Merged
merged 4 commits into from Jan 21, 2024

Conversation

sosukesuzuki
Copy link
Member

Description

Closes #15934

Checklist

  • I’ve added tests to confirm my change works.
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@sosukesuzuki sosukesuzuki marked this pull request as ready for review January 21, 2024 04:49
const isStyleProperty = (node, name) =>
isObjectProperty(node) &&
node.key.type === "Identifier" &&
node.key.name === "styles" &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!node.computed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed this and added tests. Also I've create the new similar issue for template as a good first ( #15969 )

name === "value",
...angularComponentObjectExpressionPredicates,
const isTemplateLiteral = (node) => node.type === "TemplateLiteral";
const isStyleProperty = (node, name) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about isObjectPropertyNamedStyles?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second parameter should be named key

@sosukesuzuki sosukesuzuki merged commit 2fe7f41 into prettier:main Jan 21, 2024
28 checks passed
@sosukesuzuki sosukesuzuki deleted the feat-15934 branch January 21, 2024 09:10
medikoo pushed a commit to medikoo/prettier-elastic that referenced this pull request Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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