simonsmith/stylelint-selector-bem-pattern

Undefined rule plugin/selector-bem-pattern

Closed this issue · 6 comments

{
"extends": [
"stylelint-selector-bem-pattern"
],
"rules": {
"plugin/selector-bem-pattern": {
"componentName": "[A-Z]+",
"componentSelectors": {
"initial": "^\.{componentName}(?:-[a-z]+)?$",
"combined": "^\.combined-{componentName}-[a-z]+$"
},
"utilitySelectors": "^\.util-[a-z]+$"
},
}
}

My version of stylelint 7.6.0

gunnx commented

you should put 'stylelint-selector-bem-pattern' in plugins section

Yep, @konstantin24121: @gunnx has your answer.

I'm getting same error

{
	"plugins": [
		"stylelint-declaration-strict-value",
		"stylelint-selector-bem-pattern"
	],
    "rules": {
		"scale-unlimited/declaration-strict-value": [
			["/color/", "fill", "stroke"],
			{
    			ignoreKeywords: ["currentColor", "transparent", "inherit", "initial", "-moz-use-text-color"]
  			}
		],
		"selector-bem-pattern": {
      "preset": "bem",
			"utilitySelectors": "^\\.(u|l)-[a-z]+$",
      "ignoreSelectors": []
    },
		"color-hex-case": lower,
		"font-family-no-duplicate-names": true,

top part of my .stylelintrc

@jitendravyas, in rules the key needs to be "plugin/selector-bem-pattern".

Thanks for replying. No error now but I wonder why I'm not getting any error. I'm trying it on a legacy code.

my config is this

{
	"plugins": [
		"stylelint-declaration-strict-value",
		"stylelint-selector-bem-pattern",
		"stylelint-order"
	],
    "rules": {
		"scale-unlimited/declaration-strict-value": [
			["/color/", "fill", "stroke"],
			{
    			ignoreKeywords: ["currentColor", "transparent", "inherit", "initial", "-moz-use-text-color"]
  			}
		],
		"plugin/selector-bem-pattern": {
      "componentName": "[A-Z]+",
      "componentSelectors": {
        "initial": "^\\.{componentName}(?:-[a-z]+)?$",
        "combined": "^\\.combined-{componentName}-[a-z]+$"
      },
      "utilitySelectors": "^\\.util-[a-z]+$"
    },
		"order/order": [
			"custom-properties",
			"declarations"
		],

	}
}

@jitendravyas, I suggest creating a minimal test (everything not relevant to the bug, like other plugins, removed) and trying to debug from there. If you can create a minimal test that captures your bug, please open another issue about it.