@elastic/eslint-plugin-eui 2.2.1 → 2.4.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 (64) hide show
  1. package/README.md +13 -1
  2. package/lib/cjs/index.js +11 -2
  3. package/lib/cjs/rules/a11y/callout_announce_on_mount.d.ts +3 -0
  4. package/lib/cjs/rules/a11y/callout_announce_on_mount.d.ts.map +1 -0
  5. package/lib/cjs/rules/a11y/callout_announce_on_mount.js +67 -0
  6. package/lib/cjs/rules/a11y/consistent_is_invalid_props.d.ts.map +1 -1
  7. package/lib/cjs/rules/a11y/consistent_is_invalid_props.js +2 -1
  8. package/lib/cjs/rules/a11y/no_unnamed_interactive_element.d.ts +3 -0
  9. package/lib/cjs/rules/a11y/no_unnamed_interactive_element.d.ts.map +1 -0
  10. package/lib/cjs/rules/a11y/no_unnamed_interactive_element.js +89 -0
  11. package/lib/cjs/rules/a11y/no_unnamed_radio_group.d.ts +3 -0
  12. package/lib/cjs/rules/a11y/no_unnamed_radio_group.d.ts.map +1 -0
  13. package/lib/cjs/rules/a11y/no_unnamed_radio_group.js +58 -0
  14. package/lib/cjs/rules/a11y/require_aria_label_for_modals.js +1 -1
  15. package/lib/cjs/rules/a11y/sr_output_disabled_tooltip.d.ts.map +1 -1
  16. package/lib/cjs/rules/a11y/sr_output_disabled_tooltip.js +2 -2
  17. package/lib/cjs/utils/are_attrs_equal.d.ts +2 -0
  18. package/lib/cjs/utils/are_attrs_equal.d.ts.map +1 -0
  19. package/lib/cjs/utils/are_attrs_equal.js +31 -0
  20. package/lib/cjs/utils/get_allowed_a11y_prop_names_for_component.d.ts +24 -0
  21. package/lib/cjs/utils/get_allowed_a11y_prop_names_for_component.d.ts.map +1 -0
  22. package/lib/cjs/utils/get_allowed_a11y_prop_names_for_component.js +50 -0
  23. package/lib/cjs/utils/has_a11y_prop_for_component.d.ts +20 -0
  24. package/lib/cjs/utils/has_a11y_prop_for_component.d.ts.map +1 -0
  25. package/lib/cjs/utils/has_a11y_prop_for_component.js +47 -0
  26. package/lib/cjs/utils/has_spread.d.ts +12 -0
  27. package/lib/cjs/utils/has_spread.d.ts.map +1 -0
  28. package/lib/cjs/utils/has_spread.js +38 -0
  29. package/lib/cjs/utils/is_in_conditional_rendering.d.ts +3 -0
  30. package/lib/cjs/utils/is_in_conditional_rendering.d.ts.map +1 -0
  31. package/lib/cjs/utils/is_in_conditional_rendering.js +35 -0
  32. package/lib/esm/index.js +9 -0
  33. package/lib/esm/index.js.map +1 -1
  34. package/lib/esm/rules/a11y/callout_announce_on_mount.d.ts +2 -0
  35. package/lib/esm/rules/a11y/callout_announce_on_mount.js +76 -0
  36. package/lib/esm/rules/a11y/callout_announce_on_mount.js.map +1 -0
  37. package/lib/esm/rules/a11y/consistent_is_invalid_props.js +2 -1
  38. package/lib/esm/rules/a11y/consistent_is_invalid_props.js.map +1 -1
  39. package/lib/esm/rules/a11y/no_unnamed_interactive_element.d.ts +2 -0
  40. package/lib/esm/rules/a11y/no_unnamed_interactive_element.js +106 -0
  41. package/lib/esm/rules/a11y/no_unnamed_interactive_element.js.map +1 -0
  42. package/lib/esm/rules/a11y/no_unnamed_radio_group.d.ts +2 -0
  43. package/lib/esm/rules/a11y/no_unnamed_radio_group.js +56 -0
  44. package/lib/esm/rules/a11y/no_unnamed_radio_group.js.map +1 -0
  45. package/lib/esm/rules/a11y/require_aria_label_for_modals.js +1 -1
  46. package/lib/esm/rules/a11y/require_aria_label_for_modals.js.map +1 -1
  47. package/lib/esm/rules/a11y/sr_output_disabled_tooltip.js +2 -2
  48. package/lib/esm/rules/a11y/sr_output_disabled_tooltip.js.map +1 -1
  49. package/lib/esm/utils/are_attrs_equal.d.ts +1 -0
  50. package/lib/esm/utils/are_attrs_equal.js +28 -0
  51. package/lib/esm/utils/are_attrs_equal.js.map +1 -0
  52. package/lib/esm/utils/get_allowed_a11y_prop_names_for_component.d.ts +23 -0
  53. package/lib/esm/utils/get_allowed_a11y_prop_names_for_component.js +45 -0
  54. package/lib/esm/utils/get_allowed_a11y_prop_names_for_component.js.map +1 -0
  55. package/lib/esm/utils/has_a11y_prop_for_component.d.ts +19 -0
  56. package/lib/esm/utils/has_a11y_prop_for_component.js +45 -0
  57. package/lib/esm/utils/has_a11y_prop_for_component.js.map +1 -0
  58. package/lib/esm/utils/has_spread.d.ts +11 -0
  59. package/lib/esm/utils/has_spread.js +34 -0
  60. package/lib/esm/utils/has_spread.js.map +1 -0
  61. package/lib/esm/utils/is_in_conditional_rendering.d.ts +2 -0
  62. package/lib/esm/utils/is_in_conditional_rendering.js +34 -0
  63. package/lib/esm/utils/is_in_conditional_rendering.js.map +1 -0
  64. package/package.json +1 -1
@@ -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,34 @@
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.hasSpread = hasSpread;
22
+ /**
23
+ * Checks whether a JSX opening element contains a spread attribute
24
+ * (e.g., `...props`). Spreads make it impossible to statically know
25
+ * all props present on an element, so ESLint rules often use this as
26
+ * a quick bail-out to avoid false positives.
27
+ *
28
+ * @param attrs - The attributes array from a `JSXOpeningElement` node (ESTree).
29
+ * @returns `true` if any attribute is a `JSXSpreadAttribute`; otherwise `false`.
30
+ */
31
+ function hasSpread(attrs) {
32
+ return attrs.some((a) => a.type === 'JSXSpreadAttribute');
33
+ }
34
+ //# 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;;;;;;;;;;;;;;;;;GAiBG;;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,2 @@
1
+ import { TSESTree } from '@typescript-eslint/utils';
2
+ export declare function isInConditionalRendering(node: TSESTree.JSXElement): boolean;
@@ -0,0 +1,34 @@
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.isInConditionalRendering = isInConditionalRendering;
22
+ function isInConditionalRendering(node) {
23
+ let parent = node.parent;
24
+ while (parent) {
25
+ if (parent.type === 'ConditionalExpression' ||
26
+ parent.type === 'IfStatement' ||
27
+ (parent.type === 'LogicalExpression' && parent.operator === '&&')) {
28
+ return true;
29
+ }
30
+ parent = parent.parent;
31
+ }
32
+ return false;
33
+ }
34
+ //# 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;;;;;;;;;;;;;;;;;GAiBG;;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"}
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.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",