eslint-plugin-primer-react 3.0.0 → 4.0.0-rc.4ff148f

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.
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ open-pull-requests-limit: 99
8
+ allow:
9
+ - dependency-name: "eslint-plugin-github"
10
+ - dependency-name: "eslint-plugin-jsx-a11y"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # eslint-plugin-primer-react
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#51](https://github.com/primer/eslint-plugin-primer-react/pull/51) [`a65aa32`](https://github.com/primer/eslint-plugin-primer-react/commit/a65aa32c612c7fe952ec47bb3d926cf8adae9fab) Thanks [@broccolinisoup](https://github.com/broccolinisoup)! - Add `a11y-tooltip-interactive-trigger`
8
+
3
9
  ## 3.0.0
4
10
 
5
11
  ### Major Changes
package/README.md CHANGED
@@ -32,3 +32,4 @@ ESLint rules for Primer React
32
32
  - [direct-slot-children](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/direct-slot-children.md)
33
33
  - [no-deprecated-colors](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-deprecated-colors.md)
34
34
  - [no-system-props](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-system-props.md)
35
+ - [a11y-tooltip-interactive-trigger](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-tooltip-interactive-trigger.md)
@@ -0,0 +1,41 @@
1
+ ## Rule Details
2
+
3
+ This rule enforces to use interactive elements as tooltip triggers. Interactive elements can be Primer `Button`, `IconButton` and `Link` components or native elements like `button`, `a` with an `href` attribute, `select`, `textarea`, `summary` and `input` (that is not a `hidden` type).
4
+
5
+ 👎 Examples of **incorrect** code for this rule:
6
+
7
+ ```jsx
8
+ /* eslint primer-react/a11y-tooltip-interactive-trigger: "error" */
9
+ import {Tooltip} from '@primer/react'
10
+
11
+ const App = () => (
12
+ <Tooltip text="Tooltip text">
13
+ <div>Tooltip trigger</div>
14
+ </Tooltip>
15
+ )
16
+ ```
17
+
18
+ 👍 Examples of **correct** code for this rule:
19
+
20
+ ```jsx
21
+ /* eslint primer-react/a11y-tooltip-interactive-trigger: "error" */
22
+ import {Tooltip, Button} from '@primer/react'
23
+
24
+ const App = () => (
25
+ <Tooltip text="Supplementary text" type="description">
26
+ <Button
27
+ onClick={() => {
28
+ /* do something */
29
+ }}
30
+ >
31
+ Save
32
+ </Button>
33
+ </Tooltip>
34
+ )
35
+ ```
36
+
37
+ ## Options
38
+
39
+ - `skipImportCheck` (default: `false`)
40
+
41
+ By default, the `a11y-tooltip-interactive-trigger` rule will only check for interactive elements in components that are imported from `@primer/react`. You can disable this behavior by setting `skipImportCheck` to `true`. This is used for internal linting in the [primer/react](https://github.com/prime/react) repository.