According to the documentation of stylelint you can use selector-class-pattern with the kebab-case pattern ^([a-z][a-z]*)(-[a-z]+)*$
. This pattern allows only lower case letters and dashes between those letters. If you want to allow also digits you can use this one ^([a-z][a-z0-9]*)(-[a-z0-9]+)*$
with every alphanumeric group starting with a letter.
You can also have a look at resolveNestedSelectors option of selector-class-pattern
if you need it.
You can use it in your stylelint-config.json
file somehow like this,
"selector-class-pattern": ["^([a-z][a-z]*)(-[a-z]+)*$", {
"resolveNestedSelectors": false
}
or just,
"selector-class-pattern": "^([a-z][a-z]*)(-[a-z]+)*$"
I hope it helped :)
EDIT: According to this article, for integrating with angular build, in your package.json you can make your scripts look like this:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "npm run lint && ng build",
"test": "ng test",
"lint": "ng lint && npm run lint:styles",
"lint:styles": "stylelint \"apps/**/*.scss\" && stylelint \"libs/**/*.scss\"",
"e2e": "ng e2e"
},