ota-meshi / eslint-plugin-css

An ESLint plugin that provides rules to verify CSS definition objects.
https://ota-meshi.github.io/eslint-plugin-css/
MIT License
63 stars 3 forks source link

New rule request: `prefer-logical-properties` #166

Open ej612 opened 1 month ago

ej612 commented 1 month ago

Hi there!

Motivation In our project, we are encouraged to use logical CSS properties, i.e. properties that are compatible with languages that are read from right-to-left or even top-to-bottom.

Example: Using inline-size instead of width & margin-block-end instead of margin-bottom.

Not all devs are aware of this, and mistakes happen. It would therefore help to have a rule that throws an error (or even auto-fixes) whenever one of the physical properties is used.

There seem to be plugins that do this for a linter called "stylelint", which I've never heard of:

The latter plugin has a comprehensive Bad-vs-Good table on its readme page: https://github.com/csstools/stylelint-use-logical?tab=readme-ov-file#property-and-value-mapping

I have no experience with writing ESlint rules, so I don't know how hard this would be and if it would make sense to re-implement this for ESlint.

Thanks a lot in advance!

ota-meshi commented 1 month ago

Thank you for suggesting the rule! That rule sounds good to me!