griffel icon indicating copy to clipboard operation
griffel copied to clipboard

lint: forbid comma separated selectors in selectors

Open layershifter opened this issue 2 years ago • 2 comments

We need add a ESLint rule that will forbid :hover,:active selectors.

makeStyles({
  root: {
     // 🟢 should pass
    ":hover": { color: "red" },
    ":active": { color: "blue" },
    // 🔴 should break
    ":hover,:active": { color: "blue" },
  },
});

For context, https://github.com/microsoft/griffel/discussions/495.

layershifter avatar Jan 26 '24 12:01 layershifter

Possibly as an option, I think it would be helpful to allow comma-separated selectors only if they all include &.

makeStyles({
  root: {
     // 🟢 should pass
    "&:hover, &:active": { color: "blue" },
    // 🔴 should break
    ":hover,&:active": { color: "blue" },
  },
});

NotWoods avatar Feb 13 '24 18:02 NotWoods

Waiting for partners to enable linting, considering for H2/2024

miroslavstastny avatar Jun 03 '24 14:06 miroslavstastny