eslint-plugin-primer-react 6.2.0-rc.58af654 → 7.0.0-rc.414f409

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/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # eslint-plugin-primer-react
2
2
 
3
- ## 6.2.0
3
+ ## 7.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#270](https://github.com/primer/eslint-plugin-primer-react/pull/270) [`17814a2`](https://github.com/primer/eslint-plugin-primer-react/commit/17814a2d77d752b6675e51124fe3c18671837a10) Thanks [@broccolinisoup](https://github.com/broccolinisoup)! - Update a11y-use-next-tooltip to be a11y-use-accessible-tooltip and make the changes accordingly
4
8
 
5
9
  ### Minor Changes
6
10
 
package/README.md CHANGED
@@ -39,4 +39,4 @@ ESLint rules for Primer React
39
39
  - [a11y-explicit-heading](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-explicit-heading.md)
40
40
  - [a11y-link-in-text-block](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-link-in-text-block.md)
41
41
  - [a11y-remove-disable-tooltip](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-remove-disable-tooltip.md)
42
- - [a11y-use-next-tooltip](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-use-next-tooltip.md)
42
+ - [a11y-use-accessible-tooltip](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-use-accessible-tooltip.md)
@@ -0,0 +1,47 @@
1
+ # Recommends to use the new accessible tooltip instead of the deprecated one.
2
+
3
+ ## Rule details
4
+
5
+ This rule suggests switching to the new accessible tooltip from @primer/react instead of the deprecated version. Deprecated props like wrap, noDelay, and align should also be removed.
6
+
7
+ Note that the new tooltip is intended for interactive elements only, such as buttons and links, whereas the deprecated tooltip could be applied to any element, though it lacks screen reader accessibility. As a result, the autofix for this rule will only work if the deprecated tooltip is on an interactive element. If it is applied to a non-interactive element, please consult your design team for [an alternative approach](https://primer.style/guides/accessibility/tooltip-alternatives).
8
+
9
+ 👎 Examples of **incorrect** code for this rule:
10
+
11
+ ```jsx
12
+ import {Tooltip} from '@primer/react/deprecated'
13
+
14
+ const App = () => (
15
+ <Tooltip aria-label="This change cannot be undone" direction="w" wrap={true} noDelay={true} align="left">
16
+ <Button onClick={onClick}>Delete</Button>
17
+ </Tooltip>
18
+ )
19
+ ```
20
+
21
+ 👍 Examples of **correct** code for this rule:
22
+
23
+ ```jsx
24
+ import {Tooltip} from '@primer/react'
25
+
26
+ const App = () => (
27
+ <Tooltip text="This change cannot be undone" direction="w">
28
+ <Button onClick={onClick}>Delete</Button>
29
+ </Tooltip>
30
+ )
31
+ ```
32
+
33
+ ## Icon buttons and tooltips
34
+
35
+ Even though the below code is perfectly valid, since icon buttons now come with tooltips by default, it is not required to explicitly use the Tooltip component on icon buttons.
36
+
37
+ ```jsx
38
+ import {IconButton, Tooltip} from '@primer/react'
39
+
40
+ function ExampleComponent() {
41
+ return (
42
+ <Tooltip text="Search" direction="e">
43
+ <IconButton icon={SearchIcon} aria-label="Search" />
44
+ </Tooltip>
45
+ )
46
+ }
47
+ ```