Stylelint: selector-attribute-operator-blacklist: only blacklists first element in array.

Created on 14 Jul 2016  Â·  3Comments  Â·  Source: stylelint/stylelint

BUG: selector-attribute-operator-blacklist:

when configuring "selector-attribute-operator-blacklist": ["*=","~=","|=","^="],only the first token"*=" is blacklisted. Other tokens are let through. i.e:

This is considered an error:

[title*='t1'] {
  border: 5px solid #FFF;
}

The following are legal with this configuration:

[class^='t2'] {
  background: #FFF;
}

[class|='t3'] {
  background: #FFF;
}

.stylelintrc:

{
  "extends": "stylelint-config-standard",
  "rules": {
    "selector-attribute-operator-blacklist": ["*=","~=","|=","^="],
  }
}

stylelint version: 7.0.1
stylelint-config-standard version: 11.0.0

Expected

npm run lint
 xx:x  ✖  Unexpected operator "*="           selector-attribute-operator-blacklist
 xx:x  ✖  Unexpected operator "^="           selector-attribute-operator-blacklist
 xx:x  ✖  Unexpected operator "|="           selector-attribute-operator-blacklist

Got

npm run lint
 xx:x  ✖  Unexpected operator "*="           selector-attribute-operator-blacklist
ready to implement bug

Most helpful comment

@rosven Thanks, today i fixed this.

All 3 comments

@rosven Thanks, today i fixed this.

@jeddy3 very strange behavior.
Work fine:

"unit-blacklist": ["px", "em", "deg"]

But

"selector-attribute-operator-blacklist": ["*=","~=","|=","^="],

give only first item.

"selector-attribute-operator-blacklist": [["*=","~=","|=","^="]],

Works fine.

Some rules not have rule.primaryOptionArray = true, but accepting primary option array i create PR, but it is breaking changes :(

Was this page helpful?
0 / 5 - 0 ratings