forked from react-ui-org/react-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stylelint.config.js
36 lines (36 loc) · 1.63 KB
/
stylelint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module.exports = {
extends: [
'@visionappscz/stylelint-config',
'@visionappscz/stylelint-config/order',
'@visionappscz/stylelint-config/scss',
'@visionappscz/stylelint-config/cssModules',
],
rules: {
// Check that custom property name starts with `rui` prefix and follows either SUIT CSS convention
// (for components theming) or kebab-case syntax (for global design tokens and local properties).
//
// A: mandatory prefix
// B: SUIT CSS pattern (derived from BEM pattern: https://gist.github.com/Potherca/f2a65491e63338659c3a0d2b07eee382)
// C: kebab-case pattern
// D: … with optional Sass interpolation used in generated custom properties (e.g. Button or form fields)
'custom-property-pattern': [
// ↓ A ↓ B OR ↓ C ↓ D
'^rui-(?:([A-Z]([A-Za-z0-9-]+)?((__([a-z0-9]+-?)+)+(--([a-z0-9]+-?)+){0,2})+)|(([a-z0-9]+-?)+)(#{\\$[a-z-]+})?)$',
{
message: 'Expected custom property name to start with `rui-*` and follow either SUIT CSS or kebab-case syntax',
},
],
// Require camelCase pattern for class names as they are picked up by dot notation in JS.
// Also allow kebab-case class names for global helper and utility classes.
//
// A: camelCase pattern
// B: kebab-case pattern
'selector-class-pattern': [
// ↓ A OR ↓ B
'^(?:(([a-z][a-z0-9]*)([A-Z][a-z0-9]+)*)|(([a-z0-9]+-?)+))$',
{
message: 'Expected class selector to be either camelCase (CSS Modules) or kebab-case (global classes)',
},
],
},
};