Closed leomayer closed 2 years ago
I figured already out a config which suits me
"attributeGroups": ["^#", "$ANGULAR_STRUCTURAL_DIRECTIVE", "^(id|name)$", "^mat-", "^class$", "^mat", "$ANGULAR_TWO_WAY_BINDING", "$ANGULAR_OUTPUT", "$ANGULAR_INPUT", "$DEFAULT", "^aria-", "^i18n" ]
Glad you figured it out ๐
Based on the current config: https://github.com/NiklasPor/prettier-plugin-organize-attributes/blob/e1cdcf3a6f3cf0e3a83568deb89eda1d0e1846e4/src/presets.ts#L38-L48
I did it this way:
{
"attributeGroups": [
"$ANGULAR_ELEMENT_REF",
"$ANGULAR_STRUCTURAL_DIRECTIVE",
"^(mat|er)-", // target material (mat-) & my app (er-) directives
"$ANGULAR_ANIMATION",
"$ANGULAR_ANIMATION_INPUT",
"$ANGULAR_TWO_WAY_BINDING",
"^\\[(?!ngClass|\\(|@)", // == $ANGULAR_INPUT without ngClass
"$ANGULAR_OUTPUT",
"$DEFAULT",
"^class$",
"^\\[ngClass",
"^i18n"
]
}
Thanks for the idea leomayer ๐ป
Based on the current config: https://github.com/NiklasPor/prettier-plugin-organize-attributes/blob/e1cdcf3a6f3cf0e3a83568deb89eda1d0e1846e4/src/presets.ts#L38-L48
I did it this way:
{ "attributeGroups": [ "$ANGULAR_ELEMENT_REF", "$ANGULAR_STRUCTURAL_DIRECTIVE", "^(mat|er)-", // target material (mat-) & my app (er-) directives "$ANGULAR_ANIMATION", "$ANGULAR_ANIMATION_INPUT", "$ANGULAR_TWO_WAY_BINDING", "^\\[(?!ngClass|\\(|@)", // == $ANGULAR_INPUT without ngClass "$ANGULAR_OUTPUT", "$DEFAULT", "^class$", "^\\[ngClass", "^i18n" ] }
Thanks for the idea leomayer ๐ป
Great usage with the custom component library ๐
I use Angular Material and if I use your plugin than I would like to have all the Angular Material attributes at the beginning, e.g.
Should move
mat-
at the beginning. Same in<th mat-header-cell...
I'm not really clear about the other attributes, e.g.
matTooltip
,matSuffix
(inmat-button
),matBadge
, etc. But preferably after themat-
group.Definitely I want to have all
i18n
at the very ending. Sorted by the optional additional arguments, e.g.i18n-matTooltip="@@tooltip"
Do you have a config example?