@elastic/eslint-plugin-eui 2.2.1 → 2.3.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.
Files changed (28) hide show
  1. package/README.md +5 -1
  2. package/lib/cjs/index.js +5 -2
  3. package/lib/cjs/rules/a11y/consistent_is_invalid_props.d.ts.map +1 -1
  4. package/lib/cjs/rules/a11y/consistent_is_invalid_props.js +2 -1
  5. package/lib/cjs/rules/a11y/no_unnamed_radio_group.d.ts +3 -0
  6. package/lib/cjs/rules/a11y/no_unnamed_radio_group.d.ts.map +1 -0
  7. package/lib/cjs/rules/a11y/no_unnamed_radio_group.js +58 -0
  8. package/lib/cjs/rules/a11y/require_aria_label_for_modals.js +1 -1
  9. package/lib/cjs/rules/a11y/sr_output_disabled_tooltip.d.ts.map +1 -1
  10. package/lib/cjs/rules/a11y/sr_output_disabled_tooltip.js +2 -2
  11. package/lib/cjs/utils/are_attrs_equal.d.ts +2 -0
  12. package/lib/cjs/utils/are_attrs_equal.d.ts.map +1 -0
  13. package/lib/cjs/utils/are_attrs_equal.js +31 -0
  14. package/lib/esm/index.js +3 -0
  15. package/lib/esm/index.js.map +1 -1
  16. package/lib/esm/rules/a11y/consistent_is_invalid_props.js +2 -1
  17. package/lib/esm/rules/a11y/consistent_is_invalid_props.js.map +1 -1
  18. package/lib/esm/rules/a11y/no_unnamed_radio_group.d.ts +2 -0
  19. package/lib/esm/rules/a11y/no_unnamed_radio_group.js +56 -0
  20. package/lib/esm/rules/a11y/no_unnamed_radio_group.js.map +1 -0
  21. package/lib/esm/rules/a11y/require_aria_label_for_modals.js +1 -1
  22. package/lib/esm/rules/a11y/require_aria_label_for_modals.js.map +1 -1
  23. package/lib/esm/rules/a11y/sr_output_disabled_tooltip.js +2 -2
  24. package/lib/esm/rules/a11y/sr_output_disabled_tooltip.js.map +1 -1
  25. package/lib/esm/utils/are_attrs_equal.d.ts +1 -0
  26. package/lib/esm/utils/are_attrs_equal.js +28 -0
  27. package/lib/esm/utils/are_attrs_equal.js.map +1 -0
  28. package/package.json +1 -1
package/README.md CHANGED
@@ -129,7 +129,7 @@ It's worth pointing out that although the examples provided are specific to EUI
129
129
 
130
130
  ### `@elastic/eui/require-aria-label-for-modals`
131
131
 
132
- Ensures that EUI modal components (`EuiModal`, `EuiFlyout`, `EuiConfirmModal`) have either an `aria-label` or `aria-labelledby` prop for accessibility. This helps screen reader users understand the purpose and content of modal dialogs.
132
+ Ensures that EUI modal components (`EuiModal`, `EuiFlyout`, `EuiFlyoutResizable` ,`EuiConfirmModal`) have either an `aria-label` or `aria-labelledby` prop for accessibility. This helps screen reader users understand the purpose and content of modal dialogs.
133
133
 
134
134
  ### `@elastic/eui/consistent-is-invalid-props`
135
135
 
@@ -143,6 +143,10 @@ Ensures `disableScreenReaderOutput` is set when `EuiToolTip` content matches `Eu
143
143
 
144
144
  Ensure `EuiIconTip` is used rather than `<EuiToolTip><EuiIcon/></EuiToolTip>`, as it provides better accessibility and improved support for assistive technologies.
145
145
 
146
+ ### `@elastic/eui/no-unnamed-radio-group`
147
+
148
+ Ensure that all radio input components (`EuiRadio`, `EuiRadioGroup`) have a `name` attribute. The `name` attribute is required for radio inputs to be grouped correctly, allowing users to select only one option from a set. Without a `name`, radios may not behave as expected and can cause accessibility issues for assistive technologies.
149
+
146
150
  ## Testing
147
151
 
148
152
  ### Running unit tests
package/lib/cjs/index.js CHANGED
@@ -7,6 +7,7 @@ var _require_aria_label_for_modals = require("./rules/a11y/require_aria_label_fo
7
7
  var _consistent_is_invalid_props = require("./rules/a11y/consistent_is_invalid_props");
8
8
  var _sr_output_disabled_tooltip = require("./rules/a11y/sr_output_disabled_tooltip");
9
9
  var _prefer_eui_icon_tip = require("./rules/a11y/prefer_eui_icon_tip");
10
+ var _no_unnamed_radio_group = require("./rules/a11y/no_unnamed_radio_group");
10
11
  /*
11
12
  * Licensed to Elasticsearch B.V. under one or more contributor
12
13
  * license agreements. See the NOTICE file distributed with
@@ -34,7 +35,8 @@ const config = {
34
35
  'require-aria-label-for-modals': _require_aria_label_for_modals.RequireAriaLabelForModals,
35
36
  'consistent-is-invalid-props': _consistent_is_invalid_props.ConsistentIsInvalidProps,
36
37
  'sr-output-disabled-tooltip': _sr_output_disabled_tooltip.ScreenReaderOutputDisabledTooltip,
37
- 'prefer-eui-icon-tip': _prefer_eui_icon_tip.PreferEuiIconTip
38
+ 'prefer-eui-icon-tip': _prefer_eui_icon_tip.PreferEuiIconTip,
39
+ 'no-unnamed-radio-group': _no_unnamed_radio_group.NoUnnamedRadioGroup
38
40
  },
39
41
  configs: {
40
42
  recommended: {
@@ -46,7 +48,8 @@ const config = {
46
48
  '@elastic/eui/require-aria-label-for-modals': 'warn',
47
49
  '@elastic/eui/consistent-is-invalid-props': 'warn',
48
50
  '@elastic/eui/sr-output-disabled-tooltip': 'warn',
49
- '@elastic/eui/prefer-eui-icon-tip': 'warn'
51
+ '@elastic/eui/prefer-eui-icon-tip': 'warn',
52
+ '@elastic/eui/no-unnamed-radio-group': 'warn'
50
53
  }
51
54
  }
52
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"consistent_is_invalid_props.d.ts","sourceRoot":"","sources":["../../../../src/rules/a11y/consistent_is_invalid_props.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAiB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAetE,eAAO,MAAM,wBAAwB,wFA6FnC,CAAC"}
1
+ {"version":3,"file":"consistent_is_invalid_props.d.ts","sourceRoot":"","sources":["../../../../src/rules/a11y/consistent_is_invalid_props.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAiB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAiBtE,eAAO,MAAM,wBAAwB,wFA6FnC,CAAC"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.ConsistentIsInvalidProps = void 0;
7
7
  var _utils = require("@typescript-eslint/utils");
8
8
  var _get_attr_value = require("../../utils/get_attr_value");
9
+ var _are_attrs_equal = require("../../utils/are_attrs_equal");
9
10
  /*
10
11
  * Licensed to Elasticsearch B.V. under one or more contributor
11
12
  * license agreements. See the NOTICE file distributed with
@@ -44,7 +45,7 @@ const ConsistentIsInvalidProps = exports.ConsistentIsInvalidProps = _utils.ESLin
44
45
  return;
45
46
  }
46
47
  const childIsInvalid = (0, _get_attr_value.getAttrValue)(context, childElement.openingElement.attributes, 'isInvalid');
47
- if (childIsInvalid !== formRowIsInvalid) {
48
+ if (!(0, _are_attrs_equal.areAttrsEqual)(childIsInvalid, formRowIsInvalid)) {
48
49
  const componentName = childElement.openingElement.name.name;
49
50
  context.report({
50
51
  node: childElement,
@@ -0,0 +1,3 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ export declare const NoUnnamedRadioGroup: ESLintUtils.RuleModule<"missingRadioName", [], unknown, ESLintUtils.RuleListener>;
3
+ //# sourceMappingURL=no_unnamed_radio_group.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no_unnamed_radio_group.d.ts","sourceRoot":"","sources":["../../../../src/rules/a11y/no_unnamed_radio_group.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,eAAO,MAAM,mBAAmB,mFAuC9B,CAAC"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NoUnnamedRadioGroup = void 0;
7
+ var _utils = require("@typescript-eslint/utils");
8
+ /*
9
+ * Licensed to Elasticsearch B.V. under one or more contributor
10
+ * license agreements. See the NOTICE file distributed with
11
+ * this work for additional information regarding copyright
12
+ * ownership. Elasticsearch B.V. licenses this file to you under
13
+ * the Apache License, Version 2.0 (the "License"); you may
14
+ * not use this file except in compliance with the License.
15
+ * You may obtain a copy of the License at
16
+ *
17
+ * http://www.apache.org/licenses/LICENSE-2.0
18
+ *
19
+ * Unless required by applicable law or agreed to in writing,
20
+ * software distributed under the License is distributed on an
21
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22
+ * KIND, either express or implied. See the License for the
23
+ * specific language governing permissions and limitations
24
+ * under the License.
25
+ */
26
+
27
+ const radioComponents = ['EuiRadio', 'EuiRadioGroup'];
28
+ const NoUnnamedRadioGroup = exports.NoUnnamedRadioGroup = _utils.ESLintUtils.RuleCreator.withoutDocs({
29
+ create(context) {
30
+ return {
31
+ JSXOpeningElement(node) {
32
+ if (node.name.type === 'JSXIdentifier' && radioComponents.includes(node.name.name)) {
33
+ const hasNameAttr = node.attributes.some(attr => attr.type === 'JSXAttribute' && attr.name.type === 'JSXIdentifier' && attr.name.name === 'name');
34
+ if (!hasNameAttr) {
35
+ context.report({
36
+ node,
37
+ messageId: 'missingRadioName',
38
+ data: {
39
+ component: node.name.name
40
+ }
41
+ });
42
+ }
43
+ }
44
+ }
45
+ };
46
+ },
47
+ meta: {
48
+ type: 'problem',
49
+ docs: {
50
+ description: 'Ensure that all radio input components have a `name` attribute. The `name` attribute is required for radio inputs to be grouped correctly, allowing users to select only one option from a set. Without a `name`, radios may not behave as expected and can cause accessibility issues for assistive technologies.'
51
+ },
52
+ schema: [],
53
+ messages: {
54
+ missingRadioName: '{{ component }} must have a `name` attribute. The `name` attribute is required for radio inputs to be grouped correctly, ensuring only one option can be selected and improving accessibility for all users.'
55
+ }
56
+ },
57
+ defaultOptions: []
58
+ });
@@ -24,7 +24,7 @@ var _utils = require("@typescript-eslint/utils");
24
24
  * under the License.
25
25
  */
26
26
 
27
- const modalComponents = ['EuiModal', 'EuiFlyout'];
27
+ const modalComponents = ['EuiModal', 'EuiFlyout', 'EuiFlyoutResizable'];
28
28
  const confirmModalComponents = ['EuiConfirmModal'];
29
29
  const RequireAriaLabelForModals = exports.RequireAriaLabelForModals = _utils.ESLintUtils.RuleCreator.withoutDocs({
30
30
  create(context) {
@@ -1 +1 @@
1
- {"version":3,"file":"sr_output_disabled_tooltip.d.ts","sourceRoot":"","sources":["../../../../src/rules/a11y/sr_output_disabled_tooltip.ts"],"names":[],"mappings":"AAQA,OAAO,EAAiB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAStE,eAAO,MAAM,iCAAiC,6FA6F1C,CAAC"}
1
+ {"version":3,"file":"sr_output_disabled_tooltip.d.ts","sourceRoot":"","sources":["../../../../src/rules/a11y/sr_output_disabled_tooltip.ts"],"names":[],"mappings":"AAQA,OAAO,EAAiB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAQtE,eAAO,MAAM,iCAAiC,6FA6F1C,CAAC"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.ScreenReaderOutputDisabledTooltip = void 0;
7
7
  var _utils = require("@typescript-eslint/utils");
8
8
  var _get_attr_value = require("../../utils/get_attr_value");
9
+ var _are_attrs_equal = require("../../utils/are_attrs_equal");
9
10
  /*
10
11
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
12
  * or more contributor license agreements. Licensed under the Elastic License
@@ -17,7 +18,6 @@ var _get_attr_value = require("../../utils/get_attr_value");
17
18
  const tooltipComponent = 'EuiToolTip';
18
19
  const disabledTooltipComponentProp = 'disableScreenReaderOutput';
19
20
  const buttonComponents = ['EuiButtonIcon'];
20
- const normalizeAttrString = str => str?.trim().replace(/\s+/g, ' ');
21
21
  const ScreenReaderOutputDisabledTooltip = exports.ScreenReaderOutputDisabledTooltip = _utils.ESLintUtils.RuleCreator.withoutDocs({
22
22
  create(context) {
23
23
  return {
@@ -36,7 +36,7 @@ const ScreenReaderOutputDisabledTooltip = exports.ScreenReaderOutputDisabledTool
36
36
  return;
37
37
  }
38
38
  const ariaLabel = (0, _get_attr_value.getAttrValue)(context, buttonElement.openingElement.attributes, 'aria-label');
39
- if (tooltipContent && ariaLabel && normalizeAttrString(tooltipContent) === normalizeAttrString(ariaLabel)) {
39
+ if (tooltipContent && ariaLabel && (0, _are_attrs_equal.areAttrsEqual)(tooltipContent, ariaLabel)) {
40
40
  const buttonElementName = buttonElement.openingElement.name.name;
41
41
  context.report({
42
42
  node: openingElement,
@@ -0,0 +1,2 @@
1
+ export declare const areAttrsEqual: (...strings: Array<string | undefined>) => boolean;
2
+ //# sourceMappingURL=are_attrs_equal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"are_attrs_equal.d.ts","sourceRoot":"","sources":["../../../src/utils/are_attrs_equal.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,aAAa,GAAI,GAAG,SAAS,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,KAAG,OAGrE,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.areAttrsEqual = void 0;
7
+ /*
8
+ * Licensed to Elasticsearch B.V. under one or more contributor
9
+ * license agreements. See the NOTICE file distributed with
10
+ * this work for additional information regarding copyright
11
+ * ownership. Elasticsearch B.V. licenses this file to you under
12
+ * the Apache License, Version 2.0 (the "License"); you may
13
+ * not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * http://www.apache.org/licenses/LICENSE-2.0
17
+ *
18
+ * Unless required by applicable law or agreed to in writing,
19
+ * software distributed under the License is distributed on an
20
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
+ * KIND, either express or implied. See the License for the
22
+ * specific language governing permissions and limitations
23
+ * under the License.
24
+ */
25
+
26
+ const normalizeAttrString = str => str?.trim().replace(/\s+/g, ' ');
27
+ const areAttrsEqual = (...strings) => {
28
+ const [first, ...rest] = strings.map(normalizeAttrString);
29
+ return rest.every(s => s === first);
30
+ };
31
+ exports.areAttrsEqual = areAttrsEqual;
package/lib/esm/index.js CHANGED
@@ -25,6 +25,7 @@ const require_aria_label_for_modals_1 = require("./rules/a11y/require_aria_label
25
25
  const consistent_is_invalid_props_1 = require("./rules/a11y/consistent_is_invalid_props");
26
26
  const sr_output_disabled_tooltip_1 = require("./rules/a11y/sr_output_disabled_tooltip");
27
27
  const prefer_eui_icon_tip_1 = require("./rules/a11y/prefer_eui_icon_tip");
28
+ const no_unnamed_radio_group_1 = require("./rules/a11y/no_unnamed_radio_group");
28
29
  const config = {
29
30
  rules: {
30
31
  'href-or-on-click': href_or_on_click_1.HrefOnClick,
@@ -34,6 +35,7 @@ const config = {
34
35
  'consistent-is-invalid-props': consistent_is_invalid_props_1.ConsistentIsInvalidProps,
35
36
  'sr-output-disabled-tooltip': sr_output_disabled_tooltip_1.ScreenReaderOutputDisabledTooltip,
36
37
  'prefer-eui-icon-tip': prefer_eui_icon_tip_1.PreferEuiIconTip,
38
+ 'no-unnamed-radio-group': no_unnamed_radio_group_1.NoUnnamedRadioGroup,
37
39
  },
38
40
  configs: {
39
41
  recommended: {
@@ -46,6 +48,7 @@ const config = {
46
48
  '@elastic/eui/consistent-is-invalid-props': 'warn',
47
49
  '@elastic/eui/sr-output-disabled-tooltip': 'warn',
48
50
  '@elastic/eui/prefer-eui-icon-tip': 'warn',
51
+ '@elastic/eui/no-unnamed-radio-group': 'warn',
49
52
  },
50
53
  },
51
54
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAEH,+DAAuD;AACvD,iFAA2E;AAC3E,uDAAkD;AAElD,8FAAuF;AACvF,0FAAoF;AACpF,wFAA4F;AAC5F,0EAAoE;AAEpE,MAAM,MAAM,GAAG;IACb,KAAK,EAAE;QACL,kBAAkB,EAAE,8BAAW;QAC/B,2BAA2B,EAAE,kDAAsB;QACnD,cAAc,EAAE,yBAAU;QAC1B,+BAA+B,EAAE,yDAAyB;QAC1D,6BAA6B,EAAE,sDAAwB;QACvD,4BAA4B,EAAE,8DAAiC;QAC/D,qBAAqB,EAAE,sCAAgB;KACxC;IACD,OAAO,EAAE;QACP,WAAW,EAAE;YACX,OAAO,EAAE,CAAC,4BAA4B,CAAC;YACvC,KAAK,EAAE;gBACL,+BAA+B,EAAE,MAAM;gBACvC,wCAAwC,EAAE,MAAM;gBAChD,2BAA2B,EAAE,MAAM;gBACnC,4CAA4C,EAAE,MAAM;gBACpD,0CAA0C,EAAE,MAAM;gBAClD,yCAAyC,EAAE,MAAM;gBACjD,kCAAkC,EAAE,MAAM;aAC3C;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAEH,+DAAuD;AACvD,iFAA2E;AAC3E,uDAAkD;AAElD,8FAAuF;AACvF,0FAAoF;AACpF,wFAA4F;AAC5F,0EAAoE;AACpE,gFAA0E;AAE1E,MAAM,MAAM,GAAG;IACb,KAAK,EAAE;QACL,kBAAkB,EAAE,8BAAW;QAC/B,2BAA2B,EAAE,kDAAsB;QACnD,cAAc,EAAE,yBAAU;QAC1B,+BAA+B,EAAE,yDAAyB;QAC1D,6BAA6B,EAAE,sDAAwB;QACvD,4BAA4B,EAAE,8DAAiC;QAC/D,qBAAqB,EAAE,sCAAgB;QACvC,wBAAwB,EAAG,4CAAmB;KAC/C;IACD,OAAO,EAAE;QACP,WAAW,EAAE;YACX,OAAO,EAAE,CAAC,4BAA4B,CAAC;YACvC,KAAK,EAAE;gBACL,+BAA+B,EAAE,MAAM;gBACvC,wCAAwC,EAAE,MAAM;gBAChD,2BAA2B,EAAE,MAAM;gBACnC,4CAA4C,EAAE,MAAM;gBACpD,0CAA0C,EAAE,MAAM;gBAClD,yCAAyC,EAAE,MAAM;gBACjD,kCAAkC,EAAE,MAAM;gBAC1C,qCAAqC,EAAE,MAAM;aAC9C;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"}
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.ConsistentIsInvalidProps = void 0;
22
22
  const utils_1 = require("@typescript-eslint/utils");
23
23
  const get_attr_value_1 = require("../../utils/get_attr_value");
24
+ const are_attrs_equal_1 = require("../../utils/are_attrs_equal");
24
25
  const formControlComponent = 'EuiFormRow';
25
26
  const formControlChildComponents = [
26
27
  'EuiFieldNumber',
@@ -53,7 +54,7 @@ exports.ConsistentIsInvalidProps = utils_1.ESLintUtils.RuleCreator.withoutDocs({
53
54
  return;
54
55
  }
55
56
  const childIsInvalid = (0, get_attr_value_1.getAttrValue)(context, childElement.openingElement.attributes, 'isInvalid');
56
- if (childIsInvalid !== formRowIsInvalid) {
57
+ if (!(0, are_attrs_equal_1.areAttrsEqual)(childIsInvalid, formRowIsInvalid)) {
57
58
  const componentName = childElement.openingElement.name.name;
58
59
  context.report({
59
60
  node: childElement,
@@ -1 +1 @@
1
- {"version":3,"file":"consistent_is_invalid_props.js","sourceRoot":"","sources":["../../../../src/rules/a11y/consistent_is_invalid_props.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,oDAAsE;AACtE,+DAA0D;AAC1D,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAE1C,MAAM,0BAA0B,GAAG;IACjC,gBAAgB;IAChB,eAAe;IACf,cAAc;IACd,aAAa;IACb,aAAa;IACb,+BAA+B;IAC/B,mBAAmB;IACnB,WAAW;CACZ,CAAC;AAEW,QAAA,wBAAwB,GAAG,mBAAW,CAAC,WAAW,CAAC,WAAW,CAAC;IAC1E,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,UAAU,CAAC,IAAI;gBACb,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;gBAE3C,IACE,cAAc,EAAE,IAAI,CAAC,IAAI,KAAK,eAAe;oBAC7C,cAAc,CAAC,IAAI,CAAC,IAAI,KAAK,oBAAoB;oBACjD,cAAc,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EACtC,CAAC;oBACD,OAAO;gBACT,CAAC;gBAED,MAAM,gBAAg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AED,MAAM,cAAc,GAAG,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;4BAEjE,OAAO,KAAK,CAAC,oBAAoB,CAC/B,CAAC,cAAc,EAAE,cAAc,CAAC,EAChC,eAAe,gBAAgB,GAAG,CACnC,CAAC;wBACJ,CAAC;wBACD,IAAI,EAAE;4BACJ,oBAAoB,EAAE,oBAAoB;4BAC1C,SAAS,EAAE,aAAa;yBACzB;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,oFAAoF;SAClG;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,qBAAqB,EAAE,mGAAmG;SAC3H;KACF;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
1
+ {"version":3,"file":"consistent_is_invalid_props.js","sourceRoot":"","sources":["../../../../src/rules/a11y/consistent_is_invalid_props.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,oDAAsE;AACtE,+DAA0D;AAC1D,iEAA4D;AAE5D,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAE1C,MAAM,0BAA0B,GAAG;IACjC,gBAAgB;IAChB,eAAe;IACf,cAAc;IACd,aAAa;IACb,aAAa;IACb,+BAA+B;IAC/B,mBAAmB;IACnB,WAAW;CACZ,CAAC;AAEW,QAAA,wBAAwB,GAAG,mBAAW,CAAC,WAAW,CAAC,WAAW,CAAC;IAC1E,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,UAAU,CAAC,IAAI;gBACb,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;gBAE3C,IACE,cAAc,EAAE,IAAI,CAAC,IAAI,KAAK,eAAe;oBAC7C,cAAc,CAAC,IAAI,CAAC,IAAI,KAAK,oBAAoB;o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BAEJ,IAAI,kBAAkB,EAAE,CAAC;gCACvB,OAAO,KAAK,CAAC,WAAW,CACtB,kBAAkB,EAClB,cAAc,gBAAgB,GAAG,CAClC,CAAC;4BACJ,CAAC;4BAED,MAAM,cAAc,GAAG,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;4BAEjE,OAAO,KAAK,CAAC,oBAAoB,CAC/B,CAAC,cAAc,EAAE,cAAc,CAAC,EAChC,eAAe,gBAAgB,GAAG,CACnC,CAAC;wBACJ,CAAC;wBACD,IAAI,EAAE;4BACJ,oBAAoB,EAAE,oBAAoB;4BAC1C,SAAS,EAAE,aAAa;yBACzB;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,oFAAoF;SAClG;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,qBAAqB,EAAE,mGAAmG;SAC3H;KACF;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ export declare const NoUnnamedRadioGroup: ESLintUtils.RuleModule<"missingRadioName", [], unknown, ESLintUtils.RuleListener>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /*
3
+ * Licensed to Elasticsearch B.V. under one or more contributor
4
+ * license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright
6
+ * ownership. Elasticsearch B.V. licenses this file to you under
7
+ * the Apache License, Version 2.0 (the "License"); you may
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.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.NoUnnamedRadioGroup = void 0;
22
+ const utils_1 = require("@typescript-eslint/utils");
23
+ const radioComponents = ['EuiRadio', 'EuiRadioGroup'];
24
+ exports.NoUnnamedRadioGroup = utils_1.ESLintUtils.RuleCreator.withoutDocs({
25
+ create(context) {
26
+ return {
27
+ JSXOpeningElement(node) {
28
+ if (node.name.type === 'JSXIdentifier' &&
29
+ radioComponents.includes(node.name.name)) {
30
+ const hasNameAttr = node.attributes.some((attr) => attr.type === 'JSXAttribute' &&
31
+ attr.name.type === 'JSXIdentifier' &&
32
+ attr.name.name === 'name');
33
+ if (!hasNameAttr) {
34
+ context.report({
35
+ node,
36
+ messageId: 'missingRadioName',
37
+ data: { component: node.name.name },
38
+ });
39
+ }
40
+ }
41
+ },
42
+ };
43
+ },
44
+ meta: {
45
+ type: 'problem',
46
+ docs: {
47
+ description: 'Ensure that all radio input components have a `name` attribute. The `name` attribute is required for radio inputs to be grouped correctly, allowing users to select only one option from a set. Without a `name`, radios may not behave as expected and can cause accessibility issues for assistive technologies.',
48
+ },
49
+ schema: [],
50
+ messages: {
51
+ missingRadioName: '{{ component }} must have a `name` attribute. The `name` attribute is required for radio inputs to be grouped correctly, ensuring only one option can be selected and improving accessibility for all users.',
52
+ },
53
+ },
54
+ defaultOptions: [],
55
+ });
56
+ //# sourceMappingURL=no_unnamed_radio_group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no_unnamed_radio_group.js","sourceRoot":"","sources":["../../../../src/rules/a11y/no_unnamed_radio_group.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,oDAAuD;AAEvD,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AAEzC,QAAA,mBAAmB,GAAG,mBAAW,CAAC,WAAW,CAAC,WAAW,CAAC;IACrE,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,iBAAiB,CAAC,IAAI;gBACpB,IACE,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe;oBAClC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EACxC,CAAC;oBACD,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CACtC,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,KAAK,cAAc;wBAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe;wBAClC,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAC5B,CAAC;oBAEF,IAAI,CAAC,WAAW,EAAE,CAAC;wBACjB,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI;4BACJ,SAAS,EAAE,kBAAkB;4BAC7B,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;yBACpC,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,oTAAoT;SACvT;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,gBAAgB,EACd,8MAA8M;SACjN;KACF;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -20,7 +20,7 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.RequireAriaLabelForModals = void 0;
22
22
  const utils_1 = require("@typescript-eslint/utils");
23
- const modalComponents = ['EuiModal', 'EuiFlyout'];
23
+ const modalComponents = ['EuiModal', 'EuiFlyout', 'EuiFlyoutResizable'];
24
24
  const confirmModalComponents = ['EuiConfirmModal'];
25
25
  exports.RequireAriaLabelForModals = utils_1.ESLintUtils.RuleCreator.withoutDocs({
26
26
  create(context) {
@@ -1 +1 @@
1
- {"version":3,"file":"require_aria_label_for_modals.js","sourceRoot":"","sources":["../../../../src/rules/a11y/require_aria_label_for_modals.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,oDAAiE;AAEjE,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AAClD,MAAM,sBAAsB,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAEtC,QAAA,yBAAyB,GAAG,mBAAW,CAAC,WAAW,CAAC,WAAW,CAAC;IAC3E,MAAM,CAAC,OAAO;QACZ,SAAS,eAAe,CAAC,IAAgC,EAAE,aAAqB,EAAE,SAAyD;YACzI,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CACvC,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAC,IAAI,KAAK,cAAc;gBAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ;gBAClC,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAC7D,CAAC;YAEF,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,SAAS,EAAE,SAAS;oBACpB,IAAI,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE;iBACnC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO;YACL,iBAAiB,CAAC,IAAI;gBACpB,IACE,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,eAAe,EAClC,CAAC;oBACD,IAAI,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;wBAC7C,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAA;oBAC3D,CAAC;oBAED,IAAI,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;wBACpD,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAA;oBAClE,CAAC;gBACH,CAAC;gBACD,OAAM;YACR,CAAC;SACF,CAAC;IACJ,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,0DAA0D;SACxE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,gBAAgB,EAAE;gBAChB,gGAAgG;gBAChG,IAAI;gBACJ,kDAAkD;gBAClD,mCAAmC;gBACnC,yDAAyD;gBACzD,2BAA2B;gBAC3B,+CAA+C;gBAC/C,QAAQ;gBACR,qBAAqB;gBACrB,oCAAoC;gBACpC,iBAAiB;gBACjB,OAAO;gBACP,8BAA8B;gBAC9B,qCAAqC;gBACrC,0DAA0D;gBAC1D,oBAAoB;gBACpB,8BAA8B;gBAC9B,UAAU;gBACV,uBAAuB;gBACvB,IAAI;gBACJ,iCAAiC;gBACjC,0FAA0F;aAC3F,CAAC,IAAI,CAAC,IAAI,CAAC;YAEZ,uBAAuB,EAAE;gBACvB,gGAAgG;gBAChG,IAAI;gBACJ,kDAAkD;gBAClD,mCAAmC;gBACnC,yDAAyD;gBACzD,2BAA2B;gBAC3B,+CAA+C;gBAC/C,QAAQ;gBACR,qBAAqB;gBACrB,wDAAwD;gBACxD,qCAAqC;gBACrC,yCAAyC;gBACzC,kBAAkB;gBAClB,OAAO;gBACP,IAAI;gBACJ,iCAAiC;gBACjC,0FAA0F;aAC7F,CAAC,IAAI,CAAC,IAAI,CAAC;SACX;KACF;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
1
+ {"version":3,"file":"require_aria_label_for_modals.js","sourceRoot":"","sources":["../../../../src/rules/a11y/require_aria_label_for_modals.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;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CAAA;oBAClE,CAAC;gBACH,CAAC;gBACD,OAAM;YACR,CAAC;SACF,CAAC;IACJ,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,0DAA0D;SACxE;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,gBAAgB,EAAE;gBAChB,gGAAgG;gBAChG,IAAI;gBACJ,kDAAkD;gBAClD,mCAAmC;gBACnC,yDAAyD;gBACzD,2BAA2B;gBAC3B,+CAA+C;gBAC/C,QAAQ;gBACR,qBAAqB;gBACrB,oCAAoC;gBACpC,iBAAiB;gBACjB,OAAO;gBACP,8BAA8B;gBAC9B,qCAAqC;gBACrC,0DAA0D;gBAC1D,oBAAoB;gBACpB,8BAA8B;gBAC9B,UAAU;gBACV,uBAAuB;gBACvB,IAAI;gBACJ,iCAAiC;gBACjC,0FAA0F;aAC3F,CAAC,IAAI,CAAC,IAAI,CAAC;YAEZ,uBAAuB,EAAE;gBACvB,gGAAgG;gBAChG,IAAI;gBACJ,kDAAkD;gBAClD,mCAAmC;gBACnC,yDAAyD;gBACzD,2BAA2B;gBAC3B,+CAA+C;gBAC/C,QAAQ;gBACR,qBAAqB;gBACrB,wDAAwD;gBACxD,qCAAqC;gBACrC,yCAAyC;gBACzC,kBAAkB;gBAClB,OAAO;gBACP,IAAI;gBACJ,iCAAiC;gBACjC,0FAA0F;aAC7F,CAAC,IAAI,CAAC,IAAI,CAAC;SACX;KACF;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -10,10 +10,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.ScreenReaderOutputDisabledTooltip = void 0;
11
11
  const utils_1 = require("@typescript-eslint/utils");
12
12
  const get_attr_value_1 = require("../../utils/get_attr_value");
13
+ const are_attrs_equal_1 = require("../../utils/are_attrs_equal");
13
14
  const tooltipComponent = 'EuiToolTip';
14
15
  const disabledTooltipComponentProp = 'disableScreenReaderOutput';
15
16
  const buttonComponents = ['EuiButtonIcon'];
16
- const normalizeAttrString = (str) => str?.trim().replace(/\s+/g, ' ');
17
17
  exports.ScreenReaderOutputDisabledTooltip = utils_1.ESLintUtils.RuleCreator.withoutDocs({
18
18
  create(context) {
19
19
  return {
@@ -39,7 +39,7 @@ exports.ScreenReaderOutputDisabledTooltip = utils_1.ESLintUtils.RuleCreator.with
39
39
  const ariaLabel = (0, get_attr_value_1.getAttrValue)(context, buttonElement.openingElement.attributes, 'aria-label');
40
40
  if (tooltipContent &&
41
41
  ariaLabel &&
42
- normalizeAttrString(tooltipContent) === normalizeAttrString(ariaLabel)) {
42
+ (0, are_attrs_equal_1.areAttrsEqual)(tooltipContent, ariaLabel)) {
43
43
  const buttonElementName = buttonElement.openingElement.name.name;
44
44
  context.report({
45
45
  node: openingElement,
@@ -1 +1 @@
1
- {"version":3,"file":"sr_output_disabled_tooltip.js","sourceRoot":"","sources":["../../../../src/rules/a11y/sr_output_disabled_tooltip.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,oDAAsE;AACtE,+DAA0D;AAE1D,MAAM,gBAAgB,GAAG,YAAY,CAAC;AACtC,MAAM,4BAA4B,GAAG,2BAA2B,CAAC;AACjE,MAAM,gBAAgB,GAAG,CAAC,eAAe,CAAC,CAAC;AAE3C,MAAM,mBAAmB,GAAG,CAAC,GAAY,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAElE,QAAA,iCAAiC,GAC5C,mBAAW,CAAC,WAAW,CAAC,WAAW,CAAC;IAClC,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,UAAU,CAAC,IAAI;gBACb,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;gBAE3C,IACE,cAAc,EAAE,IAAI,CAAC,IAAI,KAAK,eAAe;oBAC7C,cAAc,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAC7C,CAA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,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;4BACjF,MAAM,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;4BAEnF,OAAO,KAAK,CAAC,oBAAoB,CAC/B,CAAC,cAAc,EAAE,cAAc,CAAC,EAChC,IAAI,4BAA4B,EAAE,CACnC,CAAC;wBACJ,CAAC;wBACD,IAAI,EAAE;4BACJ,gBAAgB;4BAChB,4BAA4B;4BAC5B,iBAAiB;yBAClB;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,yIAAyI;SAC5I;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,0BAA0B,EACxB,uLAAuL;SAC1L;KACF;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
1
+ {"version":3,"file":"sr_output_disabled_tooltip.js","sourceRoot":"","sources":["../../../../src/rules/a11y/sr_output_disabled_tooltip.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,oDAAsE;AACtE,+DAA0D;AAC1D,iEAA4D;AAE5D,MAAM,gBAAgB,GAAG,YAAY,CAAC;AACtC,MAAM,4BAA4B,GAAG,2BAA2B,CAAC;AACjE,MAAM,gBAAgB,GAAG,CAAC,eAAe,CAAC,CAAC;AAE9B,QAAA,iCAAiC,GAC5C,mBAAW,CAAC,WAAW,CAAC,WAAW,CAAC;IAClC,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,UAAU,CAAC,IAAI;gBACb,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;gBAE3C,IACE,cAAc,EAAE,IAAI,CAAC,IAAI,KAA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E,EAAE;4BACb,MAAM,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;4BACjF,MAAM,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;4BAEnF,OAAO,KAAK,CAAC,oBAAoB,CAC/B,CAAC,cAAc,EAAE,cAAc,CAAC,EAChC,IAAI,4BAA4B,EAAE,CACnC,CAAC;wBACJ,CAAC;wBACD,IAAI,EAAE;4BACJ,gBAAgB;4BAChB,4BAA4B;4BAC5B,iBAAiB;yBAClB;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,yIAAyI;SAC5I;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,0BAA0B,EACxB,uLAAuL;SAC1L;KACF;IACD,cAAc,EAAE,EAAE;CACnB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const areAttrsEqual: (...strings: Array<string | undefined>) => boolean;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /*
3
+ * Licensed to Elasticsearch B.V. under one or more contributor
4
+ * license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright
6
+ * ownership. Elasticsearch B.V. licenses this file to you under
7
+ * the Apache License, Version 2.0 (the "License"); you may
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.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.areAttrsEqual = void 0;
22
+ const normalizeAttrString = (str) => str?.trim().replace(/\s+/g, ' ');
23
+ const areAttrsEqual = (...strings) => {
24
+ const [first, ...rest] = strings.map(normalizeAttrString);
25
+ return rest.every((s) => s === first);
26
+ };
27
+ exports.areAttrsEqual = areAttrsEqual;
28
+ //# sourceMappingURL=are_attrs_equal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"are_attrs_equal.js","sourceRoot":"","sources":["../../../src/utils/are_attrs_equal.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elastic/eslint-plugin-eui",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",