{"action":"created","issue":{"url":"https://api.github.com/repos/davidtheclark/stylelint-selector-bem-pattern/issues/15","repository_url":"https://api.github.com/repos/davidtheclark/stylelint-selector-bem-pattern","labels_url":"https://api.github.com/repos/davidtheclark/stylelint-selector-bem-pattern/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/davidtheclark/stylelint-selector-bem-pattern/issues/15/comments","events_url":"https://api.github.com/repos/davidtheclark/stylelint-selector-bem-pattern/issues/15/events","html_url":"https://github.com/davidtheclark/stylelint-selector-bem-pattern/issues/15","id":171825604,"number":15,"title":"componentSelectors.initial requires {componentName}","user":{"login":"rgrjoh","id":1148370,"avatar_url":"https://avatars.githubusercontent.com/u/1148370?v=3","gravatar_id":"","url":"https://api.github.com/users/rgrjoh","html_url":"https://github.com/rgrjoh","followers_url":"https://api.github.com/users/rgrjoh/followers","following_url":"https://api.github.com/users/rgrjoh/following{/other_user}","gists_url":"https://api.github.com/users/rgrjoh/gists{/gist_id}","starred_url":"https://api.github.com/users/rgrjoh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgrjoh/subscriptions","organizations_url":"https://api.github.com/users/rgrjoh/orgs","repos_url":"https://api.github.com/users/rgrjoh/repos","events_url":"https://api.github.com/users/rgrjoh/events{/privacy}","received_events_url":"https://api.github.com/users/rgrjoh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-08-18T06:15:36Z","updated_at":"2016-08-22T12:38:25Z","closed_at":null,"body":"When configuring stylelint-selector-bem-pattern via (a JSON formatted) .stylelintrc, I cannot get the initial selector to work unless it contains {componentName}. This is not the case when using postcss-bem-linter directly and configuring it via a function.\r\n\r\nThis may be an edge case, but a current use case of mine requires all selectors to be namespaced by a class selector:\r\n\r\n```\r\n.namespace .component-name {\r\n}\r\n```\r\n\r\nWith a config like this, all selectors are marked as errors:\r\n```\r\n\"plugin/selector-bem-pattern\": {\r\n\t\"componentName\": \"^[a-z0-9]+(?:-[a-z0-9]+)*$\",\r\n\t\"componentSelectors\": {\r\n\t\t\"initial\": \"^\\\\.namespace$\",\r\n\t\t\"combined\": \"^\\\\.namespace-{componentName}(?:__[a-z0-9]+(?:-[a-z0-9]+)*)?(?:--[a-z0-9]+(?:-[a-z0-9]+)*)?$\"\r\n\t}\r\n}\r\n```\r\n\r\nA workaround that seems to work is to add `({componentName})?` to the regex for initial:\r\n\r\n```\r\n\"initial\": \"^\\\\.namespace({componentName})?$\"\r\n```\r\n\r\nBut that could allow incorrect selectors to sneak through. And, like I mentioned previously, it is not necessary when using postcss-bem-linter directly (i.e. not as a stylelint plugin).\r\n\r\nIs this behaviour intentional, is it a bug, or am I missing something?"},"comment":{"url":"https://api.github.com/repos/davidtheclark/stylelint-selector-bem-pattern/issues/comments/241399833","html_url":"https://github.com/davidtheclark/stylelint-selector-bem-pattern/issues/15#issuecomment-241399833","issue_url":"https://api.github.com/repos/davidtheclark/stylelint-selector-bem-pattern/issues/15","id":241399833,"user":{"login":"simonsmith","id":360703,"avatar_url":"https://avatars.githubusercontent.com/u/360703?v=3","gravatar_id":"","url":"https://api.github.com/users/simonsmith","html_url":"https://github.com/simonsmith","followers_url":"https://api.github.com/users/simonsmith/followers","following_url":"https://api.github.com/users/simonsmith/following{/other_user}","gists_url":"https://api.github.com/users/simonsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/simonsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonsmith/subscriptions","organizations_url":"https://api.github.com/users/simonsmith/orgs","repos_url":"https://api.github.com/users/simonsmith/repos","events_url":"https://api.github.com/users/simonsmith/events{/privacy}","received_events_url":"https://api.github.com/users/simonsmith/received_events","type":"User","site_admin":false},"created_at":"2016-08-22T12:38:25Z","updated_at":"2016-08-22T12:38:25Z","body":"Maybe the more BEM-like approach would be to refactor the CSS to:\r\n\r\n```css\r\n.namespace-component-name {\r\n}\r\n```\r\n\r\nOr is that not possible?"}}
{"actor":{"display_login":"simonsmith"}}