@elastic/eslint-plugin-eui 2.3.0 → 2.5.0
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/README.md +18 -3
- package/lib/cjs/index.js +19 -18
- package/lib/cjs/rules/a11y/accessible_interactive_element.d.ts +3 -0
- package/lib/cjs/rules/a11y/accessible_interactive_element.d.ts.map +1 -0
- package/lib/cjs/rules/a11y/accessible_interactive_element.js +51 -0
- package/lib/cjs/rules/a11y/callout_announce_on_mount.d.ts +3 -0
- package/lib/cjs/rules/a11y/callout_announce_on_mount.d.ts.map +1 -0
- package/lib/cjs/rules/a11y/callout_announce_on_mount.js +56 -0
- package/lib/cjs/rules/a11y/consistent_is_invalid_props.d.ts.map +1 -1
- package/lib/cjs/rules/a11y/consistent_is_invalid_props.js +7 -18
- package/lib/cjs/rules/a11y/no_unnamed_interactive_element.d.ts +3 -0
- package/lib/cjs/rules/a11y/no_unnamed_interactive_element.d.ts.map +1 -0
- package/lib/cjs/rules/a11y/no_unnamed_interactive_element.js +78 -0
- package/lib/cjs/rules/a11y/no_unnamed_radio_group.d.ts.map +1 -1
- package/lib/cjs/rules/a11y/no_unnamed_radio_group.js +5 -16
- package/lib/cjs/rules/a11y/prefer_eui_icon_tip.d.ts.map +1 -1
- package/lib/cjs/rules/a11y/prefer_eui_icon_tip.js +8 -0
- package/lib/cjs/rules/a11y/require_aria_label_for_modals.d.ts.map +1 -1
- package/lib/cjs/rules/a11y/require_aria_label_for_modals.js +5 -16
- package/lib/cjs/rules/a11y/sr_output_disabled_tooltip.js +2 -2
- package/lib/cjs/rules/a11y/tooltip_focusable_anchor.d.ts +3 -0
- package/lib/cjs/rules/a11y/tooltip_focusable_anchor.d.ts.map +1 -0
- package/lib/cjs/rules/a11y/tooltip_focusable_anchor.js +68 -0
- package/lib/cjs/rules/href_or_on_click.d.ts.map +1 -1
- package/lib/cjs/rules/href_or_on_click.js +5 -16
- package/lib/cjs/rules/no_css_color.d.ts.map +1 -1
- package/lib/cjs/rules/no_css_color.js +14 -7
- package/lib/cjs/rules/no_restricted_eui_imports.d.ts.map +1 -1
- package/lib/cjs/rules/no_restricted_eui_imports.js +5 -16
- package/lib/cjs/utils/are_attrs_equal.d.ts.map +1 -1
- package/lib/cjs/utils/are_attrs_equal.js +5 -16
- package/lib/cjs/utils/constants.d.ts +27 -0
- package/lib/cjs/utils/constants.d.ts.map +1 -0
- package/lib/cjs/utils/constants.js +41 -0
- package/lib/cjs/utils/get_allowed_a11y_prop_names_for_component.d.ts +24 -0
- package/lib/cjs/utils/get_allowed_a11y_prop_names_for_component.d.ts.map +1 -0
- package/lib/cjs/utils/get_allowed_a11y_prop_names_for_component.js +39 -0
- package/lib/cjs/utils/get_attr_value.d.ts +2 -1
- package/lib/cjs/utils/get_attr_value.d.ts.map +1 -1
- package/lib/cjs/utils/get_attr_value.js +11 -18
- package/lib/cjs/utils/has_a11y_prop_for_component.d.ts +20 -0
- package/lib/cjs/utils/has_a11y_prop_for_component.d.ts.map +1 -0
- package/lib/cjs/utils/has_a11y_prop_for_component.js +36 -0
- package/lib/cjs/utils/has_spread.d.ts +12 -0
- package/lib/cjs/utils/has_spread.d.ts.map +1 -0
- package/lib/cjs/utils/has_spread.js +27 -0
- package/lib/cjs/utils/is_in_conditional_rendering.d.ts +3 -0
- package/lib/cjs/utils/is_in_conditional_rendering.d.ts.map +1 -0
- package/lib/cjs/utils/is_in_conditional_rendering.js +24 -0
- package/lib/cjs/utils/resolve_member_expression_root.d.ts.map +1 -1
- package/lib/cjs/utils/resolve_member_expression_root.js +8 -0
- package/lib/esm/index.js +17 -16
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/rules/a11y/accessible_interactive_element.d.ts +2 -0
- package/lib/esm/rules/a11y/accessible_interactive_element.js +50 -0
- package/lib/esm/rules/a11y/accessible_interactive_element.js.map +1 -0
- package/lib/esm/rules/a11y/callout_announce_on_mount.d.ts +2 -0
- package/lib/esm/rules/a11y/callout_announce_on_mount.js +66 -0
- package/lib/esm/rules/a11y/callout_announce_on_mount.js.map +1 -0
- package/lib/esm/rules/a11y/consistent_is_invalid_props.js +7 -18
- package/lib/esm/rules/a11y/consistent_is_invalid_props.js.map +1 -1
- package/lib/esm/rules/a11y/no_unnamed_interactive_element.d.ts +2 -0
- package/lib/esm/rules/a11y/no_unnamed_interactive_element.js +94 -0
- package/lib/esm/rules/a11y/no_unnamed_interactive_element.js.map +1 -0
- package/lib/esm/rules/a11y/no_unnamed_radio_group.js +5 -16
- package/lib/esm/rules/a11y/no_unnamed_radio_group.js.map +1 -1
- package/lib/esm/rules/a11y/prefer_eui_icon_tip.js +7 -0
- package/lib/esm/rules/a11y/prefer_eui_icon_tip.js.map +1 -1
- package/lib/esm/rules/a11y/require_aria_label_for_modals.js +5 -16
- package/lib/esm/rules/a11y/require_aria_label_for_modals.js.map +1 -1
- package/lib/esm/rules/a11y/sr_output_disabled_tooltip.js +2 -2
- package/lib/esm/rules/a11y/sr_output_disabled_tooltip.js.map +1 -1
- package/lib/esm/rules/a11y/tooltip_focusable_anchor.d.ts +2 -0
- package/lib/esm/rules/a11y/tooltip_focusable_anchor.js +84 -0
- package/lib/esm/rules/a11y/tooltip_focusable_anchor.js.map +1 -0
- package/lib/esm/rules/href_or_on_click.js +5 -16
- package/lib/esm/rules/href_or_on_click.js.map +1 -1
- package/lib/esm/rules/no_css_color.js +22 -7
- package/lib/esm/rules/no_css_color.js.map +1 -1
- package/lib/esm/rules/no_restricted_eui_imports.js +5 -16
- package/lib/esm/rules/no_restricted_eui_imports.js.map +1 -1
- package/lib/esm/utils/are_attrs_equal.js +5 -16
- package/lib/esm/utils/are_attrs_equal.js.map +1 -1
- package/lib/esm/utils/constants.d.ts +26 -0
- package/lib/esm/utils/constants.js +119 -0
- package/lib/esm/utils/constants.js.map +1 -0
- package/lib/esm/utils/get_allowed_a11y_prop_names_for_component.d.ts +23 -0
- package/lib/esm/utils/get_allowed_a11y_prop_names_for_component.js +34 -0
- package/lib/esm/utils/get_allowed_a11y_prop_names_for_component.js.map +1 -0
- package/lib/esm/utils/get_attr_value.d.ts +2 -1
- package/lib/esm/utils/get_attr_value.js +11 -18
- package/lib/esm/utils/get_attr_value.js.map +1 -1
- package/lib/esm/utils/has_a11y_prop_for_component.d.ts +19 -0
- package/lib/esm/utils/has_a11y_prop_for_component.js +34 -0
- package/lib/esm/utils/has_a11y_prop_for_component.js.map +1 -0
- package/lib/esm/utils/has_spread.d.ts +11 -0
- package/lib/esm/utils/has_spread.js +23 -0
- package/lib/esm/utils/has_spread.js.map +1 -0
- package/lib/esm/utils/is_in_conditional_rendering.d.ts +2 -0
- package/lib/esm/utils/is_in_conditional_rendering.js +23 -0
- package/lib/esm/utils/is_in_conditional_rendering.js.map +1 -0
- package/lib/esm/utils/resolve_member_expression_root.js +7 -0
- package/lib/esm/utils/resolve_member_expression_root.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
*
|
|
4
|
-
* license agreements.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing,
|
|
14
|
-
* software distributed under the License is distributed on an
|
|
15
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
* KIND, either express or implied. See the License for the
|
|
17
|
-
* specific language governing permissions and limitations
|
|
18
|
-
* under the License.
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
19
8
|
*/
|
|
20
9
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
10
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no_restricted_eui_imports.js","sourceRoot":"","sources":["../../../src/rules/no_restricted_eui_imports.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"no_restricted_eui_imports.js","sourceRoot":"","sources":["../../../src/rules/no_restricted_eui_imports.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,4DAAoC;AAQpC,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,oBAAU,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;wBACpD,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"}
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
*
|
|
4
|
-
* license agreements.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing,
|
|
14
|
-
* software distributed under the License is distributed on an
|
|
15
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
* KIND, either express or implied. See the License for the
|
|
17
|
-
* specific language governing permissions and limitations
|
|
18
|
-
* under the License.
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
19
8
|
*/
|
|
20
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
10
|
exports.areAttrsEqual = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"are_attrs_equal.js","sourceRoot":"","sources":["../../../src/utils/are_attrs_equal.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"are_attrs_equal.js","sourceRoot":"","sources":["../../../src/utils/are_attrs_equal.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,MAAM,mBAAmB,GAAG,CAAC,GAAY,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAExE,MAAM,aAAa,GAAG,CAAC,GAAG,OAAkC,EAAW,EAAE;IAC9E,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAC1D,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;AACxC,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A list of standard HTML tags that are considered **non-interactive** elements.
|
|
3
|
+
*
|
|
4
|
+
* These tags generally do not provide any built-in user interaction
|
|
5
|
+
* (such as click, input, or focus behavior) and are typically used for
|
|
6
|
+
* layout, structure, or content presentation rather than direct
|
|
7
|
+
* interactivity.
|
|
8
|
+
*
|
|
9
|
+
* This constant can be useful when:
|
|
10
|
+
* - Determining whether an element should be treated as interactive.
|
|
11
|
+
* - Enforcing accessibility rules (e.g., ensuring interactive behavior is only applied to proper elements).
|
|
12
|
+
* - Filtering DOM nodes when processing or analyzing HTML structures.
|
|
13
|
+
*/
|
|
14
|
+
export declare const NON_INTERACTIVE_HTML_TAGS: string[];
|
|
15
|
+
/**
|
|
16
|
+
* A list of Elastic UI (EUI) React components that are considered **interactive**.
|
|
17
|
+
*
|
|
18
|
+
* These components are designed to be focusable and respond to user actions
|
|
19
|
+
* such as clicks, keyboard events, or other interactions. Use this constant
|
|
20
|
+
* when you need to determine if a given EUI component is inherently interactive,
|
|
21
|
+
* for example, when enforcing accessibility rules or filtering components
|
|
22
|
+
* for focus management.
|
|
23
|
+
*
|
|
24
|
+
* This list should be kept up to date with EUI's interactive component offerings.
|
|
25
|
+
*/
|
|
26
|
+
export declare const INTERACTIVE_EUI_COMPONENTS: string[];
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.INTERACTIVE_EUI_COMPONENTS = exports.NON_INTERACTIVE_HTML_TAGS = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* A list of standard HTML tags that are considered **non-interactive** elements.
|
|
13
|
+
*
|
|
14
|
+
* These tags generally do not provide any built-in user interaction
|
|
15
|
+
* (such as click, input, or focus behavior) and are typically used for
|
|
16
|
+
* layout, structure, or content presentation rather than direct
|
|
17
|
+
* interactivity.
|
|
18
|
+
*
|
|
19
|
+
* This constant can be useful when:
|
|
20
|
+
* - Determining whether an element should be treated as interactive.
|
|
21
|
+
* - Enforcing accessibility rules (e.g., ensuring interactive behavior is only applied to proper elements).
|
|
22
|
+
* - Filtering DOM nodes when processing or analyzing HTML structures.
|
|
23
|
+
*/
|
|
24
|
+
exports.NON_INTERACTIVE_HTML_TAGS = [
|
|
25
|
+
'div',
|
|
26
|
+
'span',
|
|
27
|
+
'p',
|
|
28
|
+
'article',
|
|
29
|
+
'aside',
|
|
30
|
+
'blockquote',
|
|
31
|
+
'br',
|
|
32
|
+
'caption',
|
|
33
|
+
'code',
|
|
34
|
+
'dd',
|
|
35
|
+
'dl',
|
|
36
|
+
'dt',
|
|
37
|
+
'figcaption',
|
|
38
|
+
'figure',
|
|
39
|
+
'h1',
|
|
40
|
+
'h2',
|
|
41
|
+
'h3',
|
|
42
|
+
'h4',
|
|
43
|
+
'h5',
|
|
44
|
+
'h6',
|
|
45
|
+
'hr',
|
|
46
|
+
'img',
|
|
47
|
+
'li',
|
|
48
|
+
'main',
|
|
49
|
+
'nav',
|
|
50
|
+
'ol',
|
|
51
|
+
'pre',
|
|
52
|
+
'section',
|
|
53
|
+
'small',
|
|
54
|
+
'strong',
|
|
55
|
+
'sub',
|
|
56
|
+
'sup',
|
|
57
|
+
'table',
|
|
58
|
+
'tbody',
|
|
59
|
+
'td',
|
|
60
|
+
'tfoot',
|
|
61
|
+
'th',
|
|
62
|
+
'thead',
|
|
63
|
+
'tr',
|
|
64
|
+
'ul'
|
|
65
|
+
];
|
|
66
|
+
/**
|
|
67
|
+
* A list of Elastic UI (EUI) React components that are considered **interactive**.
|
|
68
|
+
*
|
|
69
|
+
* These components are designed to be focusable and respond to user actions
|
|
70
|
+
* such as clicks, keyboard events, or other interactions. Use this constant
|
|
71
|
+
* when you need to determine if a given EUI component is inherently interactive,
|
|
72
|
+
* for example, when enforcing accessibility rules or filtering components
|
|
73
|
+
* for focus management.
|
|
74
|
+
*
|
|
75
|
+
* This list should be kept up to date with EUI's interactive component offerings.
|
|
76
|
+
*/
|
|
77
|
+
exports.INTERACTIVE_EUI_COMPONENTS = [
|
|
78
|
+
'EuiLink',
|
|
79
|
+
'EuiButton',
|
|
80
|
+
'EuiButtonEmpty',
|
|
81
|
+
'EuiButtonIcon',
|
|
82
|
+
'EuiFacetButton',
|
|
83
|
+
'EuiHeaderLink',
|
|
84
|
+
'EuiHeaderSectionItemButton',
|
|
85
|
+
'EuiHeaderLogo',
|
|
86
|
+
'EuiListGroupItem',
|
|
87
|
+
'EuiPinnableListGroup',
|
|
88
|
+
'EuiSideNav',
|
|
89
|
+
'EuiBreadcrumbs',
|
|
90
|
+
'EuiTab',
|
|
91
|
+
'EuiContextMenuItem',
|
|
92
|
+
'EuiKeyPadMenuItem',
|
|
93
|
+
'EuiPagination',
|
|
94
|
+
'EuiTreeView',
|
|
95
|
+
'EuiStepHorizontal',
|
|
96
|
+
'EuiCard',
|
|
97
|
+
'EuiCheckableCard',
|
|
98
|
+
'EuiBasicTable',
|
|
99
|
+
'EuiInMemoryTable',
|
|
100
|
+
'EuiFilterButton',
|
|
101
|
+
'EuiFilterSelectItem',
|
|
102
|
+
'EuiFilterSelectable',
|
|
103
|
+
'EuiBadge',
|
|
104
|
+
'EuiBetaBadge',
|
|
105
|
+
'EuiSelectable',
|
|
106
|
+
'EuiComboBox',
|
|
107
|
+
'EuiSuperSelect',
|
|
108
|
+
'EuiSelect',
|
|
109
|
+
'EuiCheckbox',
|
|
110
|
+
'EuiRadio',
|
|
111
|
+
'EuiSwitch',
|
|
112
|
+
'EuiButtonGroup',
|
|
113
|
+
'EuiRange',
|
|
114
|
+
'EuiDualRange',
|
|
115
|
+
'EuiColorPicker',
|
|
116
|
+
'EuiDatePicker',
|
|
117
|
+
'EuiSuperDatePicker'
|
|
118
|
+
];
|
|
119
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/utils/constants.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH;;;;;;;;;;;;GAYG;AACU,QAAA,yBAAyB,GAAG;IACvC,KAAK;IACL,MAAM;IACN,GAAG;IACH,SAAS;IACT,OAAO;IACP,YAAY;IACZ,IAAI;IACJ,SAAS;IACT,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,YAAY;IACZ,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,MAAM;IACN,KAAK;IACL,IAAI;IACJ,KAAK;IACL,SAAS;IACT,OAAO;IACP,QAAQ;IACR,KAAK;IACL,KAAK;IACL,OAAO;IACP,OAAO;IACP,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,OAAO;IACP,IAAI;IACJ,IAAI;CACL,CAAC;AAEF;;;;;;;;;;GAUG;AACU,QAAA,0BAA0B,GAAG;IACxC,SAAS;IACT,WAAW;IACX,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,4BAA4B;IAC5B,eAAe;IACf,kBAAkB;IAClB,sBAAsB;IACtB,YAAY;IACZ,gBAAgB;IAChB,QAAQ;IACR,oBAAoB;IACpB,mBAAmB;IACnB,eAAe;IACf,aAAa;IACb,mBAAmB;IACnB,SAAS;IACT,kBAAkB;IAClB,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,qBAAqB;IACrB,qBAAqB;IACrB,UAAU;IACV,cAAc;IACd,eAAe;IACf,aAAa;IACb,gBAAgB;IAChB,WAAW;IACX,aAAa;IACb,UAAU;IACV,WAAW;IACX,gBAAgB;IAChB,UAAU;IACV,cAAc;IACd,gBAAgB;IAChB,eAAe;IACf,oBAAoB;CACrB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration describing which components accept a `label` prop
|
|
3
|
+
* and the baseline set of accessibility prop names allowed across components.
|
|
4
|
+
*/
|
|
5
|
+
export type A11yConfig = {
|
|
6
|
+
interactiveComponentsWithLabel: ReadonlyArray<string>;
|
|
7
|
+
wrappingComponents: ReadonlyArray<string>;
|
|
8
|
+
baseA11yProps: ReadonlyArray<string>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Compute the set of allowed accessibility prop names for a given component.
|
|
12
|
+
*
|
|
13
|
+
* - Always includes the provided `baseA11yProps`.
|
|
14
|
+
* - Conditionally includes `label` if the component is listed in either
|
|
15
|
+
* `interactiveComponentsWithLabel` or `wrappingComponents`.
|
|
16
|
+
* - Does **not** mutate the provided configuration; a new array is returned.
|
|
17
|
+
*
|
|
18
|
+
* @param componentName - The EUI component name (e.g., `'EuiButtonIcon'`).
|
|
19
|
+
* @param cfg - The accessibility configuration to use when resolving allowed props.
|
|
20
|
+
* @returns A new array of allowed prop names for `componentName`.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export declare function getAllowedA11yPropNamesForComponent(componentName: string, cfg: A11yConfig): string[];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getAllowedA11yPropNamesForComponent = getAllowedA11yPropNamesForComponent;
|
|
11
|
+
/**
|
|
12
|
+
* Compute the set of allowed accessibility prop names for a given component.
|
|
13
|
+
*
|
|
14
|
+
* - Always includes the provided `baseA11yProps`.
|
|
15
|
+
* - Conditionally includes `label` if the component is listed in either
|
|
16
|
+
* `interactiveComponentsWithLabel` or `wrappingComponents`.
|
|
17
|
+
* - Does **not** mutate the provided configuration; a new array is returned.
|
|
18
|
+
*
|
|
19
|
+
* @param componentName - The EUI component name (e.g., `'EuiButtonIcon'`).
|
|
20
|
+
* @param cfg - The accessibility configuration to use when resolving allowed props.
|
|
21
|
+
* @returns A new array of allowed prop names for `componentName`.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
function getAllowedA11yPropNamesForComponent(componentName, cfg) {
|
|
25
|
+
const componentsWithLabel = new Set([
|
|
26
|
+
...cfg.interactiveComponentsWithLabel,
|
|
27
|
+
...cfg.wrappingComponents,
|
|
28
|
+
]);
|
|
29
|
+
if (componentsWithLabel.has(componentName)) {
|
|
30
|
+
return [...cfg.baseA11yProps, 'label'];
|
|
31
|
+
}
|
|
32
|
+
return [...cfg.baseA11yProps];
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=get_allowed_a11y_prop_names_for_component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_allowed_a11y_prop_names_for_component.js","sourceRoot":"","sources":["../../../src/utils/get_allowed_a11y_prop_names_for_component.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAyBH,kFAaC;AA1BD;;;;;;;;;;;;GAYG;AACH,SAAgB,mCAAmC,CACjD,aAAqB,EACrB,GAAe;IAEf,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAS;QAC1C,GAAG,GAAG,CAAC,8BAA8B;QACrC,GAAG,GAAG,CAAC,kBAAkB;KAC1B,CAAC,CAAC;IAEH,IAAI,mBAAmB,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;QAC3C,OAAO,CAAC,GAAG,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,CAAC,GAAG,GAAG,CAAC,aAAa,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { type TSESTree, type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function findAttrValue<TContext extends TSESLint.RuleContext<string, unknown[]>>(context: TContext, attributes: TSESTree.JSXOpeningElement['attributes'], attrName: string): string | undefined;
|
|
3
|
+
export declare function extractAttrValue<TContext extends TSESLint.RuleContext<string, unknown[]>>(context: TContext, attr: TSESTree.JSXAttribute | undefined): string | undefined;
|
|
@@ -1,28 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
*
|
|
4
|
-
* license agreements.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* not use this file except in compliance with the License.
|
|
9
|
-
* You may obtain a copy of the License at
|
|
10
|
-
*
|
|
11
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing,
|
|
14
|
-
* software distributed under the License is distributed on an
|
|
15
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
-
* KIND, either express or implied. See the License for the
|
|
17
|
-
* specific language governing permissions and limitations
|
|
18
|
-
* under the License.
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
19
8
|
*/
|
|
20
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.
|
|
22
|
-
|
|
10
|
+
exports.findAttrValue = findAttrValue;
|
|
11
|
+
exports.extractAttrValue = extractAttrValue;
|
|
12
|
+
function findAttrValue(context, attributes, attrName) {
|
|
23
13
|
const attr = attributes.find((attr) => attr.type === 'JSXAttribute' &&
|
|
24
14
|
attr.name.type === 'JSXIdentifier' &&
|
|
25
15
|
attr.name.name === attrName);
|
|
16
|
+
return extractAttrValue(context, attr);
|
|
17
|
+
}
|
|
18
|
+
function extractAttrValue(context, attr) {
|
|
26
19
|
if (!attr?.value) {
|
|
27
20
|
return undefined;
|
|
28
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_attr_value.js","sourceRoot":"","sources":["../../../src/utils/get_attr_value.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"get_attr_value.js","sourceRoot":"","sources":["../../../src/utils/get_attr_value.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAIH,sCAeC;AAED,4CA0BC;AA3CD,SAAgB,aAAa,CAG3B,OAAiB,EACjB,UAAoD,EACpD,QAAgB;IAEhB,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAC1B,CAAC,IAAI,EAAiC,EAAE,CACtC,IAAI,CAAC,IAAI,KAAK,cAAc;QAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe;QAClC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,CAC9B,CAAC;IAEF,OAAO,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,SAAgB,gBAAgB,CAG9B,OAAiB,EACjB,IAAuC;IAGvC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,wBAAwB,EAAE,CAAC;QACjD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAEzC,IAAI,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAClC,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
import { type A11yConfig } from './get_allowed_a11y_prop_names_for_component';
|
|
3
|
+
/**
|
|
4
|
+
* Determines whether a JSX element declares at least one **allowed**
|
|
5
|
+
* accessibility-related prop for a given component.
|
|
6
|
+
*
|
|
7
|
+
* Allowed prop names are resolved via {@link getAllowedA11yPropNamesForComponent},
|
|
8
|
+
* which combines baseline a11y props (e.g. `aria-*`) and conditionally adds
|
|
9
|
+
* `label` for components that support it per the provided configuration.
|
|
10
|
+
*
|
|
11
|
+
* Only plain `JSXAttribute` nodes are considered—spread attributes are ignored here.
|
|
12
|
+
*
|
|
13
|
+
* @param componentName - The component name being checked (e.g., `"EuiButtonIcon"`).
|
|
14
|
+
* @param attrs - The attributes array from a `JSXOpeningElement` (ESTree).
|
|
15
|
+
* @param cfg - Accessibility configuration that defines base props and which
|
|
16
|
+
* components may accept a `label` prop.
|
|
17
|
+
* @returns `true` if any attribute name on the element is in the allowed set; otherwise `false`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function hasA11yPropForComponent(componentName: string, attrs: TSESTree.JSXOpeningElement['attributes'], cfg: A11yConfig): boolean;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.hasA11yPropForComponent = hasA11yPropForComponent;
|
|
11
|
+
const get_allowed_a11y_prop_names_for_component_1 = require("./get_allowed_a11y_prop_names_for_component");
|
|
12
|
+
/**
|
|
13
|
+
* Determines whether a JSX element declares at least one **allowed**
|
|
14
|
+
* accessibility-related prop for a given component.
|
|
15
|
+
*
|
|
16
|
+
* Allowed prop names are resolved via {@link getAllowedA11yPropNamesForComponent},
|
|
17
|
+
* which combines baseline a11y props (e.g. `aria-*`) and conditionally adds
|
|
18
|
+
* `label` for components that support it per the provided configuration.
|
|
19
|
+
*
|
|
20
|
+
* Only plain `JSXAttribute` nodes are considered—spread attributes are ignored here.
|
|
21
|
+
*
|
|
22
|
+
* @param componentName - The component name being checked (e.g., `"EuiButtonIcon"`).
|
|
23
|
+
* @param attrs - The attributes array from a `JSXOpeningElement` (ESTree).
|
|
24
|
+
* @param cfg - Accessibility configuration that defines base props and which
|
|
25
|
+
* components may accept a `label` prop.
|
|
26
|
+
* @returns `true` if any attribute name on the element is in the allowed set; otherwise `false`.
|
|
27
|
+
*/
|
|
28
|
+
function hasA11yPropForComponent(componentName, attrs, cfg) {
|
|
29
|
+
const allowed = new Set((0, get_allowed_a11y_prop_names_for_component_1.getAllowedA11yPropNamesForComponent)(componentName, cfg));
|
|
30
|
+
return attrs.some((attr) => attr.type === 'JSXAttribute' &&
|
|
31
|
+
attr.name.type === 'JSXIdentifier' &&
|
|
32
|
+
allowed.has(attr.name.name));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=has_a11y_prop_for_component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has_a11y_prop_for_component.js","sourceRoot":"","sources":["../../../src/utils/has_a11y_prop_for_component.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAyBH,0DAcC;AApCD,2GAGqD;AAErD;;;;;;;;;;;;;;;GAeG;AAEH,SAAgB,uBAAuB,CACrC,aAAqB,EACrB,KAA+C,EAC/C,GAAe;IAEf,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,IAAA,+EAAmC,EAAC,aAAa,EAAE,GAAG,CAAC,CACxD,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CACf,CAAC,IAAI,EAAiC,EAAE,CACtC,IAAI,CAAC,IAAI,KAAK,cAAc;QAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe;QAClC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether a JSX opening element contains a spread attribute
|
|
4
|
+
* (e.g., `...props`). Spreads make it impossible to statically know
|
|
5
|
+
* all props present on an element, so ESLint rules often use this as
|
|
6
|
+
* a quick bail-out to avoid false positives.
|
|
7
|
+
*
|
|
8
|
+
* @param attrs - The attributes array from a `JSXOpeningElement` node (ESTree).
|
|
9
|
+
* @returns `true` if any attribute is a `JSXSpreadAttribute`; otherwise `false`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function hasSpread(attrs: TSESTree.JSXOpeningElement['attributes']): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.hasSpread = hasSpread;
|
|
11
|
+
/**
|
|
12
|
+
* Checks whether a JSX opening element contains a spread attribute
|
|
13
|
+
* (e.g., `...props`). Spreads make it impossible to statically know
|
|
14
|
+
* all props present on an element, so ESLint rules often use this as
|
|
15
|
+
* a quick bail-out to avoid false positives.
|
|
16
|
+
*
|
|
17
|
+
* @param attrs - The attributes array from a `JSXOpeningElement` node (ESTree).
|
|
18
|
+
* @returns `true` if any attribute is a `JSXSpreadAttribute`; otherwise `false`.
|
|
19
|
+
*/
|
|
20
|
+
function hasSpread(attrs) {
|
|
21
|
+
return attrs.some((a) => a.type === 'JSXSpreadAttribute');
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=has_spread.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has_spread.js","sourceRoot":"","sources":["../../../src/utils/has_spread.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAcH,8BAIC;AAdD;;;;;;;;GAQG;AAEH,SAAgB,SAAS,CACvB,KAA+C;IAE/C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,oBAAoB,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.isInConditionalRendering = isInConditionalRendering;
|
|
11
|
+
function isInConditionalRendering(node) {
|
|
12
|
+
let parent = node.parent;
|
|
13
|
+
while (parent) {
|
|
14
|
+
if (parent.type === 'ConditionalExpression' ||
|
|
15
|
+
parent.type === 'IfStatement' ||
|
|
16
|
+
(parent.type === 'LogicalExpression' && parent.operator === '&&')) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
parent = parent.parent;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=is_in_conditional_rendering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is_in_conditional_rendering.js","sourceRoot":"","sources":["../../../src/utils/is_in_conditional_rendering.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAIH,4DAWC;AAXD,SAAgB,wBAAwB,CAAC,IAAyB;IAChE,IAAI,MAAM,GAA8B,IAAI,CAAC,MAAM,CAAC;IACpD,OAAO,MAAM,EAAE,CAAC;QACd,IAAI,MAAM,CAAC,IAAI,KAAK,uBAAuB;YACzC,MAAM,CAAC,IAAI,KAAK,aAAa;YAC7B,CAAC,MAAM,CAAC,IAAI,KAAK,mBAAmB,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC;YACpE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.resolveMemberExpressionRoot = void 0;
|
|
4
11
|
const resolveMemberExpressionRoot = (node) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_member_expression_root.js","sourceRoot":"","sources":["../../../src/utils/resolve_member_expression_root.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"resolve_member_expression_root.js","sourceRoot":"","sources":["../../../src/utils/resolve_member_expression_root.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAII,MAAM,2BAA2B,GAAG,CACzC,IAA+B,EACV,EAAE;IACvB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;QAC5C,OAAO,IAAA,mCAA2B,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,IAAI,CAAC,MAA6B,CAAC;AAC5C,CAAC,CAAC;AARW,QAAA,2BAA2B,+BAQtC"}
|