Skip to content

Errors while trying to format Angular ngClass attribute #85

@TomTomB

Description

@TomTomB

What version of prettier-plugin-tailwindcss are you using?

v0.1.12

What version of Tailwind CSS are you using?

v3.1.4

What version of Node.js are you using?

v16.14.2

What package manager are you using?

npm

What operating system are you using?

Windows 11

Reproduction URL

https://github.com/TomTomB/tailwind-ng-prettier-issue

Describe your issue

The repo is a bare nrwl nx setup.
After clone, the following commands needs to get executed:

  • npm i
  • npm run prettier .\apps\issue-app\src\app\app.component.html

This will result in the following error.

apps\issue-app\src\app\app.component.html[error] apps\issue-app\src\app\app.component.html: SyntaxError: Did not expect a type annotation here. (3:36)
[error]   1 | <a
[error]   2 |   title="Details"
[error] > 3 |   [routerLink]="['/', 'things', some.thing]"
[error]     |                                    ^
[error]   4 |   [ngClass]="{
[error]   5 |     '!text-abc !border-abc':
[error]   6 |       ('/c/' + some.thing | urlPipe: { option: true } | async) &&

After removing the ngClass attribue, the error is "resolved".

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions