microsoft / griffel

CSS-in-JS with ahead-of-time compilation ⚡️
https://griffel.js.org
MIT License
1.2k stars 61 forks source link

eslint-plugin: add no-unnecesary-shorthands rule #507

Closed Hotell closed 6 months ago

Hotell commented 9 months ago

based on https://github.com/microsoft/fluentui/pull/30544#discussion_r1489301282

Feature:

introduce a new rule named lets say no-unnecesary-shorthands which would implement autofixer as well.

This rule should have severity warn and it should identify unnecessary shorthand usage within codebase

Input:

const useStyles = makeResetStyles({
  ...shorthands.border('none'),
  ...shorthands.padding(0),
})

Output:

const useStyles = makeResetStyles({
  border: 'none',
  padding: 0,
})
layershifter commented 6 months ago

As CSS shorthands are supported now as the most of shorthands.*() functions have been deprecated - IMO we don't need such rule anymore.