stylelint-config-crisp 1.0.28 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-config-crisp",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Custom Stylelint Rules for Crisp",
5
5
  "author": "Crisp IM SAS",
6
6
  "main": "index.js",
@@ -70,7 +70,19 @@ const ruleFunction = (primaryOption, secondaryOptions = {}, context) => {
70
70
 
71
71
  // Convert a string to kebab-case
72
72
  function toKebabCase(str) {
73
- return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/\s+/g, "-").toLowerCase();
73
+ // Special kebab-case flavor:
74
+ // * `CheckFailures` gets converted to `check-failures`
75
+ // * `CheckSMTPFailures` gets converted to `check-smtp-failures`
76
+ return str
77
+ // Insert a hyphen between lowercase to uppercase transitions and before \
78
+ // a sequence of uppercase letters if followed by lowercase
79
+ .replace(/([a-z])([A-Z])/g, "$1-$2")
80
+ .replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2")
81
+ // Replace spaces and multiple hyphens with a single hyphen
82
+ .replace(/\s+/g, '-')
83
+ .replace(/-+/g, '-')
84
+ // Convert to lowercase
85
+ .toLowerCase();
74
86
  }
75
87
 
76
88
  // Check if a value is a string