@plumeria/eslint-plugin 0.2.4 → 0.2.6
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/lib/rules/no-destructure.js +2 -2
- package/lib/rules/validate-values.js +10 -9
- package/package.json +1 -1
- package/readme.md +1 -1
|
@@ -10,7 +10,7 @@ module.exports = {
|
|
|
10
10
|
meta: {
|
|
11
11
|
type: 'problem',
|
|
12
12
|
docs: {
|
|
13
|
-
description: 'Disallow destructuring css.
|
|
13
|
+
description: 'Disallow destructuring css.props and css.global',
|
|
14
14
|
recommended: true,
|
|
15
15
|
},
|
|
16
16
|
messages: {
|
|
@@ -30,7 +30,7 @@ module.exports = {
|
|
|
30
30
|
node.init &&
|
|
31
31
|
isCssIdentifier(node.init)
|
|
32
32
|
) {
|
|
33
|
-
const forbiddenKeys = ['
|
|
33
|
+
const forbiddenKeys = ['props', 'global'];
|
|
34
34
|
const violated = node.id.properties.filter(
|
|
35
35
|
(prop) =>
|
|
36
36
|
prop.type === 'Property' &&
|
|
@@ -129,7 +129,8 @@ const calcString = 'calc\\(.*?\\)';
|
|
|
129
129
|
const anchorString = 'anchor\\([^()]*\\)';
|
|
130
130
|
const anchorSizeString = 'anchor-size\\([^()]*\\)';
|
|
131
131
|
const clampString = 'clamp\\([^()]*\\)';
|
|
132
|
-
const
|
|
132
|
+
const gradientString =
|
|
133
|
+
'(?:repeating-)?(?:linear|radial|conic)-gradient\\(.*\\)';
|
|
133
134
|
const urlString = 'url\\([^\\)]+\\)';
|
|
134
135
|
const imageSetString = 'image-set\\([^\\)]+\\)';
|
|
135
136
|
const attrString = 'attr\\([^\\)]+\\)';
|
|
@@ -169,7 +170,7 @@ const colorRegex = new RegExp(
|
|
|
169
170
|
);
|
|
170
171
|
const colorSource = colorRegex.source.slice(1, -1);
|
|
171
172
|
|
|
172
|
-
const imageRegex = new RegExp(`^(${
|
|
173
|
+
const imageRegex = new RegExp(`^(${gradientString}|${urlString})$`);
|
|
173
174
|
const urlRegex = new RegExp(`^(${urlString})$`);
|
|
174
175
|
|
|
175
176
|
const sliceValuePattern =
|
|
@@ -672,7 +673,7 @@ module.exports = {
|
|
|
672
673
|
);
|
|
673
674
|
|
|
674
675
|
const backgroundImageRegex = new RegExp(
|
|
675
|
-
`^(${
|
|
676
|
+
`^(${gradientString}|${urlString}|${varString}|none)(\\s*,\\s*(${gradientString}|${urlString}|${varString}|none))*$`,
|
|
676
677
|
);
|
|
677
678
|
const backgroundImageProperties = ['backgroundImage'];
|
|
678
679
|
|
|
@@ -690,7 +691,7 @@ module.exports = {
|
|
|
690
691
|
const positionKeyword = `top|bottom|center|left|right|${varString}`;
|
|
691
692
|
const sizeKeyword = 'cover|contain';
|
|
692
693
|
|
|
693
|
-
const urlPattern = `(?:${urlString}|${
|
|
694
|
+
const urlPattern = `(?:${urlString}|${gradientString}|${varString}\\s*)?`;
|
|
694
695
|
const positionPattern = `(?:${positionKeyword})(?:\\s+${positionKeyword})?`;
|
|
695
696
|
const singleValuePattern = `(${lengthValuePattern})( (?!\\s)(${lengthValuePattern})){0,2}?`;
|
|
696
697
|
const sizePattern = `(?:\\s*/\\s*(?:${sizeKeyword}|${singleValuePattern}))?`;
|
|
@@ -998,7 +999,7 @@ module.exports = {
|
|
|
998
999
|
const columnsProperties = ['columns'];
|
|
999
1000
|
|
|
1000
1001
|
const contentValueRegex = new RegExp(
|
|
1001
|
-
`^(${urlString}|${
|
|
1002
|
+
`^(${urlString}|${gradientString}|${imageSetString}|${attrString}|${counterString}|${countersString}|${stringString})$`,
|
|
1002
1003
|
);
|
|
1003
1004
|
|
|
1004
1005
|
const contentProperty = ['content'];
|
|
@@ -1630,7 +1631,7 @@ module.exports = {
|
|
|
1630
1631
|
);
|
|
1631
1632
|
|
|
1632
1633
|
const maskBorderRegex = new RegExp(
|
|
1633
|
-
`^(?:${
|
|
1634
|
+
`^(?:${gradientString}|${urlString})` +
|
|
1634
1635
|
`(?:\\s+${maskBorderSliceSource})?` +
|
|
1635
1636
|
`(?:\\s?/\\s?${maskBorderWidthSource})?` +
|
|
1636
1637
|
`(?:\\s?/\\s?${maskBorderOutsetSource})?` +
|
|
@@ -1696,7 +1697,7 @@ module.exports = {
|
|
|
1696
1697
|
const bgSizePair = `(${bgSize})( (?!\\s)(${bgSize})){0,1}?`;
|
|
1697
1698
|
|
|
1698
1699
|
const maskLayerRegex =
|
|
1699
|
-
`(?:${
|
|
1700
|
+
`(?:${gradientString}|${urlString})` +
|
|
1700
1701
|
`(?:\\s+${positionPair})?` +
|
|
1701
1702
|
`(?:\\s?/\\s?${bgSizePair})?` +
|
|
1702
1703
|
`(?:\\s+${backgroundRepeatSource})?` +
|
|
@@ -1824,13 +1825,13 @@ module.exports = {
|
|
|
1824
1825
|
`^(?:` +
|
|
1825
1826
|
`(?:${outsideShape}(?:\\s+${shapeVisualBox})?)|` +
|
|
1826
1827
|
`(?:${shapeVisualBox}(?:\\s+${outsideShape})?)|` +
|
|
1827
|
-
`${
|
|
1828
|
+
`${gradientString}|${urlString}|${varString}` +
|
|
1828
1829
|
`)$`,
|
|
1829
1830
|
);
|
|
1830
1831
|
const shapeOutsideProperties = ['shapeOutside'];
|
|
1831
1832
|
|
|
1832
1833
|
const strokeRegex = new RegExp(
|
|
1833
|
-
`^${
|
|
1834
|
+
`^${gradientString}|${urlString}|${colorSource}$`,
|
|
1834
1835
|
);
|
|
1835
1836
|
const strokeProperties = ['stroke'];
|
|
1836
1837
|
|
package/package.json
CHANGED