@elastic/eslint-plugin-eui 3.1.0 → 3.2.0-snapshot.1790779107273
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/cjs/rules/button_group_no_invalid_children.d.ts +3 -1
- package/lib/cjs/rules/button_group_no_invalid_children.d.ts.map +1 -1
- package/lib/cjs/rules/button_group_no_invalid_children.js +98 -63
- package/lib/cjs/rules/no_restricted_eui_imports.js +2 -2
- package/lib/cjs/utils/walk_jsx_children.d.ts.map +1 -1
- package/lib/cjs/utils/walk_jsx_children.js +20 -1
- package/lib/esm/rules/button_group_no_invalid_children.d.ts +3 -1
- package/lib/esm/rules/button_group_no_invalid_children.js +108 -70
- package/lib/esm/rules/button_group_no_invalid_children.js.map +1 -1
- package/lib/esm/rules/no_restricted_eui_imports.js +2 -2
- package/lib/esm/rules/no_restricted_eui_imports.js.map +1 -1
- package/lib/esm/utils/walk_jsx_children.js +20 -1
- package/lib/esm/utils/walk_jsx_children.js.map +1 -1
- package/package.json +5 -4
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
-
export declare const ButtonGroupNoInvalidChildren: TSESLint.RuleModule<"invalidUnresolvableWrapperChild" | "invalidWrapperChild" | "
|
|
2
|
+
export declare const ButtonGroupNoInvalidChildren: TSESLint.RuleModule<"invalidUnresolvableWrapperChild" | "invalidWrapperChild" | "invalidUnresolvablePopoverButton" | "invalidPopoverButton" | "invalidChild" | "invalidUnresolvableChild" | "invalidMixedTypes", [{
|
|
3
|
+
additionalWrappers: string[];
|
|
4
|
+
}], unknown, TSESLint.RuleListener>;
|
|
3
5
|
//# sourceMappingURL=button_group_no_invalid_children.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button_group_no_invalid_children.d.ts","sourceRoot":"","sources":["../../../src/rules/button_group_no_invalid_children.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"button_group_no_invalid_children.d.ts","sourceRoot":"","sources":["../../../src/rules/button_group_no_invalid_children.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;AAmMlC,eAAO,MAAM,4BAA4B;wBA8LQ,MAAM,EAAE;mCAExD,CAAC"}
|
|
@@ -23,7 +23,7 @@ const VALID_WRAPPERS_LIST = Array.from(_button_group_constants.VALID_WRAPPERS).j
|
|
|
23
23
|
function isCustomComponent(name) {
|
|
24
24
|
return name[0] === name[0].toUpperCase();
|
|
25
25
|
}
|
|
26
|
-
function reportInvalidWrapperChildren(wrapper, wrapperName, context, validButtons, allowed, seenButtonTypes) {
|
|
26
|
+
function reportInvalidWrapperChildren(wrapper, wrapperName, context, validButtons, allowed, allowedWrappers, seenButtonTypes) {
|
|
27
27
|
const children = (0, _flat_map.flatMap)(wrapper.children, c => (0, _collect_jsx_children.collectJsxChildren)(c, context.sourceCode));
|
|
28
28
|
for (const wrapperChild of children) {
|
|
29
29
|
if ((0, _has_spread.hasSpread)(wrapperChild.openingElement.attributes)) continue;
|
|
@@ -33,6 +33,16 @@ function reportInvalidWrapperChildren(wrapper, wrapperName, context, validButton
|
|
|
33
33
|
seenButtonTypes?.add(wrapperChildName);
|
|
34
34
|
continue;
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
// Recurse into allowed wrappers (built-in EUI wrappers and additional configured wrappers)
|
|
38
|
+
if (allowedWrappers.has(wrapperChildName)) {
|
|
39
|
+
if (wrapperChildName === 'EuiPopover') {
|
|
40
|
+
validateEuiPopoverTrigger(wrapperChild, context, validButtons, allowed, allowedWrappers, seenButtonTypes);
|
|
41
|
+
} else {
|
|
42
|
+
reportInvalidWrapperChildren(wrapperChild, wrapperChildName, context, validButtons, allowed, allowedWrappers, seenButtonTypes);
|
|
43
|
+
}
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
36
46
|
context.report({
|
|
37
47
|
node: wrapperChild.openingElement,
|
|
38
48
|
messageId: isCustomComponent(wrapperChildName) && !_button_group_constants.VALID_BUTTONS.has(wrapperChildName) ? 'invalidUnresolvableWrapperChild' : 'invalidWrapperChild',
|
|
@@ -44,8 +54,64 @@ function reportInvalidWrapperChildren(wrapper, wrapperName, context, validButton
|
|
|
44
54
|
});
|
|
45
55
|
}
|
|
46
56
|
}
|
|
57
|
+
function validateEuiPopoverTrigger(popover, context, validButtons, allowed, allowedWrappers, seenButtonTypes) {
|
|
58
|
+
const buttonProp = popover.openingElement.attributes.find(attr => attr.type === 'JSXAttribute' && attr.name.type === 'JSXIdentifier' && attr.name.name === 'button');
|
|
59
|
+
if (buttonProp?.value == null) return;
|
|
60
|
+
const triggerElements = (0, _collect_jsx_children.collectJsxChildren)(buttonProp.value, context.sourceCode);
|
|
61
|
+
for (const triggerElement of triggerElements) {
|
|
62
|
+
if ((0, _has_spread.hasSpread)(triggerElement.openingElement.attributes)) continue;
|
|
63
|
+
const triggerElementName = (0, _get_element_name.getElementName)(triggerElement.openingElement);
|
|
64
|
+
if (triggerElementName === null) continue;
|
|
65
|
+
if (validButtons.has(triggerElementName)) {
|
|
66
|
+
seenButtonTypes?.add(triggerElementName);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (triggerElementName === 'EuiToolTip') {
|
|
70
|
+
// EuiToolTip wrapping the trigger — validate its children.
|
|
71
|
+
const tooltipChildren = (0, _flat_map.flatMap)(triggerElement.children, c => (0, _collect_jsx_children.collectJsxChildren)(c, context.sourceCode));
|
|
72
|
+
for (const tooltipChild of tooltipChildren) {
|
|
73
|
+
if ((0, _has_spread.hasSpread)(tooltipChild.openingElement.attributes)) continue;
|
|
74
|
+
const tooltipChildName = (0, _get_element_name.getElementName)(tooltipChild.openingElement);
|
|
75
|
+
if (tooltipChildName === null) continue;
|
|
76
|
+
if (validButtons.has(tooltipChildName)) {
|
|
77
|
+
seenButtonTypes?.add(tooltipChildName);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (allowedWrappers.has(tooltipChildName) && !_button_group_constants.VALID_WRAPPERS.has(tooltipChildName)) {
|
|
81
|
+
reportInvalidWrapperChildren(tooltipChild, tooltipChildName, context, validButtons, allowed, allowedWrappers, seenButtonTypes);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
context.report({
|
|
85
|
+
node: tooltipChild.openingElement,
|
|
86
|
+
messageId: isCustomComponent(tooltipChildName) && !_button_group_constants.VALID_BUTTONS.has(tooltipChildName) ? 'invalidUnresolvablePopoverButton' : 'invalidPopoverButton',
|
|
87
|
+
data: {
|
|
88
|
+
name: tooltipChildName,
|
|
89
|
+
allowed
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
if (allowedWrappers.has(triggerElementName) && !_button_group_constants.VALID_WRAPPERS.has(triggerElementName)) {
|
|
96
|
+
// Additional wrappers as popover triggers
|
|
97
|
+
reportInvalidWrapperChildren(triggerElement, triggerElementName, context, validButtons, allowed, allowedWrappers, seenButtonTypes);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
context.report({
|
|
101
|
+
node: triggerElement.openingElement,
|
|
102
|
+
messageId: isCustomComponent(triggerElementName) && !_button_group_constants.VALID_BUTTONS.has(triggerElementName) ? 'invalidUnresolvablePopoverButton' : 'invalidPopoverButton',
|
|
103
|
+
data: {
|
|
104
|
+
name: triggerElementName,
|
|
105
|
+
allowed
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
47
110
|
const ButtonGroupNoInvalidChildren = exports.ButtonGroupNoInvalidChildren = _utils.ESLintUtils.RuleCreator.withoutDocs({
|
|
48
|
-
create(context
|
|
111
|
+
create(context, [{
|
|
112
|
+
additionalWrappers = []
|
|
113
|
+
}]) {
|
|
114
|
+
const allowedWrappers = additionalWrappers.length > 0 ? new Set(Array.from(_button_group_constants.VALID_WRAPPERS).concat(additionalWrappers)) : _button_group_constants.VALID_WRAPPERS;
|
|
49
115
|
return {
|
|
50
116
|
JSXElement(node) {
|
|
51
117
|
const {
|
|
@@ -76,65 +142,19 @@ const ButtonGroupNoInvalidChildren = exports.ButtonGroupNoInvalidChildren = _uti
|
|
|
76
142
|
seenButtonTypes?.add(name);
|
|
77
143
|
continue;
|
|
78
144
|
}
|
|
79
|
-
if (
|
|
80
|
-
if (name === '
|
|
81
|
-
// Validate JSX children (expanding fragments/conditionals).
|
|
82
|
-
// Also collects button types for the segmented mixed-type check.
|
|
83
|
-
reportInvalidWrapperChildren(child, name, context, validButtons, allowed, seenButtonTypes ?? undefined);
|
|
84
|
-
} else if (name === 'EuiPopover') {
|
|
145
|
+
if (allowedWrappers.has(name)) {
|
|
146
|
+
if (name === 'EuiPopover') {
|
|
85
147
|
// The trigger is the `button` prop, not JSX children (panel
|
|
86
148
|
// content). The prop value may be a JSXExpressionContainer or
|
|
87
149
|
// a bare JSX element; collectJsxChildren handles both.
|
|
88
|
-
// EuiToolTip wrapping the trigger
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const triggerElementName = (0, _get_element_name.getElementName)(triggerElement.openingElement);
|
|
95
|
-
if (triggerElementName === null) continue;
|
|
96
|
-
if (validButtons.has(triggerElementName)) {
|
|
97
|
-
seenButtonTypes?.add(triggerElementName);
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
if (triggerElementName === 'EuiToolTip') {
|
|
101
|
-
// EuiToolTip wrapping the trigger — validate its children.
|
|
102
|
-
const tooltipChildren = (0, _flat_map.flatMap)(triggerElement.children, c => (0, _collect_jsx_children.collectJsxChildren)(c, context.sourceCode));
|
|
103
|
-
for (const tooltipChild of tooltipChildren) {
|
|
104
|
-
if ((0, _has_spread.hasSpread)(tooltipChild.openingElement.attributes)) continue;
|
|
105
|
-
const tooltipChildName = (0, _get_element_name.getElementName)(tooltipChild.openingElement);
|
|
106
|
-
if (tooltipChildName === null) continue;
|
|
107
|
-
if (validButtons.has(tooltipChildName)) {
|
|
108
|
-
seenButtonTypes?.add(tooltipChildName);
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
context.report({
|
|
112
|
-
node: tooltipChild.openingElement,
|
|
113
|
-
messageId: isCustomComponent(tooltipChildName) && !_button_group_constants.VALID_BUTTONS.has(tooltipChildName) ? 'invalidUnresolvablePopoverButton' : 'invalidPopoverButton',
|
|
114
|
-
data: {
|
|
115
|
-
name: tooltipChildName,
|
|
116
|
-
allowed
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
context.report({
|
|
123
|
-
node: triggerElement.openingElement,
|
|
124
|
-
messageId: isCustomComponent(triggerElementName) && !_button_group_constants.VALID_BUTTONS.has(triggerElementName) ? 'invalidUnresolvablePopoverButton' : 'invalidPopoverButton',
|
|
125
|
-
data: {
|
|
126
|
-
name: triggerElementName,
|
|
127
|
-
allowed
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
} else if (name === 'EuiCopy') {
|
|
133
|
-
// Children is a render prop: {(copy) => <EuiButton />}
|
|
134
|
-
// ArrowFunctionExpression with expression body is expanded by
|
|
135
|
-
// collectJsxChildren, so validation works the same as EuiToolTip.
|
|
150
|
+
// EuiToolTip or additional wrappers wrapping the trigger are supported.
|
|
151
|
+
validateEuiPopoverTrigger(child, context, validButtons, allowed, allowedWrappers, seenButtonTypes ?? undefined);
|
|
152
|
+
} else {
|
|
153
|
+
// EuiToolTip, EuiCopy, and consumer-configured additional wrappers:
|
|
154
|
+
// validate JSX children (expanding fragments/conditionals).
|
|
155
|
+
// EuiCopy children are a render prop expanded by collectJsxChildren.
|
|
136
156
|
// Also collects button types for the segmented mixed-type check.
|
|
137
|
-
reportInvalidWrapperChildren(child, name, context, validButtons, allowed, seenButtonTypes ?? undefined);
|
|
157
|
+
reportInvalidWrapperChildren(child, name, context, validButtons, allowed, allowedWrappers, seenButtonTypes ?? undefined);
|
|
138
158
|
}
|
|
139
159
|
continue;
|
|
140
160
|
}
|
|
@@ -147,7 +167,8 @@ const ButtonGroupNoInvalidChildren = exports.ButtonGroupNoInvalidChildren = _uti
|
|
|
147
167
|
messageId: isCustomComponent(name) && !_button_group_constants.VALID_BUTTONS.has(name) ? 'invalidUnresolvableChild' : 'invalidChild',
|
|
148
168
|
data: {
|
|
149
169
|
name,
|
|
150
|
-
allowed
|
|
170
|
+
allowed,
|
|
171
|
+
wrappers: Array.from(allowedWrappers).join(', ')
|
|
151
172
|
}
|
|
152
173
|
});
|
|
153
174
|
}
|
|
@@ -170,12 +191,24 @@ const ButtonGroupNoInvalidChildren = exports.ButtonGroupNoInvalidChildren = _uti
|
|
|
170
191
|
meta: {
|
|
171
192
|
type: 'problem',
|
|
172
193
|
docs: {
|
|
173
|
-
description: `Enforce that EuiButtonGroup children are valid button components, or a supported wrapper (${VALID_WRAPPERS_LIST})
|
|
194
|
+
description: `Enforce that EuiButtonGroup children are valid button components, or a supported wrapper (${VALID_WRAPPERS_LIST}). Additional wrappers can be configured via the additionalWrappers option.`
|
|
174
195
|
},
|
|
175
|
-
schema: [
|
|
196
|
+
schema: [{
|
|
197
|
+
type: 'object',
|
|
198
|
+
properties: {
|
|
199
|
+
additionalWrappers: {
|
|
200
|
+
type: 'array',
|
|
201
|
+
items: {
|
|
202
|
+
type: 'string'
|
|
203
|
+
},
|
|
204
|
+
uniqueItems: true
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
additionalProperties: false
|
|
208
|
+
}],
|
|
176
209
|
messages: {
|
|
177
|
-
invalidChild: [`{{ name }} is not a valid child of EuiButtonGroup.`, `Allowed children: {{ allowed }}.`, `Allowed wrappers:
|
|
178
|
-
invalidUnresolvableChild: [`{{ name }} cannot be verified as a valid child of EuiButtonGroup.`, `Allowed children: {{ allowed }}.`, `Allowed wrappers:
|
|
210
|
+
invalidChild: [`{{ name }} is not a valid child of EuiButtonGroup.`, `Allowed children: {{ allowed }}.`, `Allowed wrappers: {{ wrappers }}.`].join(' '),
|
|
211
|
+
invalidUnresolvableChild: [`{{ name }} cannot be verified as a valid child of EuiButtonGroup.`, `Allowed children: {{ allowed }}.`, `Allowed wrappers: {{ wrappers }}.`, `If {{ name }} is a shared button wrapper component only containing`, `valid button children, suppress this rule inline with a comment`, `explaining why it's valid.`, `// eslint-disable-next-line @elastic/eui/button-group-no-invalid-children -- SaveButton only wraps EuiButton`].join(' '),
|
|
179
212
|
invalidPopoverButton: [`{{ name }} is not a valid trigger button for EuiPopover in EuiButtonGroup.`, `The \`button\` prop must be {{ allowed }}.`].join(' '),
|
|
180
213
|
invalidUnresolvablePopoverButton: [`{{ name }} cannot be verified as a valid trigger button for EuiPopover in EuiButtonGroup.`, `The \`button\` prop must be {{ allowed }}.`, `If {{ name }} is a shared button wrapper component only containing`, `valid button children, suppress this rule inline with a comment`, `explaining why it's valid.`, `// eslint-disable-next-line @elastic/eui/button-group-no-invalid-children -- SaveButton only wraps EuiButton`].join(' '),
|
|
181
214
|
invalidWrapperChild: [`{{ name }} inside {{ wrapper }} is not a valid button for EuiButtonGroup.`, `The wrapper must contain {{ allowed }}.`].join(' '),
|
|
@@ -183,5 +216,7 @@ const ButtonGroupNoInvalidChildren = exports.ButtonGroupNoInvalidChildren = _uti
|
|
|
183
216
|
invalidMixedTypes: [`EuiButtonGroup with variant="{{ variant }}" must use a single button type throughout.`, `Use either all EuiButton or all EuiButtonIcon children — not both.`].join(' ')
|
|
184
217
|
}
|
|
185
218
|
},
|
|
186
|
-
defaultOptions: [
|
|
219
|
+
defaultOptions: [{
|
|
220
|
+
additionalWrappers: []
|
|
221
|
+
}]
|
|
187
222
|
});
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.NoRestrictedEuiImports = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _picomatch = _interopRequireDefault(require("picomatch"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
/*
|
|
10
10
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -28,7 +28,7 @@ const NoRestrictedEuiImports = exports.NoRestrictedEuiImports = {
|
|
|
28
28
|
patterns,
|
|
29
29
|
message
|
|
30
30
|
}) => {
|
|
31
|
-
if (
|
|
31
|
+
if (_picomatch.default.isMatch(node.source.value, patterns)) {
|
|
32
32
|
context.report({
|
|
33
33
|
loc: node.source.loc,
|
|
34
34
|
// @ts-expect-error @typescript-eslint types expect `messageId` here but `message` is also allowed in eslint API
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk_jsx_children.d.ts","sourceRoot":"","sources":["../../../src/utils/walk_jsx_children.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"walk_jsx_children.d.ts","sourceRoot":"","sources":["../../../src/utils/walk_jsx_children.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AA8NxE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,IAAI,EACpC,OAAO,GAAE;IACP,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,UAAU,KAAK,OAAO,CAAC;IAClD,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,UAAU,KAAK,QAAQ,CAAC,IAAI,EAAE,GAAG,SAAS,CAAC;CACnE,GACL,IAAI,CASN"}
|
|
@@ -81,7 +81,26 @@ function resolveLocalComponent(sourceCode, name, refNode) {
|
|
|
81
81
|
if (!def || def.type !== 'Variable' || !def.node.init) return null;
|
|
82
82
|
const init = def.node.init;
|
|
83
83
|
if (init.type !== 'ArrowFunctionExpression') return null;
|
|
84
|
-
if (init.body.type !== 'BlockStatement')
|
|
84
|
+
if (init.body.type !== 'BlockStatement') {
|
|
85
|
+
// Check for prop passthrough (e.g. `({ children }) => children`)
|
|
86
|
+
// and try to resolve it as a local variable. If that fails, treat
|
|
87
|
+
// the component as opaque.
|
|
88
|
+
if (init.body.type === 'Identifier') {
|
|
89
|
+
const resolved = resolveIdentifierValue(sourceCode, init.body);
|
|
90
|
+
return resolved !== null ? [resolved] : null;
|
|
91
|
+
}
|
|
92
|
+
// A prop passthrough with wrapping DOM element (e.g. `({ children }) => <div>{children}</div>`)
|
|
93
|
+
// is treated as opaque.
|
|
94
|
+
// Returned standalone components (e.g.`({ id, label }) => <EuiButton>{label}</EuiButton>`)
|
|
95
|
+
// are resolved transparently.
|
|
96
|
+
if (init.params.length > 0 && init.body.type === 'JSXElement') {
|
|
97
|
+
const rootName = init.body.openingElement.name;
|
|
98
|
+
if (rootName.type === 'JSXIdentifier' && rootName.name[0] === rootName.name[0].toLowerCase()) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return [init.body];
|
|
103
|
+
}
|
|
85
104
|
const returns = collectReturnValues(init.body);
|
|
86
105
|
return returns.length > 0 ? returns : null;
|
|
87
106
|
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
-
export declare const ButtonGroupNoInvalidChildren: TSESLint.RuleModule<"invalidUnresolvableWrapperChild" | "invalidWrapperChild" | "
|
|
2
|
+
export declare const ButtonGroupNoInvalidChildren: TSESLint.RuleModule<"invalidUnresolvableWrapperChild" | "invalidWrapperChild" | "invalidUnresolvablePopoverButton" | "invalidPopoverButton" | "invalidChild" | "invalidUnresolvableChild" | "invalidMixedTypes", [{
|
|
3
|
+
additionalWrappers: string[];
|
|
4
|
+
}], unknown, TSESLint.RuleListener>;
|
|
@@ -19,7 +19,7 @@ const VALID_WRAPPERS_LIST = Array.from(button_group_constants_1.VALID_WRAPPERS).
|
|
|
19
19
|
function isCustomComponent(name) {
|
|
20
20
|
return name[0] === name[0].toUpperCase();
|
|
21
21
|
}
|
|
22
|
-
function reportInvalidWrapperChildren(wrapper, wrapperName, context, validButtons, allowed, seenButtonTypes) {
|
|
22
|
+
function reportInvalidWrapperChildren(wrapper, wrapperName, context, validButtons, allowed, allowedWrappers, seenButtonTypes) {
|
|
23
23
|
const children = (0, flat_map_1.flatMap)(wrapper.children, (c) => (0, collect_jsx_children_1.collectJsxChildren)(c, context.sourceCode));
|
|
24
24
|
for (const wrapperChild of children) {
|
|
25
25
|
if ((0, has_spread_1.hasSpread)(wrapperChild.openingElement.attributes))
|
|
@@ -31,6 +31,16 @@ function reportInvalidWrapperChildren(wrapper, wrapperName, context, validButton
|
|
|
31
31
|
seenButtonTypes?.add(wrapperChildName);
|
|
32
32
|
continue;
|
|
33
33
|
}
|
|
34
|
+
// Recurse into allowed wrappers (built-in EUI wrappers and additional configured wrappers)
|
|
35
|
+
if (allowedWrappers.has(wrapperChildName)) {
|
|
36
|
+
if (wrapperChildName === 'EuiPopover') {
|
|
37
|
+
validateEuiPopoverTrigger(wrapperChild, context, validButtons, allowed, allowedWrappers, seenButtonTypes);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
reportInvalidWrapperChildren(wrapperChild, wrapperChildName, context, validButtons, allowed, allowedWrappers, seenButtonTypes);
|
|
41
|
+
}
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
34
44
|
context.report({
|
|
35
45
|
node: wrapperChild.openingElement,
|
|
36
46
|
messageId: isCustomComponent(wrapperChildName) &&
|
|
@@ -41,8 +51,73 @@ function reportInvalidWrapperChildren(wrapper, wrapperName, context, validButton
|
|
|
41
51
|
});
|
|
42
52
|
}
|
|
43
53
|
}
|
|
54
|
+
function validateEuiPopoverTrigger(popover, context, validButtons, allowed, allowedWrappers, seenButtonTypes) {
|
|
55
|
+
const buttonProp = popover.openingElement.attributes.find((attr) => attr.type === 'JSXAttribute' &&
|
|
56
|
+
attr.name.type === 'JSXIdentifier' &&
|
|
57
|
+
attr.name.name === 'button');
|
|
58
|
+
if (buttonProp?.value == null)
|
|
59
|
+
return;
|
|
60
|
+
const triggerElements = (0, collect_jsx_children_1.collectJsxChildren)(buttonProp.value, context.sourceCode);
|
|
61
|
+
for (const triggerElement of triggerElements) {
|
|
62
|
+
if ((0, has_spread_1.hasSpread)(triggerElement.openingElement.attributes))
|
|
63
|
+
continue;
|
|
64
|
+
const triggerElementName = (0, get_element_name_1.getElementName)(triggerElement.openingElement);
|
|
65
|
+
if (triggerElementName === null)
|
|
66
|
+
continue;
|
|
67
|
+
if (validButtons.has(triggerElementName)) {
|
|
68
|
+
seenButtonTypes?.add(triggerElementName);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (triggerElementName === 'EuiToolTip') {
|
|
72
|
+
// EuiToolTip wrapping the trigger — validate its children.
|
|
73
|
+
const tooltipChildren = (0, flat_map_1.flatMap)(triggerElement.children, (c) => (0, collect_jsx_children_1.collectJsxChildren)(c, context.sourceCode));
|
|
74
|
+
for (const tooltipChild of tooltipChildren) {
|
|
75
|
+
if ((0, has_spread_1.hasSpread)(tooltipChild.openingElement.attributes))
|
|
76
|
+
continue;
|
|
77
|
+
const tooltipChildName = (0, get_element_name_1.getElementName)(tooltipChild.openingElement);
|
|
78
|
+
if (tooltipChildName === null)
|
|
79
|
+
continue;
|
|
80
|
+
if (validButtons.has(tooltipChildName)) {
|
|
81
|
+
seenButtonTypes?.add(tooltipChildName);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (allowedWrappers.has(tooltipChildName) &&
|
|
85
|
+
!button_group_constants_1.VALID_WRAPPERS.has(tooltipChildName)) {
|
|
86
|
+
reportInvalidWrapperChildren(tooltipChild, tooltipChildName, context, validButtons, allowed, allowedWrappers, seenButtonTypes);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
context.report({
|
|
90
|
+
node: tooltipChild.openingElement,
|
|
91
|
+
messageId: isCustomComponent(tooltipChildName) &&
|
|
92
|
+
!button_group_constants_1.VALID_BUTTONS.has(tooltipChildName)
|
|
93
|
+
? 'invalidUnresolvablePopoverButton'
|
|
94
|
+
: 'invalidPopoverButton',
|
|
95
|
+
data: { name: tooltipChildName, allowed },
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (allowedWrappers.has(triggerElementName) &&
|
|
101
|
+
!button_group_constants_1.VALID_WRAPPERS.has(triggerElementName)) {
|
|
102
|
+
// Additional wrappers as popover triggers
|
|
103
|
+
reportInvalidWrapperChildren(triggerElement, triggerElementName, context, validButtons, allowed, allowedWrappers, seenButtonTypes);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
context.report({
|
|
107
|
+
node: triggerElement.openingElement,
|
|
108
|
+
messageId: isCustomComponent(triggerElementName) &&
|
|
109
|
+
!button_group_constants_1.VALID_BUTTONS.has(triggerElementName)
|
|
110
|
+
? 'invalidUnresolvablePopoverButton'
|
|
111
|
+
: 'invalidPopoverButton',
|
|
112
|
+
data: { name: triggerElementName, allowed },
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
44
116
|
exports.ButtonGroupNoInvalidChildren = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
45
|
-
create(context) {
|
|
117
|
+
create(context, [{ additionalWrappers = [] }]) {
|
|
118
|
+
const allowedWrappers = additionalWrappers.length > 0
|
|
119
|
+
? new Set(Array.from(button_group_constants_1.VALID_WRAPPERS).concat(additionalWrappers))
|
|
120
|
+
: button_group_constants_1.VALID_WRAPPERS;
|
|
46
121
|
return {
|
|
47
122
|
JSXElement(node) {
|
|
48
123
|
const { openingElement } = node;
|
|
@@ -80,73 +155,20 @@ exports.ButtonGroupNoInvalidChildren = utils_1.ESLintUtils.RuleCreator.withoutDo
|
|
|
80
155
|
seenButtonTypes?.add(name);
|
|
81
156
|
continue;
|
|
82
157
|
}
|
|
83
|
-
if (
|
|
84
|
-
if (name === '
|
|
85
|
-
// Validate JSX children (expanding fragments/conditionals).
|
|
86
|
-
// Also collects button types for the segmented mixed-type check.
|
|
87
|
-
reportInvalidWrapperChildren(child, name, context, validButtons, allowed, seenButtonTypes ?? undefined);
|
|
88
|
-
}
|
|
89
|
-
else if (name === 'EuiPopover') {
|
|
158
|
+
if (allowedWrappers.has(name)) {
|
|
159
|
+
if (name === 'EuiPopover') {
|
|
90
160
|
// The trigger is the `button` prop, not JSX children (panel
|
|
91
161
|
// content). The prop value may be a JSXExpressionContainer or
|
|
92
162
|
// a bare JSX element; collectJsxChildren handles both.
|
|
93
|
-
// EuiToolTip wrapping the trigger
|
|
94
|
-
|
|
95
|
-
attr.name.type === 'JSXIdentifier' &&
|
|
96
|
-
attr.name.name === 'button');
|
|
97
|
-
if (buttonProp?.value != null) {
|
|
98
|
-
const triggerElements = (0, collect_jsx_children_1.collectJsxChildren)(buttonProp.value, context.sourceCode);
|
|
99
|
-
for (const triggerElement of triggerElements) {
|
|
100
|
-
if ((0, has_spread_1.hasSpread)(triggerElement.openingElement.attributes))
|
|
101
|
-
continue;
|
|
102
|
-
const triggerElementName = (0, get_element_name_1.getElementName)(triggerElement.openingElement);
|
|
103
|
-
if (triggerElementName === null)
|
|
104
|
-
continue;
|
|
105
|
-
if (validButtons.has(triggerElementName)) {
|
|
106
|
-
seenButtonTypes?.add(triggerElementName);
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
if (triggerElementName === 'EuiToolTip') {
|
|
110
|
-
// EuiToolTip wrapping the trigger — validate its children.
|
|
111
|
-
const tooltipChildren = (0, flat_map_1.flatMap)(triggerElement.children, (c) => (0, collect_jsx_children_1.collectJsxChildren)(c, context.sourceCode));
|
|
112
|
-
for (const tooltipChild of tooltipChildren) {
|
|
113
|
-
if ((0, has_spread_1.hasSpread)(tooltipChild.openingElement.attributes))
|
|
114
|
-
continue;
|
|
115
|
-
const tooltipChildName = (0, get_element_name_1.getElementName)(tooltipChild.openingElement);
|
|
116
|
-
if (tooltipChildName === null)
|
|
117
|
-
continue;
|
|
118
|
-
if (validButtons.has(tooltipChildName)) {
|
|
119
|
-
seenButtonTypes?.add(tooltipChildName);
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
context.report({
|
|
123
|
-
node: tooltipChild.openingElement,
|
|
124
|
-
messageId: isCustomComponent(tooltipChildName) &&
|
|
125
|
-
!button_group_constants_1.VALID_BUTTONS.has(tooltipChildName)
|
|
126
|
-
? 'invalidUnresolvablePopoverButton'
|
|
127
|
-
: 'invalidPopoverButton',
|
|
128
|
-
data: { name: tooltipChildName, allowed },
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
context.report({
|
|
134
|
-
node: triggerElement.openingElement,
|
|
135
|
-
messageId: isCustomComponent(triggerElementName) &&
|
|
136
|
-
!button_group_constants_1.VALID_BUTTONS.has(triggerElementName)
|
|
137
|
-
? 'invalidUnresolvablePopoverButton'
|
|
138
|
-
: 'invalidPopoverButton',
|
|
139
|
-
data: { name: triggerElementName, allowed },
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
}
|
|
163
|
+
// EuiToolTip or additional wrappers wrapping the trigger are supported.
|
|
164
|
+
validateEuiPopoverTrigger(child, context, validButtons, allowed, allowedWrappers, seenButtonTypes ?? undefined);
|
|
143
165
|
}
|
|
144
|
-
else
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
//
|
|
166
|
+
else {
|
|
167
|
+
// EuiToolTip, EuiCopy, and consumer-configured additional wrappers:
|
|
168
|
+
// validate JSX children (expanding fragments/conditionals).
|
|
169
|
+
// EuiCopy children are a render prop expanded by collectJsxChildren.
|
|
148
170
|
// Also collects button types for the segmented mixed-type check.
|
|
149
|
-
reportInvalidWrapperChildren(child, name, context, validButtons, allowed, seenButtonTypes ?? undefined);
|
|
171
|
+
reportInvalidWrapperChildren(child, name, context, validButtons, allowed, allowedWrappers, seenButtonTypes ?? undefined);
|
|
150
172
|
}
|
|
151
173
|
continue;
|
|
152
174
|
}
|
|
@@ -159,7 +181,11 @@ exports.ButtonGroupNoInvalidChildren = utils_1.ESLintUtils.RuleCreator.withoutDo
|
|
|
159
181
|
messageId: isCustomComponent(name) && !button_group_constants_1.VALID_BUTTONS.has(name)
|
|
160
182
|
? 'invalidUnresolvableChild'
|
|
161
183
|
: 'invalidChild',
|
|
162
|
-
data: {
|
|
184
|
+
data: {
|
|
185
|
+
name,
|
|
186
|
+
allowed,
|
|
187
|
+
wrappers: Array.from(allowedWrappers).join(', '),
|
|
188
|
+
},
|
|
163
189
|
});
|
|
164
190
|
}
|
|
165
191
|
// For segmented/selection, all children must be the same button type —
|
|
@@ -179,19 +205,31 @@ exports.ButtonGroupNoInvalidChildren = utils_1.ESLintUtils.RuleCreator.withoutDo
|
|
|
179
205
|
meta: {
|
|
180
206
|
type: 'problem',
|
|
181
207
|
docs: {
|
|
182
|
-
description: `Enforce that EuiButtonGroup children are valid button components, or a supported wrapper (${VALID_WRAPPERS_LIST})
|
|
208
|
+
description: `Enforce that EuiButtonGroup children are valid button components, or a supported wrapper (${VALID_WRAPPERS_LIST}). Additional wrappers can be configured via the additionalWrappers option.`,
|
|
183
209
|
},
|
|
184
|
-
schema: [
|
|
210
|
+
schema: [
|
|
211
|
+
{
|
|
212
|
+
type: 'object',
|
|
213
|
+
properties: {
|
|
214
|
+
additionalWrappers: {
|
|
215
|
+
type: 'array',
|
|
216
|
+
items: { type: 'string' },
|
|
217
|
+
uniqueItems: true,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
additionalProperties: false,
|
|
221
|
+
},
|
|
222
|
+
],
|
|
185
223
|
messages: {
|
|
186
224
|
invalidChild: [
|
|
187
225
|
`{{ name }} is not a valid child of EuiButtonGroup.`,
|
|
188
226
|
`Allowed children: {{ allowed }}.`,
|
|
189
|
-
`Allowed wrappers:
|
|
227
|
+
`Allowed wrappers: {{ wrappers }}.`,
|
|
190
228
|
].join(' '),
|
|
191
229
|
invalidUnresolvableChild: [
|
|
192
230
|
`{{ name }} cannot be verified as a valid child of EuiButtonGroup.`,
|
|
193
231
|
`Allowed children: {{ allowed }}.`,
|
|
194
|
-
`Allowed wrappers:
|
|
232
|
+
`Allowed wrappers: {{ wrappers }}.`,
|
|
195
233
|
`If {{ name }} is a shared button wrapper component only containing`,
|
|
196
234
|
`valid button children, suppress this rule inline with a comment`,
|
|
197
235
|
`explaining why it's valid.`,
|
|
@@ -226,6 +264,6 @@ exports.ButtonGroupNoInvalidChildren = utils_1.ESLintUtils.RuleCreator.withoutDo
|
|
|
226
264
|
].join(' '),
|
|
227
265
|
},
|
|
228
266
|
},
|
|
229
|
-
defaultOptions: [],
|
|
267
|
+
defaultOptions: [{ additionalWrappers: [] }],
|
|
230
268
|
});
|
|
231
269
|
//# sourceMappingURL=button_group_no_invalid_children.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button_group_no_invalid_children.js","sourceRoot":"","sources":["../../../src/rules/button_group_no_invalid_children.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,oDAIkC;AAClC,oDAAgD;AAChD,gDAA4C;AAC5C,gEAA2D;AAC3D,4DAAwD;AACxD,wEAAmE;AACnE,4EAMyC;AAEzC,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,CAAC,uCAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAElE,SAAS,iBAAiB,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAC3C,CAAC;AAED,SAAS,4BAA4B,CAGnC,OAA4B,EAC5B,WAAmB,EACnB,OAAiB,EACjB,YAAyB,EACzB,OAAe,EACf,eAA6B;IAE7B,MAAM,QAAQ,GAAG,IAAA,kBAAO,EAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAC/C,IAAA,yCAAkB,EAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAC1C,CAAC;IACF,KAAK,MAAM,YAAY,IAAI,QAAQ,EAAE,CAAC;QACpC,IAAI,IAAA,sBAAS,EAAC,YAAY,CAAC,cAAc,CAAC,UAAU,CAAC;YAAE,SAAS;QAEhE,MAAM,gBAAgB,GAAG,IAAA,iCAAc,EAAC,YAAY,CAAC,cAAc,CAAC,CAAC;QAErE,IAAI,gBAAgB,KAAK,IAAI;YAAE,SAAS;QAExC,IAAI,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACvC,eAAe,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;YACvC,SAAS;QACX,CAAC;
|
|
1
|
+
{"version":3,"file":"button_group_no_invalid_children.js","sourceRoot":"","sources":["../../../src/rules/button_group_no_invalid_children.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,oDAIkC;AAClC,oDAAgD;AAChD,gDAA4C;AAC5C,gEAA2D;AAC3D,4DAAwD;AACxD,wEAAmE;AACnE,4EAMyC;AAEzC,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,CAAC,uCAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAElE,SAAS,iBAAiB,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAC3C,CAAC;AAED,SAAS,4BAA4B,CAGnC,OAA4B,EAC5B,WAAm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efault) || function (mod) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.NoRestrictedEuiImports = void 0;
|
|
14
|
-
const
|
|
14
|
+
const picomatch_1 = __importDefault(require("picomatch"));
|
|
15
15
|
const DEFAULT_RESTRICTED_IMPORT_OPTIONS = [
|
|
16
16
|
{
|
|
17
17
|
patterns: ['@elastic/eui/dist/eui_theme_*\\.json'],
|
|
@@ -25,7 +25,7 @@ exports.NoRestrictedEuiImports = {
|
|
|
25
25
|
return {
|
|
26
26
|
ImportDeclaration(node) {
|
|
27
27
|
options.forEach(({ patterns, message }) => {
|
|
28
|
-
if (
|
|
28
|
+
if (picomatch_1.default.isMatch(node.source.value, patterns)) {
|
|
29
29
|
context.report({
|
|
30
30
|
loc: node.source.loc,
|
|
31
31
|
// @ts-expect-error @typescript-eslint types expect `messageId` here but `message` is also allowed in eslint API
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no_restricted_eui_imports.js","sourceRoot":"","sources":["../../../src/rules/no_restricted_eui_imports.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"no_restricted_eui_imports.js","sourceRoot":"","sources":["../../../src/rules/no_restricted_eui_imports.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,0DAAkC;AAQlC,MAAM,iCAAiC,GAAa;IAClD;QACE,QAAQ,EAAE,CAAC,sCAAsC,CAAC;QAClD,OAAO,EACL,oDAAoD;KACvD;CACF,CAAC;AAEW,QAAA,sBAAsB,GAAmD;IACpF,MAAM,CAAC,OAAO;QACZ,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAG,CAAC,GAAG,iCAAiC,EAAE,GAAG,WAAW,CAAC,CAAC;QAEvE,OAAO;YACL,iBAAiB,CAAC,IAAgC;gBAChD,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAU,EAAE,EAAE;oBAChD,IAAI,mBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;wBACnD,OAAO,CAAC,MAAM,CAAC;4BACb,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG;4BACpB,gHAAgH;4BAChH,OAAO;yBACR,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,+CAA+C;SAC7D;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,QAAQ,EAAE;wBACR,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;yBACf;qBACF;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;qBACf;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,QAAQ,EAAE,EAAE;KACb;IACD,cAAc,EAAE,EAAE;CACnB,CAAC"}
|
|
@@ -82,8 +82,27 @@ function resolveLocalComponent(sourceCode, name, refNode) {
|
|
|
82
82
|
const init = def.node.init;
|
|
83
83
|
if (init.type !== 'ArrowFunctionExpression')
|
|
84
84
|
return null;
|
|
85
|
-
if (init.body.type !== 'BlockStatement')
|
|
85
|
+
if (init.body.type !== 'BlockStatement') {
|
|
86
|
+
// Check for prop passthrough (e.g. `({ children }) => children`)
|
|
87
|
+
// and try to resolve it as a local variable. If that fails, treat
|
|
88
|
+
// the component as opaque.
|
|
89
|
+
if (init.body.type === 'Identifier') {
|
|
90
|
+
const resolved = resolveIdentifierValue(sourceCode, init.body);
|
|
91
|
+
return resolved !== null ? [resolved] : null;
|
|
92
|
+
}
|
|
93
|
+
// A prop passthrough with wrapping DOM element (e.g. `({ children }) => <div>{children}</div>`)
|
|
94
|
+
// is treated as opaque.
|
|
95
|
+
// Returned standalone components (e.g.`({ id, label }) => <EuiButton>{label}</EuiButton>`)
|
|
96
|
+
// are resolved transparently.
|
|
97
|
+
if (init.params.length > 0 && init.body.type === 'JSXElement') {
|
|
98
|
+
const rootName = init.body.openingElement.name;
|
|
99
|
+
if (rootName.type === 'JSXIdentifier' &&
|
|
100
|
+
rootName.name[0] === rootName.name[0].toLowerCase()) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
86
104
|
return [init.body];
|
|
105
|
+
}
|
|
87
106
|
const returns = collectReturnValues(init.body);
|
|
88
107
|
return returns.length > 0 ? returns : null;
|
|
89
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk_jsx_children.js","sourceRoot":"","sources":["../../../src/utils/walk_jsx_children.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;
|
|
1
|
+
{"version":3,"file":"walk_jsx_children.js","sourceRoot":"","sources":["../../../src/utils/walk_jsx_children.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA4PH,0CAiBC;AA1QD,yCAAqC;AACrC,+CAA2C;AAE3C,2EAA2E;AAC3E,4EAA4E;AAC5E,SAAS,YAAY,CAAC,QAAiC;IACrD,OAAO,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AACvE,CAAC;AAED;;;;;GAKG;AACH,SAAS,sBAAsB,CAC7B,UAA+B,EAC/B,IAAyB;IAEzB,IAAI,KAAK,GAAgC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACnE,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU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IAAI,KAAK,gBAAgB,EAAE,CAAC;oBACtC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;gBAChB,CAAC;qBAAM,CAAC;oBACN,mBAAmB,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC;YACD,OAAO;QACT,CAAC;QACD,KAAK,SAAS,CAAC;QACf,KAAK,SAAS,CAAC;QACf,KAAK,iBAAiB,CAAC;QACvB,KAAK,kBAAkB;YACrB,KAAK,CAAC,IAAI,CAAC,CAAC;YACZ,OAAO;QACT;YACE,OAAO;IACX,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,eAAe,CAC7B,IAAmB,EACnB,KAAoC,EACpC,UAII,EAAE;IAEN,YAAY,CACV,IAAI,EACJ,KAAK,EACL,OAAO,CAAC,UAAU,EAClB,IAAI,GAAG,EAAU,EACjB,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,WAAW,CACpB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/eslint-plugin-eui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0-snapshot.1790779107273",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@typescript-eslint/typescript-estree": "^8.64.0",
|
|
21
21
|
"@typescript-eslint/utils": "^8.64.0",
|
|
22
22
|
"cssstyle": "^4.2.1",
|
|
23
|
-
"
|
|
23
|
+
"picomatch": "^2.3.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@babel/cli": "^7.26.4",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@types/cssstyle": "^2.2.4",
|
|
33
33
|
"@types/dedent": "^0.7.2",
|
|
34
34
|
"@types/jest": "^29.5.14",
|
|
35
|
-
"@types/
|
|
35
|
+
"@types/picomatch": "^2.3.4",
|
|
36
36
|
"@typescript-eslint/eslint-plugin": "^8.64.0",
|
|
37
37
|
"@typescript-eslint/parser": "^8.64.0",
|
|
38
38
|
"@typescript-eslint/rule-tester": "^8.64.0",
|
|
@@ -59,5 +59,6 @@
|
|
|
59
59
|
"!**/*.test.js",
|
|
60
60
|
"!**/*.test.js.map",
|
|
61
61
|
"!**/*.test.d.ts"
|
|
62
|
-
]
|
|
62
|
+
],
|
|
63
|
+
"stableVersion": "3.2.0"
|
|
63
64
|
}
|