Closed MrHaila closed 4 weeks ago
Is this a duplicate of https://github.com/prettier/plugin-pug/issues/167?
I believe these are bugs in #203 that partially implemented #167 so not a direct duplicate.
Fully completing #167 would mean adding a new option. This issue highlights bugs in the already existing option that were not covered by tests.
You could either extend the tests in https://github.com/prettier/plugin-pug/tree/main/tests/options/pugClassNotation or add a new test in https://github.com/prettier/plugin-pug/tree/main/tests/issues in a new folder issue-508
Plugin Version
3.1.0
Prettier Version
3.3.3
Which frameworks are affected?
Node Version
20.17.0
Which operating systems have you used?
Prettier config
Input
Output or Error
Expected Output
Additional Context
My workaround for this issue was to first use the option that refactors all class literals to the beginning and only then enable this class attribute option.
This is easy to repro by expanding the
pugClassNotation
test with the above code.The offending code is easy to spot at the beginning of the private
class
function inprinter.ts,
but it's not immediately clear to me why that code works in the first place (do multiple chained attributes get merged by some follow-up logic?) or how to fix it properly. I'll open a PR if I can puzzle it out 🤷♂️My verbosely commented version of the code that needs fixing: