3

This is regarding stylelint.

I am looking for a solution to blacklist use of specific selectors like

html[dir="rtl"]
{
    //some css
}

There is a rule to block specific property Link.

But there is no rule to block use of particular selector.

Is there any way I can tweak previous available rule to blacklist above selector??

Thanks

ankitd
  • 1,967
  • 3
  • 26
  • 44

2 Answers2

1

It is not possible to configure existing rules to achieve what you want.

However, I believe you have two choices to resolve this:

  1. Create an issue and request this feature. I think there is a good case to add something like a selector-blacklist rule and a selector-whitelist rule to stylelint.
  2. Write your own stylelint plugin to disallow this specific selector.
jeddy3
  • 3,451
  • 1
  • 12
  • 21
0

It's unclear what exactly are you trying to disallow. All Tags selectors? All Attributes selectors for the html tag specifically? All attributes selectors completely?

You can use this rule, if you want to specifically not allow the [dir] selector (see demo):

"selector-attribute-name-disallowed-list": "dir",
vsync
  • 118,978
  • 58
  • 307
  • 400