Last active
May 26, 2016 06:27
-
-
Save frontendbeast/0034b7697cc9831c693d to your computer and use it in GitHub Desktop.
Namespaced, hyphenated BEM covention regex for SCSS-Lint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
linters: | |
SelectorFormat: | |
convention: ^(_)?[a-z]+-[a-z0-9-]+((_{2}|-{2})?[a-z0-9-]+)?(-{2}[a-z0-9-]+)?[a-z0-9]$ | |
convention_explanation: 'should be written in namespaced, hyphenated BEM format' | |
ignored_types: [element] |
Just to mention — this regex won't accept following selectors:
test
test-m
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SCSS-Lint config for namespaced, hyphenated BEM format. The regex is taken from Harry Roberts' post More transparent UI code with namespaces. SCSS-Lint validates against the selector, so the period requirement has been removed from the regex.
The
convention_explanation
option requires v0.37.0 or greater.