Skip to content

Commit

Permalink
fix: issue 317 test
Browse files Browse the repository at this point in the history
  • Loading branch information
francoismassart committed Mar 11, 2024
1 parent 6e3f995 commit a384e32
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rules/enforces-shorthand.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ module.exports = {
// Test if the body of the class matches, eg. 'h-' inside 'h-10'
if (mode === 'value') {
const bodyMatch = inputSet.some((inputClassPattern) => inputClassPattern === remainingClass.body);
if (mergedConfig.theme.size === undefined) {
if ([undefined, null].includes(mergedConfig.theme.size)) {
return false;
}
// w-screen + h-screen ≠ size-screen (Issue #307)
const sizeKeys = Object.keys(mergedConfig.theme.size || {});
const sizeKeys = Object.keys(mergedConfig.theme.size);
const isSize = ['w-', 'h-'].includes(remainingClass.body);
const isValidSize = sizeKeys.includes(remainingClass.value);
const wValue = mergedConfig.theme.width[remainingClass.value];
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/no-unnecessary-arbitrary-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ module.exports = {
const isNegativeValue = arbitraryValue.indexOf('-') === 0;
const configurationKey = configKeys[groupIdx];
const configuration = mergedConfig.theme[configurationKey];
if ([undefined, null].includes(configuration)) {
return false;
}
const configurationKeys = Object.keys(configuration);
const zeroValueWithOrWithoutUnitsPattern = new RegExp(validZeroRegEx, 'i');
const isZeroArbitraryValue = zeroValueWithOrWithoutUnitsPattern.test(arbitraryValue);
Expand Down
6 changes: 6 additions & 0 deletions tests/lib/rules/no-unnecessary-arbitrary-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ ruleTester.run("arbitrary-values", rule, {
`,
options: config,
},
{
code: `
<pre class="![clip:rect(0,0,0,0)]">issue #317</pre>
`,
options: config,
},
],

invalid: [
Expand Down

0 comments on commit a384e32

Please sign in to comment.