eslint-plugin-primer-react 5.3.0 → 5.4.0-rc.27e12cc
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/.github/workflows/release_tracking.yml +1 -1
- package/CHANGELOG.md +6 -0
- package/README.md +1 -0
- package/docs/rules/a11y-use-next-tooltip.md +33 -0
- package/package-lock.json +14216 -0
- package/package.json +2 -2
- package/src/configs/recommended.js +1 -0
- package/src/index.js +1 -0
- package/src/rules/__tests__/a11y-use-next-tooltip.test.js +61 -0
- package/src/rules/a11y-use-next-tooltip.js +128 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# eslint-plugin-primer-react
|
|
2
2
|
|
|
3
|
+
## 5.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#103](https://github.com/primer/eslint-plugin-primer-react/pull/103) [`8617a66`](https://github.com/primer/eslint-plugin-primer-react/commit/8617a66b2afe7e4e7a8608dbf5744999fffd9140) Thanks [@broccolinisoup](https://github.com/broccolinisoup)! - Add a11y-use-next-tooltip rule that warns against using Tooltip v1 (Not the accessible one)
|
|
8
|
+
|
|
3
9
|
## 5.3.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -39,3 +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)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Recommends to use the `next` tooltip instead of the current stable one.
|
|
2
|
+
|
|
3
|
+
## Rule details
|
|
4
|
+
|
|
5
|
+
This rule recommends using the tooltip that is imported from `@primer/react/next` instead of the main entrypoint. The components that are exported from `@primer/react/next` are recommended over the main entrypoint ones because `next` components are reviewed and remediated for accessibility issues.
|
|
6
|
+
👎 Examples of **incorrect** code for this rule:
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import {Tooltip} from '@primer/react'
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
👍 Examples of **correct** code for this rule:
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import {Tooltip} from '@primer/react/next'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Icon buttons and tooltips
|
|
19
|
+
|
|
20
|
+
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.
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
import {IconButton} from '@primer/react'
|
|
24
|
+
import {Tooltip} from '@primer/react/next'
|
|
25
|
+
|
|
26
|
+
function ExampleComponent() {
|
|
27
|
+
return (
|
|
28
|
+
<Tooltip text="Search" direction="e">
|
|
29
|
+
<IconButton icon={SearchIcon} aria-label="Search" />
|
|
30
|
+
</Tooltip>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
```
|