@plumeria/eslint-plugin 17.0.0 → 17.0.1
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/rules/validate-values.js +24 -0
- package/dist/util/validData.js +10 -1
- package/package.json +1 -1
|
@@ -520,6 +520,27 @@ function isValidTextDecorationLine(value) {
|
|
|
520
520
|
return false;
|
|
521
521
|
});
|
|
522
522
|
}
|
|
523
|
+
function isValidContain(value) {
|
|
524
|
+
const singleValues = ['none', 'strict', 'content'];
|
|
525
|
+
const sizeValues = ['size', 'inline-size'];
|
|
526
|
+
const featureValues = ['layout', 'style', 'paint'];
|
|
527
|
+
const usedValues = new Set();
|
|
528
|
+
const trimmedValue = value.trim();
|
|
529
|
+
if (value !== trimmedValue)
|
|
530
|
+
return false;
|
|
531
|
+
const tokens = trimmedValue.split(/\s+/);
|
|
532
|
+
return tokens.every((token) => {
|
|
533
|
+
if (token.startsWith('var(') && varRegex.test(token))
|
|
534
|
+
return true;
|
|
535
|
+
if (singleValues.includes(token))
|
|
536
|
+
return tokens.length === 1;
|
|
537
|
+
if (sizeValues.includes(token))
|
|
538
|
+
return !usedValues.has('size') && usedValues.add('size');
|
|
539
|
+
if (featureValues.includes(token))
|
|
540
|
+
return !usedValues.has(token) && usedValues.add(token);
|
|
541
|
+
return false;
|
|
542
|
+
});
|
|
543
|
+
}
|
|
523
544
|
function isValidFontVariantEastAsian(value) {
|
|
524
545
|
const fontVariantEastAsianRegex = new RegExp('^' +
|
|
525
546
|
`(?:jis78|jis83|jis90|jis04|simplified|traditional|full-width|proportional-width|ruby|${varString})` +
|
|
@@ -1297,6 +1318,9 @@ function getValidator(key) {
|
|
|
1297
1318
|
const r = new RegExp(`^(${urlString}|${gradientString}|${imageSetString}|${attrString}|${counterString}|${countersString}|${stringString})$`);
|
|
1298
1319
|
validator = (v) => r.test(v);
|
|
1299
1320
|
}
|
|
1321
|
+
else if (['contain'].includes(key)) {
|
|
1322
|
+
validator = isValidContain;
|
|
1323
|
+
}
|
|
1300
1324
|
else if (['columns'].includes(key)) {
|
|
1301
1325
|
const r = new RegExp(`^(?:auto\\s*(?:auto|${lvp}|${numberPattern})?|${numberPattern}\\s*(?:auto|${lvp}|${numberPattern})?|${lvp}\\s*(?:auto|${lvp}|${numberPattern})?)$`);
|
|
1302
1326
|
validator = (v) => r.test(v);
|
package/dist/util/validData.js
CHANGED
|
@@ -316,7 +316,16 @@ const validData = {
|
|
|
316
316
|
columnSpan: ['none', 'all'],
|
|
317
317
|
columnWidth: ['auto', 'max-content', 'min-content'],
|
|
318
318
|
columns: [],
|
|
319
|
-
contain: [
|
|
319
|
+
contain: [
|
|
320
|
+
'none',
|
|
321
|
+
'strict',
|
|
322
|
+
'content',
|
|
323
|
+
'size',
|
|
324
|
+
'inline-size',
|
|
325
|
+
'layout',
|
|
326
|
+
'style',
|
|
327
|
+
'paint',
|
|
328
|
+
],
|
|
320
329
|
containerType: ['size', 'inline-size', 'normal'],
|
|
321
330
|
content: [
|
|
322
331
|
'open-quote',
|