Skip to content

Commit a384e32

Browse files
fix: issue 317 test
1 parent 6e3f995 commit a384e32

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

lib/rules/enforces-shorthand.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ module.exports = {
244244
// Test if the body of the class matches, eg. 'h-' inside 'h-10'
245245
if (mode === 'value') {
246246
const bodyMatch = inputSet.some((inputClassPattern) => inputClassPattern === remainingClass.body);
247-
if (mergedConfig.theme.size === undefined) {
247+
if ([undefined, null].includes(mergedConfig.theme.size)) {
248248
return false;
249249
}
250250
// w-screen + h-screen ≠ size-screen (Issue #307)
251-
const sizeKeys = Object.keys(mergedConfig.theme.size || {});
251+
const sizeKeys = Object.keys(mergedConfig.theme.size);
252252
const isSize = ['w-', 'h-'].includes(remainingClass.body);
253253
const isValidSize = sizeKeys.includes(remainingClass.value);
254254
const wValue = mergedConfig.theme.width[remainingClass.value];

lib/rules/no-unnecessary-arbitrary-value.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ module.exports = {
194194
const isNegativeValue = arbitraryValue.indexOf('-') === 0;
195195
const configurationKey = configKeys[groupIdx];
196196
const configuration = mergedConfig.theme[configurationKey];
197+
if ([undefined, null].includes(configuration)) {
198+
return false;
199+
}
197200
const configurationKeys = Object.keys(configuration);
198201
const zeroValueWithOrWithoutUnitsPattern = new RegExp(validZeroRegEx, 'i');
199202
const isZeroArbitraryValue = zeroValueWithOrWithoutUnitsPattern.test(arbitraryValue);

tests/lib/rules/no-unnecessary-arbitrary-value.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ ruleTester.run("arbitrary-values", rule, {
6868
`,
6969
options: config,
7070
},
71+
{
72+
code: `
73+
<pre class="![clip:rect(0,0,0,0)]">issue #317</pre>
74+
`,
75+
options: config,
76+
},
7177
],
7278

7379
invalid: [

0 commit comments

Comments
 (0)