green-code-initiative / ecoCode-javascript

Reduce the environmental footprint of your JS/TS software programs
https://ecocode.io
GNU General Public License v3.0
18 stars 17 forks source link

add rule prefer-shorthand-css-notations #20

Closed elisecodedestrucs closed 1 year ago

elisecodedestrucs commented 1 year ago

add a rule that aims to reduce stylesheet size by using shorthand css notations

elisecodedestrucs commented 1 year ago

Thank you for the rule @elisecodedestrucs! I have a question: in the proposed solution, it's not possible to have "margin-top" or a "padding-bottom" alone, for example? (a warning will be raised) I don't think it's bad practice to specify just one of the margins/borders using the dedicated rule. What do you think of this?

We agree the rule might have been a little too restrictive, to fix this we've sepparated it between five rules that each cover a few css properties we considered fairly related, the goal is to be able to unable one or some rules if they turn out to be inadapted we've also tried to tailor the rule's comportment to the possibilities of each shorthand notation