@blumintinc/eslint-plugin-blumint 1.20.101 → 1.20.102
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/index.js +1 -1
- package/lib/rules/ensure-pointer-events-none.js +49 -7
- package/package.json +1 -1
- package/release-manifest.json +14 -0
package/lib/index.js
CHANGED
|
@@ -25,8 +25,19 @@ function isPointerEventsProperty(propertyName) {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* The inset offsets that position a pseudo-element relative to its origin box.
|
|
28
|
+
* The `inset` shorthand and its logical-property spellings carry the same sign
|
|
29
|
+
* semantics as the longhands, so an overlay must not change verdict on spelling
|
|
30
|
+
* alone.
|
|
28
31
|
*/
|
|
29
|
-
const INSET_PROPERTIES = new Set([
|
|
32
|
+
const INSET_PROPERTIES = new Set([
|
|
33
|
+
'top',
|
|
34
|
+
'right',
|
|
35
|
+
'bottom',
|
|
36
|
+
'left',
|
|
37
|
+
'inset',
|
|
38
|
+
'insetInline',
|
|
39
|
+
'insetBlock',
|
|
40
|
+
]);
|
|
30
41
|
/**
|
|
31
42
|
* Classifies the sign of a leading numeric length in a string offset value
|
|
32
43
|
* (e.g. '-6px' -> negative, '0'/'0px' -> zero, '6px' -> positive). Anything
|
|
@@ -42,11 +53,34 @@ function classifyOffsetString(raw) {
|
|
|
42
53
|
return match[1] === '-' ? 'negative' : 'positive';
|
|
43
54
|
}
|
|
44
55
|
/**
|
|
45
|
-
* Classifies
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
|
|
56
|
+
* Classifies a value that may carry several space-separated lengths, as the
|
|
57
|
+
* `inset` shorthand does (up to four). A positive component anywhere outranks a
|
|
58
|
+
* negative one: it pulls an edge inside the origin box, where the overlay can
|
|
59
|
+
* occlude the control.
|
|
60
|
+
*/
|
|
61
|
+
function classifyOffsetComponents(raw) {
|
|
62
|
+
// A CSS function such as calc() or var() embeds whitespace inside a single
|
|
63
|
+
// component, so splitting on whitespace would misread its parts as lengths.
|
|
64
|
+
if (raw.includes('('))
|
|
65
|
+
return 'unknown';
|
|
66
|
+
const signs = raw
|
|
67
|
+
.trim()
|
|
68
|
+
.split(/\s+/)
|
|
69
|
+
.filter(Boolean)
|
|
70
|
+
.map(classifyOffsetString);
|
|
71
|
+
if (signs.length === 0)
|
|
72
|
+
return 'unknown';
|
|
73
|
+
if (signs.includes('positive'))
|
|
74
|
+
return 'positive';
|
|
75
|
+
if (signs.includes('negative'))
|
|
76
|
+
return 'negative';
|
|
77
|
+
return signs.every((sign) => sign === 'zero') ? 'zero' : 'unknown';
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Classifies an inset offset property value as a positive, negative, zero, or
|
|
81
|
+
* unknown length. Only the shapes that can be resolved statically are
|
|
82
|
+
* classified; variables, member expressions, and calls are treated as unknown
|
|
83
|
+
* and never counted toward the hit-slop exemption.
|
|
50
84
|
*/
|
|
51
85
|
function classifyOffsetValue(value) {
|
|
52
86
|
if (value.type === utils_1.AST_NODE_TYPES.Literal) {
|
|
@@ -56,10 +90,18 @@ function classifyOffsetValue(value) {
|
|
|
56
90
|
return value.value < 0 ? 'negative' : 'positive';
|
|
57
91
|
}
|
|
58
92
|
if (typeof value.value === 'string') {
|
|
59
|
-
return
|
|
93
|
+
return classifyOffsetComponents(value.value);
|
|
60
94
|
}
|
|
61
95
|
return 'unknown';
|
|
62
96
|
}
|
|
97
|
+
// An offset derived from a named constant states its direction in the leading
|
|
98
|
+
// literal text, whatever the interpolation resolves to: an interpolated
|
|
99
|
+
// negative would render `--8px`, which is not a valid length. Every other
|
|
100
|
+
// interpolation stays opaque and earns no exemption.
|
|
101
|
+
if (value.type === utils_1.AST_NODE_TYPES.TemplateLiteral) {
|
|
102
|
+
const leading = value.quasis[0]?.value.raw.trim() ?? '';
|
|
103
|
+
return leading.startsWith('-') ? 'negative' : 'unknown';
|
|
104
|
+
}
|
|
63
105
|
// Negative numeric literals parse as `-` UnaryExpression over a number.
|
|
64
106
|
if (value.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
|
|
65
107
|
value.operator === '-' &&
|
package/package.json
CHANGED
package/release-manifest.json
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "1.20.102",
|
|
4
|
+
"date": "2026-08-04T17:20:02.924Z",
|
|
5
|
+
"rules": [
|
|
6
|
+
{
|
|
7
|
+
"name": "ensure-pointer-events-none",
|
|
8
|
+
"changeType": "fix",
|
|
9
|
+
"issues": [
|
|
10
|
+
1707
|
|
11
|
+
],
|
|
12
|
+
"summary": "extend the hit-slop carve-out to the inset shorthand (closes #1707)"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
2
16
|
{
|
|
3
17
|
"version": "1.20.101",
|
|
4
18
|
"date": "2026-08-04T16:47:09.253Z",
|