stylelint icon indicating copy to clipboard operation
stylelint copied to clipboard

Add max-selectors

Open Mouvedia opened this issue 3 years ago • 3 comments

What is the problem you're trying to solve?

limit the number of selectors allowed per file e.g. IE ≤9 had a 4095 hard limit

see

  • bless
  • webhint
  • reports in the wild
    • https://stackoverflow.com/q/20828995/248058
    • https://github.com/clean-css/clean-css/issues/916

What solution would you like to see?

error out if it reaches the limit

  • Name: max-selectors or max-selectors-per-file
  • Primary option: int
  • Secondary options: none
  • Message: TBD
  • Description: TBD
  • Section: "Limit language features" -> "General / Sheet"

Mouvedia avatar Aug 21 '22 01:08 Mouvedia

@Mouvedia Thanks for the proposal.

Umm... According to the guideline for built-in rules, I don't think the proposed rule is "generally useful; not tied to idiosyncratic patterns". 🤔

Without depending on specific environments like IE9, is there a case reasonable to add the new rule?

ybiquitous avatar Aug 21 '22 02:08 ybiquitous

Without depending on specific environments like IE9, is there a case reasonable to add the new rule?

Chrome and Safari are also affected :

I didn't check Firefox but I am sure they also have their own limits.

Mouvedia avatar Aug 21 '22 10:08 Mouvedia

@Mouvedia Thanks for the suggestion. Considering this hasn't been requested before I think we can assume it's not a limitation that the majority of our users have bumped into. However, we can leave the issue open to see if it garners any thumbs up. In the meantime, you can write a plugin. It'll be easy to port the plugin to be a built-in rule later down the line if necessary.

jeddy3 avatar Aug 21 '22 12:08 jeddy3