@plumeria/eslint-plugin 0.19.2 → 0.19.3

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.
@@ -1,211 +0,0 @@
1
- const colorNames = [
2
- 'currentColor',
3
- 'transparent',
4
- 'aliceblue',
5
- 'antiquewhite',
6
- 'aqua',
7
- 'aquamarine',
8
- 'azure',
9
- 'beige',
10
- 'bisque',
11
- 'black',
12
- 'blanchedalmond',
13
- 'blue',
14
- 'blueviolet',
15
- 'brown',
16
- 'burlywood',
17
- 'cadetblue',
18
- 'chartreuse',
19
- 'chocolate',
20
- 'coral',
21
- 'cornflowerblue',
22
- 'cornsilk',
23
- 'crimson',
24
- 'cyan',
25
- 'darkblue',
26
- 'darkcyan',
27
- 'darkgoldenrod',
28
- 'darkgray',
29
- 'darkgreen',
30
- 'darkgrey',
31
- 'darkkhaki',
32
- 'darkmagenta',
33
- 'darkolivegreen',
34
- 'darkorange',
35
- 'darkorchid',
36
- 'darkred',
37
- 'darksalmon',
38
- 'darkseagreen',
39
- 'darkslateblue',
40
- 'darkslategray',
41
- 'darkslategrey',
42
- 'darkturquoise',
43
- 'darkviolet',
44
- 'deeppink',
45
- 'deepskyblue',
46
- 'dimgray',
47
- 'dimgrey',
48
- 'dodgerblue',
49
- 'firebrick',
50
- 'floralwhite',
51
- 'forestgreen',
52
- 'fuchsia',
53
- 'gainsboro',
54
- 'ghostwhite',
55
- 'gold',
56
- 'goldenrod',
57
- 'gray',
58
- 'green',
59
- 'greenyellow',
60
- 'grey',
61
- 'honeydew',
62
- 'hotpink',
63
- 'indianred',
64
- 'indigo',
65
- 'ivory',
66
- 'khaki',
67
- 'lavender',
68
- 'lavenderblush',
69
- 'lawngreen',
70
- 'lemonchiffon',
71
- 'lightblue',
72
- 'lightcoral',
73
- 'lightcyan',
74
- 'lightgoldenrodyellow',
75
- 'lightgray',
76
- 'lightgreen',
77
- 'lightgrey',
78
- 'lightpink',
79
- 'lightsalmon',
80
- 'lightseagreen',
81
- 'lightskyblue',
82
- 'lightslategray',
83
- 'lightslategrey',
84
- 'lightsteelblue',
85
- 'lightyellow',
86
- 'lime',
87
- 'limegreen',
88
- 'linen',
89
- 'magenta',
90
- 'maroon',
91
- 'mediumaquamarine',
92
- 'mediumblue',
93
- 'mediumorchid',
94
- 'mediumpurple',
95
- 'mediumseagreen',
96
- 'mediumslateblue',
97
- 'mediumspringgreen',
98
- 'mediumturquoise',
99
- 'mediumvioletred',
100
- 'midnightblue',
101
- 'mintcream',
102
- 'mistyrose',
103
- 'moccasin',
104
- 'navajowhite',
105
- 'navy',
106
- 'oldlace',
107
- 'olive',
108
- 'olivedrab',
109
- 'orange',
110
- 'orangered',
111
- 'orchid',
112
- 'palegoldenrod',
113
- 'palegreen',
114
- 'paleturquoise',
115
- 'palevioletred',
116
- 'papayawhip',
117
- 'peachpuff',
118
- 'peru',
119
- 'pink',
120
- 'plum',
121
- 'powderblue',
122
- 'purple',
123
- 'rebeccapurple',
124
- 'red',
125
- 'rosybrown',
126
- 'royalblue',
127
- 'saddlebrown',
128
- 'salmon',
129
- 'sandybrown',
130
- 'seagreen',
131
- 'seashell',
132
- 'sienna',
133
- 'silver',
134
- 'skyblue',
135
- 'slateblue',
136
- 'slategray',
137
- 'slategrey',
138
- 'snow',
139
- 'springgreen',
140
- 'steelblue',
141
- 'tan',
142
- 'teal',
143
- 'thistle',
144
- 'tomato',
145
- 'turquoise',
146
- 'violet',
147
- 'wheat',
148
- 'white',
149
- 'whitesmoke',
150
- 'yellow',
151
- 'yellowgreen',
152
- ].join('|');
153
-
154
- // Numeric patterns (including negative numbers, decimals, and percentages)
155
- const numberPattern = '-?\\d+(?:\\.\\d+)?%?';
156
-
157
- // Percentage value pattern
158
- const percentagePattern = `${numberPattern}%`;
159
-
160
- // Pattern containing angle units
161
- const angleUnit = '(?:deg|grad|rad|turn)?';
162
- const anglePattern = `${numberPattern}${angleUnit}`;
163
-
164
- // Alpha value (transparency) pattern
165
- const alphaPattern = `(?:\\s/\\s${numberPattern}%?)?`;
166
-
167
- // Pattern for separating values (comma or space)
168
- const separator = '(?:\\s?,\\s?|\\s{1})';
169
-
170
- // Hex color code pattern
171
- const hexPattern = '#(?:[0-9a-fA-F]{3,8})';
172
-
173
- // RGB function pattern
174
- const rgbFunctionName = 'rgb(?:a)?';
175
- const rgbCommaParameters = `\\(\\s*${numberPattern}(?:\\s*,\\s*${numberPattern}){2}(?:\\s*,\\s*${numberPattern}%?)?\\s*\\)`;
176
- const rgbSpaceParameters = `\\(\\s*${numberPattern}(?:\\s+${numberPattern}){2}${alphaPattern}\\s*\\)`;
177
- const rgbPattern = `${rgbFunctionName}(?:${rgbCommaParameters}|${rgbSpaceParameters})`;
178
-
179
- // HSL function pattern
180
- const hslFunctionName = 'hsl(?:a)?';
181
- const hslCommaParameters = `\\(\\s*${anglePattern}(?:\\s*,\\s*${percentagePattern}){2}(?:\\s*,\\s*${numberPattern}%?)?\\s*\\)`;
182
- const hslSpaceParameters = `\\(\\s*${anglePattern}(?:\\s+${percentagePattern}){2}${alphaPattern}\\s*\\)`;
183
- const hslPattern = `${hslFunctionName}(?:${hslCommaParameters}|${hslSpaceParameters})`;
184
-
185
- // HWB function pattern
186
- const hwbFunctionName = 'hwb';
187
- const hwbCommaParameters = `\\(\\s*${anglePattern}(?:\\s*,\\s*${percentagePattern}){2}(?:\\s*,\\s*${numberPattern}%?)?\\s*\\)`;
188
- const hwbSpaceParameters = `\\(\\s*${anglePattern}(?:\\s+${percentagePattern}){2}${alphaPattern}\\s*\\)`;
189
- const hwbPattern = `${hwbFunctionName}(?:${hwbCommaParameters}|${hwbSpaceParameters})`;
190
-
191
- // LAB/OKLAB function pattern
192
- const labFunctionName = '(?:lab|oklab)';
193
- const labParameters = `\\(\\s*${percentagePattern}(?:\\s+${numberPattern}){2}${alphaPattern}\\s*\\)`;
194
- const labPattern = `${labFunctionName}${labParameters}`;
195
-
196
- // LCH/OKLCH function pattern
197
- const lchFunctionName = '(?:lch|oklch)';
198
- const lchParameters = `\\(\\s*${percentagePattern}(?:\\s+${numberPattern}){2}${alphaPattern}\\s*\\)`;
199
- const lchPattern = `${lchFunctionName}${lchParameters}`;
200
-
201
- // color function pattern
202
- const colorFunctionName = 'color';
203
- const colorSpaces =
204
- '(?:srgb|srgb-linear|display-p3|a98-rgb|prophoto-rgb|rec2020|rec2100-pq|rec2100-hlg|rec2100-linear|jzazbz|ictcp|xyz|xyz-d50|xyz-d65)';
205
- const colorParameters = `\\(\\s*${colorSpaces}(?:${separator}${numberPattern}){3}${alphaPattern}\\s*\\)`;
206
- const colorFunctionPattern = `${colorFunctionName}${colorParameters}`;
207
-
208
- // overall pattern of color values
209
- const colorValue = `(?:${hexPattern}|${rgbPattern}|${hslPattern}|${hwbPattern}|${labPattern}|${lchPattern}|${colorFunctionPattern}|${colorNames})`;
210
-
211
- module.exports = { colorValue };
package/lib/util/place.js DELETED
@@ -1,306 +0,0 @@
1
- const dashedIdentString = '--[a-zA-Z_][a-zA-Z0-9_-]*';
2
- const varString = `var\\(${dashedIdentString}(,\\s*[^\\)]+)?\\)`;
3
- const varRegex = new RegExp(`^${varString}$`);
4
-
5
- function getBaselinePositions() {
6
- const prefixes = ['', 'first ', 'last ', varString + ' '];
7
- return prefixes.map((prefix) => `${prefix}(baseline|${varString})`);
8
- }
9
-
10
- function getOverflowPositions() {
11
- return ['unsafe', 'safe', varString];
12
- }
13
-
14
- function getContentDistributions() {
15
- return [
16
- 'space-between',
17
- 'space-around',
18
- 'space-evenly',
19
- 'stretch',
20
- varString,
21
- ];
22
- }
23
-
24
- function getContentPositions() {
25
- return ['center', 'start', 'end', 'flex-start', 'flex-end', varString];
26
- }
27
-
28
- function getAlignContent() {
29
- const results = ['normal', varString];
30
-
31
- results.push(...getBaselinePositions());
32
- results.push(...getContentDistributions());
33
-
34
- const contentPositions = getContentPositions();
35
- const overflowPositions = getOverflowPositions();
36
-
37
- results.push(...contentPositions);
38
-
39
- overflowPositions.forEach((overflow) => {
40
- contentPositions.forEach((pos) => {
41
- results.push(`${overflow} ${pos}`);
42
- });
43
- });
44
-
45
- return results;
46
- }
47
-
48
- function getJustifyContent() {
49
- const results = ['normal', varString];
50
-
51
- results.push(...getContentDistributions());
52
-
53
- const contentPositions = getContentPositions();
54
- const overflowPositions = getOverflowPositions();
55
-
56
- results.push(...contentPositions);
57
-
58
- const positions = contentPositions.concat(['left', 'right', varString]);
59
- overflowPositions.forEach((overflow) => {
60
- positions.forEach((pos) => {
61
- results.push(`${overflow} ${pos}`);
62
- });
63
- });
64
-
65
- return results;
66
- }
67
-
68
- function generatePlaceContentPattern() {
69
- const alignContent = getAlignContent();
70
- const justifyContent = getJustifyContent();
71
-
72
- const pattern = [];
73
-
74
- alignContent.forEach((align) => {
75
- pattern.push(align);
76
- });
77
-
78
- alignContent.forEach((align) => {
79
- justifyContent.forEach((justify) => {
80
- pattern.push(`${align} ${justify}`);
81
- });
82
- });
83
-
84
- return new RegExp(`^(${pattern.join('|')})$`);
85
- }
86
-
87
- function getPositions() {
88
- return [
89
- 'center',
90
- 'start',
91
- 'end',
92
- 'self-start',
93
- 'self-end',
94
- 'flex-start',
95
- 'flex-end',
96
- varString,
97
- ];
98
- }
99
-
100
- function getAlignItems() {
101
- const results = ['normal', 'stretch', 'anchor-center', varString];
102
-
103
- results.push(...getBaselinePositions());
104
-
105
- const selfPositions = getPositions();
106
- const overflowPositions = getOverflowPositions();
107
-
108
- results.push(...selfPositions);
109
-
110
- overflowPositions.forEach((overflow) => {
111
- selfPositions.forEach((selfPos) => {
112
- results.push(`${overflow} ${selfPos}`);
113
- });
114
- });
115
-
116
- return results;
117
- }
118
-
119
- function getJustifyItems() {
120
- const results = ['normal', 'stretch', 'anchor-center', 'legacy', varString];
121
-
122
- results.push(...getBaselinePositions());
123
- results.push('legacy left', 'legacy right', 'legacy center');
124
- results.push('left', 'right');
125
-
126
- const selfPositions = getPositions();
127
- const overflowPositions = getOverflowPositions();
128
-
129
- results.push(...selfPositions);
130
-
131
- const positions = selfPositions.concat(['left', 'right', varString]);
132
- overflowPositions.forEach((overflow) => {
133
- positions.forEach((pos) => {
134
- results.push(`${overflow} ${pos}`);
135
- });
136
- });
137
-
138
- return results;
139
- }
140
-
141
- function generatePlaceItemsPattern() {
142
- const alignItems = getAlignItems();
143
- const justifyItems = getJustifyItems();
144
-
145
- const pattern = [];
146
-
147
- alignItems.forEach((align) => {
148
- pattern.push(align);
149
- });
150
-
151
- alignItems.forEach((align) => {
152
- justifyItems.forEach((justify) => {
153
- pattern.push(`${align} ${justify}`);
154
- });
155
- });
156
-
157
- return new RegExp(`^(${pattern.join('|')})$`);
158
- }
159
-
160
- function getAlignSelf() {
161
- const results = ['auto', 'normal', 'stretch', 'anchor-center', varString];
162
-
163
- results.push(...getBaselinePositions());
164
-
165
- const selfPositions = getPositions();
166
- const overflowPositions = getOverflowPositions();
167
-
168
- results.push(...selfPositions);
169
-
170
- overflowPositions.forEach((overflow) => {
171
- selfPositions.forEach((selfPos) => {
172
- results.push(`${overflow} ${selfPos}`);
173
- });
174
- });
175
-
176
- return results;
177
- }
178
-
179
- function getJustifySelf() {
180
- const results = ['auto', 'normal', 'stretch', 'anchor-center', varString];
181
-
182
- results.push(...getBaselinePositions());
183
-
184
- const selfPositions = getPositions();
185
- const overflowPositions = getOverflowPositions();
186
-
187
- results.push(...selfPositions);
188
-
189
- const positions = selfPositions.concat(['left', 'right', varString]);
190
- overflowPositions.forEach((overflow) => {
191
- positions.forEach((pos) => {
192
- results.push(`${overflow} ${pos}`);
193
- });
194
- });
195
-
196
- return results;
197
- }
198
-
199
- function generatePlaceSelfPattern() {
200
- const alignSelf = getAlignSelf();
201
- const justifySelf = getJustifySelf();
202
-
203
- const pattern = [];
204
-
205
- alignSelf.forEach((align) => {
206
- pattern.push(align);
207
- });
208
-
209
- alignSelf.forEach((align) => {
210
- justifySelf.forEach((justify) => {
211
- pattern.push(`${align} ${justify}`);
212
- });
213
- });
214
-
215
- return new RegExp(`^(${pattern.join('|')})$`);
216
- }
217
-
218
- function isValidPlaceContent(value) {
219
- const trimmedValue = value.trim();
220
- if (trimmedValue !== value) {
221
- return false;
222
- }
223
-
224
- if (varRegex.test(trimmedValue)) {
225
- return true;
226
- }
227
-
228
- const pattern = generatePlaceContentPattern();
229
- return pattern.test(trimmedValue);
230
- }
231
-
232
- function isValidPlaceItems(value) {
233
- const trimmedValue = value.trim();
234
- if (trimmedValue !== value) {
235
- return false;
236
- }
237
-
238
- if (varRegex.test(trimmedValue)) {
239
- return true;
240
- }
241
-
242
- const pattern = generatePlaceItemsPattern();
243
- return pattern.test(trimmedValue);
244
- }
245
-
246
- function isValidPlaceSelf(value) {
247
- const trimmedValue = value.trim();
248
- if (trimmedValue !== value) {
249
- return false;
250
- }
251
-
252
- if (varRegex.test(trimmedValue)) {
253
- return true;
254
- }
255
-
256
- const pattern = generatePlaceSelfPattern();
257
- return pattern.test(trimmedValue);
258
- }
259
-
260
- function isValidTouchAction(value) {
261
- const basicValues = ['auto', 'none', 'manipulation'];
262
- const panX = ['pan-x', 'pan-left', 'pan-right'];
263
- const panY = ['pan-y', 'pan-up', 'pan-down'];
264
- const pinchZoom = ['pinch-zoom'];
265
-
266
- const allValues = [...basicValues, ...panX, ...panY, ...pinchZoom];
267
- const usedValues = new Set();
268
-
269
- const trimmedValue = value.trim();
270
- if (value !== trimmedValue) {
271
- return false;
272
- }
273
-
274
- const tokens = trimmedValue.split(/\s+/);
275
-
276
- return tokens.every((token) => {
277
- if (token.startsWith('var(') && varRegex.test(token)) {
278
- return true;
279
- }
280
-
281
- if (allValues.includes(token)) {
282
- if (basicValues.includes(token)) {
283
- return tokens.length === 1;
284
- }
285
-
286
- if (panX.includes(token) && usedValues.has('pan-x')) {
287
- return false;
288
- }
289
-
290
- if (panY.includes(token) && usedValues.has('pan-y')) {
291
- return false;
292
- }
293
-
294
- return !usedValues.has(token) && usedValues.add(token);
295
- }
296
-
297
- return false;
298
- });
299
- }
300
-
301
- module.exports = {
302
- isValidPlaceContent,
303
- isValidPlaceItems,
304
- isValidPlaceSelf,
305
- isValidTouchAction,
306
- };