Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Configure Tailwind class sorting for custom class-holding attributes
When Tailwind classes move out of `className` into custom props/variables, Prettier no longer sorts them; configure `tailwindAttributes`/regex so sorting keeps working.
Bad example
| 1 | // classes stored in *Class props are no longer auto-sorted |
| 2 | type HeaderTheme = { backgroundClass: string; loginButtonClass: string }; |
Explanation (EN)
Classes moved to an unrecognized attribute can stop following the existing sorting convention.
Objašnjenje (HR)
Good example
| 1 | { |
| 2 | "plugins": ["prettier-plugin-tailwindcss"], |
| 3 | "tailwindAttributes": ["backgroundClass", "loginButtonClass"] |
| 4 | } |
Explanation (EN)
Exact custom attribute names are a supported configuration; verify that these are actual attributes in the source.
Objašnjenje (HR)
Notes (EN)
When a supported formatter plugin stops recognizing classes moved to custom attributes/functions, configure the exact names using options supported by its installed version.
Exceptions / Tradeoffs (EN)
Plain variable names are not necessarily covered by tailwindAttributes. Do not add or change company formatter configuration without task authorization; verify the formatted result on a representative file.