denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.84k stars 5.39k forks source link

Offer the possibility to order properties in the CSS formatter #25817

Open lowlighter opened 1 month ago

lowlighter commented 1 month ago

g-plane/malva support a declarationOrder option which would be nice if let available to end users.

I know deno fmt tries to limit the number of options by design, but I feel like this one would bring a lot of value for users using deno in web projects.

The current config of the CSS fmt is unironically a bit too lax for stylesheet collaboration, where everyone can add their new rules wherever they had their cursor last which can lead to chaotic stylesheet after many patches.

Allowing a way to enforce a stricter formatting would make the life of reviewers easier (no need to reject a PR due to formatting), contributors (with instant fmt feedback) and maintainers (cleaner and healthier codebase)

lucacasonato commented 1 month ago

As far as I am aware, prettier does not have an option for this, or do this, right?

lowlighter commented 1 month ago

not out of the box, you indeed need to use a prettier plugin to do so currently or use alternative tools like stylelint (and by extension stylelint-order)

there were concerns that it can change the css result, but this is true only if the orderer isn't aware of specificity (e.g. font should be before font-*), or if users are defining duplicate rules (which is already bad and most ide linters will complain about it)