@plumeria/eslint-plugin 0.21.4 → 0.21.5
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.
|
@@ -24,8 +24,6 @@ exports.noUnusedKeys = createRule({
|
|
|
24
24
|
if (filename.endsWith('.ts')) {
|
|
25
25
|
return {};
|
|
26
26
|
}
|
|
27
|
-
const parserServices = context.parserServices;
|
|
28
|
-
const checker = parserServices?.program?.getTypeChecker();
|
|
29
27
|
const definedKeys = new Map();
|
|
30
28
|
const referencedKeys = new Set();
|
|
31
29
|
return {
|
|
@@ -59,13 +57,6 @@ exports.noUnusedKeys = createRule({
|
|
|
59
57
|
node.property.type === 'Identifier') {
|
|
60
58
|
const normalKey = `${node.object.name}.${node.property.name}`;
|
|
61
59
|
referencedKeys.add(normalKey);
|
|
62
|
-
if (parserServices && checker) {
|
|
63
|
-
const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);
|
|
64
|
-
const symbol = checker.getSymbolAtLocation(tsNode);
|
|
65
|
-
if (symbol) {
|
|
66
|
-
referencedKeys.add(normalKey);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
60
|
}
|
|
70
61
|
},
|
|
71
62
|
'Program:exit'() {
|
|
@@ -8,9 +8,6 @@ function getSourceCode(context) {
|
|
|
8
8
|
return context.getSourceCode ? context.getSourceCode() : context.sourceCode;
|
|
9
9
|
}
|
|
10
10
|
function getPropertyName(property) {
|
|
11
|
-
if (property.key.type === 'Literal' && Array.isArray(property.key.value)) {
|
|
12
|
-
return property.key.value;
|
|
13
|
-
}
|
|
14
11
|
if (property.key.type === 'Identifier') {
|
|
15
12
|
return property.key.name;
|
|
16
13
|
}
|
|
@@ -19,11 +16,8 @@ function getPropertyName(property) {
|
|
|
19
16
|
}
|
|
20
17
|
return '';
|
|
21
18
|
}
|
|
22
|
-
function getPropertyIndex(property, isTopLevel
|
|
19
|
+
function getPropertyIndex(property, isTopLevel) {
|
|
23
20
|
const name = getPropertyName(property);
|
|
24
|
-
if (Array.isArray(name)) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
21
|
if (isTopLevel) {
|
|
28
22
|
return null;
|
|
29
23
|
}
|
|
@@ -92,14 +86,6 @@ exports.sortProperties = createRule({
|
|
|
92
86
|
fix(fixer) {
|
|
93
87
|
const newText = sorted
|
|
94
88
|
.map((p) => {
|
|
95
|
-
const propName = getPropertyName(p);
|
|
96
|
-
if (Array.isArray(propName)) {
|
|
97
|
-
const arrayKey = sourceCode.getText(p.key);
|
|
98
|
-
const arrayContent = p.value.properties
|
|
99
|
-
.map((inner) => `${indent} ${sourceCode.getText(inner)}`)
|
|
100
|
-
.join(`,${lineEnding}`);
|
|
101
|
-
return `${indent}${arrayKey}: {\n${arrayContent}\n${indent}}`;
|
|
102
|
-
}
|
|
103
89
|
return `${indent}${sourceCode.getText(p)}`;
|
|
104
90
|
})
|
|
105
91
|
.join(`,${lineEnding}`);
|
|
@@ -524,15 +524,16 @@ exports.validateValues = createRule({
|
|
|
524
524
|
'height',
|
|
525
525
|
'maxHeight',
|
|
526
526
|
'minHeight',
|
|
527
|
+
'flexBasis',
|
|
527
528
|
'blockSize',
|
|
528
529
|
'columnWidth',
|
|
529
|
-
'flexBasis',
|
|
530
530
|
'inlineSize',
|
|
531
531
|
];
|
|
532
|
+
const isFitContent = isFitContentGroup.includes(key);
|
|
532
533
|
const isLengthPercentage = lengthPercentage.includes(key);
|
|
533
534
|
const lengthValuePattern = `${lengthPattern}` +
|
|
534
535
|
(isLengthPercentage ? `|${percentagePattern}` : '') +
|
|
535
|
-
(
|
|
536
|
+
(isFitContent ? `|${fitContentString}` : '') +
|
|
536
537
|
(isNumber ? `|${numberPattern}` : '') +
|
|
537
538
|
(isAuto ? `|auto` : '') +
|
|
538
539
|
(isBorderWidth ? '|thin|medium|thick' : '') +
|
|
@@ -847,10 +848,6 @@ exports.validateValues = createRule({
|
|
|
847
848
|
return false;
|
|
848
849
|
}
|
|
849
850
|
const parts = value.split(/\s*,\s*/);
|
|
850
|
-
const lastPart = parts[parts.length - 1];
|
|
851
|
-
const isFallbackCursor = standalonePattern.test(lastPart);
|
|
852
|
-
if (!isFallbackCursor)
|
|
853
|
-
return false;
|
|
854
851
|
const urlParts = parts.slice(0, -1);
|
|
855
852
|
return urlParts.every((part) => {
|
|
856
853
|
const urlRegex = new RegExp(`^${urlWithHotspotRegex}$`);
|
|
@@ -885,7 +882,6 @@ exports.validateValues = createRule({
|
|
|
885
882
|
}
|
|
886
883
|
return new RegExp(`^(${lengthValuePattern}|auto)$`).test(parts[2]);
|
|
887
884
|
}
|
|
888
|
-
return false;
|
|
889
885
|
}
|
|
890
886
|
const flexProperty = ['flex'];
|
|
891
887
|
const tagA_E = [
|
|
@@ -1068,7 +1064,6 @@ exports.validateValues = createRule({
|
|
|
1068
1064
|
}
|
|
1069
1065
|
return new RegExp(`^(${numberPattern})$`).test(parts[1]);
|
|
1070
1066
|
}
|
|
1071
|
-
return false;
|
|
1072
1067
|
}
|
|
1073
1068
|
const fontSizeAdjustProperties = ['fontSizeAdjust'];
|
|
1074
1069
|
const fontStretchProperties = ['fontStretch'];
|
|
@@ -1221,8 +1216,6 @@ exports.validateValues = createRule({
|
|
|
1221
1216
|
'gridTemplateRows',
|
|
1222
1217
|
];
|
|
1223
1218
|
const isValidateGridTemplate = (value) => {
|
|
1224
|
-
if (typeof value !== 'string')
|
|
1225
|
-
return false;
|
|
1226
1219
|
const gridAreaRowPattern = `(?:${lineNamesPattern}\\s+)?` +
|
|
1227
1220
|
`(?:${stringString}|${varString})` +
|
|
1228
1221
|
`(?:\\s+(?:${templateTrackListPattern}))?` +
|
|
@@ -1323,7 +1316,7 @@ exports.validateValues = createRule({
|
|
|
1323
1316
|
const maskProperties = ['mask'];
|
|
1324
1317
|
const mathDepthRegex = new RegExp(`^(${addString}|${integerPattern})$`);
|
|
1325
1318
|
const mathDepthProperties = ['mathDepth'];
|
|
1326
|
-
const lengthPositionRegex = new RegExp(`^(${lengthValuePattern}|${positionKeyword})( (?!\\s)(${lengthValuePattern}|${positionKeyword})){0,3}$`);
|
|
1319
|
+
const lengthPositionRegex = new RegExp(`^(${lengthValuePattern}|${percentagePattern}|${positionKeyword})( (?!\\s)(${lengthValuePattern}|${percentagePattern}|${positionKeyword})){0,3}$`);
|
|
1327
1320
|
const lengthPositionProperties = [
|
|
1328
1321
|
'objectPosition',
|
|
1329
1322
|
'offsetAnchor',
|
|
@@ -1471,8 +1464,7 @@ exports.validateValues = createRule({
|
|
|
1471
1464
|
const emphasisStyleKeyword = `dot|circle|double-circle|triangle|sesame|${varString}`;
|
|
1472
1465
|
const textEmphasisStyleRegex = new RegExp(`^(((?:${filledOpen})(?:\\s+(?:${emphasisStyleKeyword})))?|${stringString}?)$`);
|
|
1473
1466
|
const textEmphasisStyleProperties = ['textEmphasisStyle'];
|
|
1474
|
-
const
|
|
1475
|
-
const textEmphasisRegex = new RegExp(`^(${textEmphasisStyleSource})(\\s(${colorSource}))?$`);
|
|
1467
|
+
const textEmphasisRegex = new RegExp(`^(((?:${filledOpen})(?:\\s+(?:${emphasisStyleKeyword}|${colorSource})))?|${stringString}?)$`);
|
|
1476
1468
|
const textEmphasisProperties = ['textEmphasis'];
|
|
1477
1469
|
const transformValue = `(${lengthValuePattern}|left|center|right|top|bottom)`;
|
|
1478
1470
|
const transformOriginRegex = new RegExp(`^(${transformValue})(\\s(${transformValue}))?(\\s(${transformValue}))?$`);
|
package/dist/util/validData.js
CHANGED
|
@@ -152,7 +152,7 @@ const validData = {
|
|
|
152
152
|
'no-repeat',
|
|
153
153
|
],
|
|
154
154
|
backgroundSize: ['auto', 'cover', 'contain'],
|
|
155
|
-
blockSize: ['auto'],
|
|
155
|
+
blockSize: ['auto', ...lengthSubValues],
|
|
156
156
|
boxDecorationBreak: ['slice', 'clone'],
|
|
157
157
|
boxShadow: [],
|
|
158
158
|
boxSizing: ['content-box', 'border-box'],
|
|
@@ -282,7 +282,7 @@ const validData = {
|
|
|
282
282
|
columnRuleStyle: [...lineStyle],
|
|
283
283
|
columnRuleWidth: [],
|
|
284
284
|
columnSpan: ['none', 'all'],
|
|
285
|
-
columnWidth: ['auto'],
|
|
285
|
+
columnWidth: ['auto', 'max-content', 'min-content'],
|
|
286
286
|
columns: [],
|
|
287
287
|
content: [
|
|
288
288
|
'open-quote',
|
|
@@ -438,7 +438,7 @@ const validData = {
|
|
|
438
438
|
'pixelated',
|
|
439
439
|
],
|
|
440
440
|
initialLetter: ['normal'],
|
|
441
|
-
inlineSize: ['auto'],
|
|
441
|
+
inlineSize: ['auto', ...lengthSubValues],
|
|
442
442
|
insetBlock: ['auto'],
|
|
443
443
|
insetBlockEnd: ['auto'],
|
|
444
444
|
insetBlockStart: ['auto'],
|
|
@@ -527,7 +527,7 @@ const validData = {
|
|
|
527
527
|
maskMode: ['alpha', 'luminance', 'match-source'],
|
|
528
528
|
maskOrigin: [],
|
|
529
529
|
maskPosition: ['top', 'bottom', 'left', 'right', 'center'],
|
|
530
|
-
maskRepeat: [],
|
|
530
|
+
maskRepeat: ['repeat-x', 'repeat-y', 'repeat', 'space', 'round', 'no-repeat'],
|
|
531
531
|
maskSize: ['cover', 'contain'],
|
|
532
532
|
maskType: ['luminance', 'alpha'],
|
|
533
533
|
mathDepth: ['auto-add'],
|
|
@@ -666,7 +666,7 @@ const validData = {
|
|
|
666
666
|
scrollbarGutter: ['auto', 'stable', 'stable both-edges'],
|
|
667
667
|
scrollbarWidth: ['none', 'auto', 'thin'],
|
|
668
668
|
shapeImageThreshold: [],
|
|
669
|
-
|
|
669
|
+
shapeOutside: ['none'],
|
|
670
670
|
shapeRendering: ['auto', 'optimizeSpeed', 'crispEdges', 'geometricPrecision'],
|
|
671
671
|
stopColor: [],
|
|
672
672
|
stopOpacity: [],
|