@primer/stylelint-config 13.3.2 → 13.4.0
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/dist/index.cjs +15 -0
- package/dist/index.mjs +15 -0
- package/package.json +1 -1
- package/plugins/borders.js +14 -0
- package/plugins/lib/utils.js +1 -0
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ function primitivesVariables(type) {
|
|
|
20
20
|
break
|
|
21
21
|
case 'border':
|
|
22
22
|
files.push('functional/size/border.json');
|
|
23
|
+
files.push('functional/themes/light.json');
|
|
23
24
|
break
|
|
24
25
|
case 'typography':
|
|
25
26
|
files.push('base/typography/typography.json');
|
|
@@ -104,6 +105,7 @@ const messages$6 = ruleMessages$4(ruleName$6, {
|
|
|
104
105
|
const variables$3 = primitivesVariables('border');
|
|
105
106
|
const sizes$1 = [];
|
|
106
107
|
const radii = [];
|
|
108
|
+
const compositeBorders = [];
|
|
107
109
|
|
|
108
110
|
// Props that we want to check
|
|
109
111
|
const propList$2 = ['border', 'border-width', 'border-radius'];
|
|
@@ -130,6 +132,15 @@ for (const variable of variables$3) {
|
|
|
130
132
|
if (name.includes('borderRadius')) {
|
|
131
133
|
radii.push(variable);
|
|
132
134
|
}
|
|
135
|
+
|
|
136
|
+
// Composite border tokens (explicit allowlist approach)
|
|
137
|
+
const compositeBorderTokenNames = [
|
|
138
|
+
'--border-default',
|
|
139
|
+
// Add other known composite border tokens here as needed
|
|
140
|
+
];
|
|
141
|
+
if (compositeBorderTokenNames.includes(name)) {
|
|
142
|
+
compositeBorders.push(variable);
|
|
143
|
+
}
|
|
133
144
|
}
|
|
134
145
|
|
|
135
146
|
/** @type {import('stylelint').Rule} */
|
|
@@ -214,6 +225,10 @@ const ruleFunction$4 = primary => {
|
|
|
214
225
|
if (checkForVariable(sizes$1, node.value)) {
|
|
215
226
|
return
|
|
216
227
|
}
|
|
228
|
+
// Check for composite border variables on border shorthand
|
|
229
|
+
if (borderShorthand(prop) && checkForVariable(compositeBorders, node.value)) {
|
|
230
|
+
return
|
|
231
|
+
}
|
|
217
232
|
}
|
|
218
233
|
|
|
219
234
|
if (prop.includes('radius')) {
|
package/dist/index.mjs
CHANGED
|
@@ -17,6 +17,7 @@ function primitivesVariables(type) {
|
|
|
17
17
|
break
|
|
18
18
|
case 'border':
|
|
19
19
|
files.push('functional/size/border.json');
|
|
20
|
+
files.push('functional/themes/light.json');
|
|
20
21
|
break
|
|
21
22
|
case 'typography':
|
|
22
23
|
files.push('base/typography/typography.json');
|
|
@@ -101,6 +102,7 @@ const messages$6 = ruleMessages$4(ruleName$6, {
|
|
|
101
102
|
const variables$3 = primitivesVariables('border');
|
|
102
103
|
const sizes$1 = [];
|
|
103
104
|
const radii = [];
|
|
105
|
+
const compositeBorders = [];
|
|
104
106
|
|
|
105
107
|
// Props that we want to check
|
|
106
108
|
const propList$2 = ['border', 'border-width', 'border-radius'];
|
|
@@ -127,6 +129,15 @@ for (const variable of variables$3) {
|
|
|
127
129
|
if (name.includes('borderRadius')) {
|
|
128
130
|
radii.push(variable);
|
|
129
131
|
}
|
|
132
|
+
|
|
133
|
+
// Composite border tokens (explicit allowlist approach)
|
|
134
|
+
const compositeBorderTokenNames = [
|
|
135
|
+
'--border-default',
|
|
136
|
+
// Add other known composite border tokens here as needed
|
|
137
|
+
];
|
|
138
|
+
if (compositeBorderTokenNames.includes(name)) {
|
|
139
|
+
compositeBorders.push(variable);
|
|
140
|
+
}
|
|
130
141
|
}
|
|
131
142
|
|
|
132
143
|
/** @type {import('stylelint').Rule} */
|
|
@@ -211,6 +222,10 @@ const ruleFunction$4 = primary => {
|
|
|
211
222
|
if (checkForVariable(sizes$1, node.value)) {
|
|
212
223
|
return
|
|
213
224
|
}
|
|
225
|
+
// Check for composite border variables on border shorthand
|
|
226
|
+
if (borderShorthand(prop) && checkForVariable(compositeBorders, node.value)) {
|
|
227
|
+
return
|
|
228
|
+
}
|
|
214
229
|
}
|
|
215
230
|
|
|
216
231
|
if (prop.includes('radius')) {
|
package/package.json
CHANGED
package/plugins/borders.js
CHANGED
|
@@ -30,6 +30,7 @@ export const messages = ruleMessages(ruleName, {
|
|
|
30
30
|
const variables = primitivesVariables('border')
|
|
31
31
|
const sizes = []
|
|
32
32
|
const radii = []
|
|
33
|
+
const compositeBorders = []
|
|
33
34
|
|
|
34
35
|
// Props that we want to check
|
|
35
36
|
const propList = ['border', 'border-width', 'border-radius']
|
|
@@ -56,6 +57,15 @@ for (const variable of variables) {
|
|
|
56
57
|
if (name.includes('borderRadius')) {
|
|
57
58
|
radii.push(variable)
|
|
58
59
|
}
|
|
60
|
+
|
|
61
|
+
// Composite border tokens (explicit allowlist approach)
|
|
62
|
+
const compositeBorderTokenNames = [
|
|
63
|
+
'--border-default',
|
|
64
|
+
// Add other known composite border tokens here as needed
|
|
65
|
+
]
|
|
66
|
+
if (compositeBorderTokenNames.includes(name)) {
|
|
67
|
+
compositeBorders.push(variable)
|
|
68
|
+
}
|
|
59
69
|
}
|
|
60
70
|
|
|
61
71
|
/** @type {import('stylelint').Rule} */
|
|
@@ -140,6 +150,10 @@ const ruleFunction = primary => {
|
|
|
140
150
|
if (checkForVariable(sizes, node.value)) {
|
|
141
151
|
return
|
|
142
152
|
}
|
|
153
|
+
// Check for composite border variables on border shorthand
|
|
154
|
+
if (borderShorthand(prop) && checkForVariable(compositeBorders, node.value)) {
|
|
155
|
+
return
|
|
156
|
+
}
|
|
143
157
|
}
|
|
144
158
|
|
|
145
159
|
if (prop.includes('radius')) {
|
package/plugins/lib/utils.js
CHANGED