stylelint-config-crisp 1.0.29 → 1.0.30

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.29",
3
+ "version": "1.0.30",
4
4
  "description": "Custom Stylelint Rules for Crisp",
5
5
  "author": "Crisp IM SAS",
6
6
  "main": "index.js",
@@ -73,11 +73,25 @@ function toKebabCase(str) {
73
73
  // Special kebab-case flavor:
74
74
  // * `CheckFailures` gets converted to `check-failures`
75
75
  // * `CheckSMTPFailures` gets converted to `check-smtp-failures`
76
+ // * `CheckIPsFailures` gets converted to `check-ips-failures`
77
+ // * `MonitoringMailerIPs` gets converted to `monitoring-mailer-ips`
78
+
76
79
  return str
77
- // Insert a hyphen between lowercase to uppercase transitions and before \
78
- // a sequence of uppercase letters if followed by lowercase
80
+ // Handle the transition from multiple uppercase letters to one or \
81
+ // multiple lowercase letters
82
+ .replace(/([A-Z]+)([A-Z]+[a-z]+|(?![a-z]))/g, (match, p1, p2) => {
83
+ // Only one lowercase letter?
84
+ if (p2.length === 2 && /[a-z]/.test(p2.slice(1))) {
85
+ // Make one group (this ensures `IPs` gets converted to `ips` \
86
+ // and not `i-ps`)
87
+ return `${p1}${p2}`;
88
+ }
89
+
90
+ // Make two different groups
91
+ return `${p1}-${p2}`;
92
+ })
93
+ // Insert a hyphen between lowercase to uppercase transitions
79
94
  .replace(/([a-z])([A-Z])/g, "$1-$2")
80
- .replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2")
81
95
  // Replace spaces and multiple hyphens with a single hyphen
82
96
  .replace(/\s+/g, '-')
83
97
  .replace(/-+/g, '-')