eslint-plugin-primer-react 8.5.0-rc.8aa385c → 8.5.1-rc.213acde

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.
@@ -16,7 +16,7 @@ jobs:
16
16
  name: Check for changeset
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
- - uses: actions/checkout@v5
19
+ - uses: actions/checkout@v6
20
20
  - name: 'Check for changeset'
21
21
  uses: brettcannon/check-for-changed-files@v1
22
22
  with:
@@ -9,7 +9,7 @@ jobs:
9
9
  format:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: actions/checkout@v5
12
+ - uses: actions/checkout@v6
13
13
  - name: Use Node.js
14
14
  uses: actions/setup-node@v4
15
15
  with:
@@ -21,7 +21,7 @@ jobs:
21
21
  test:
22
22
  runs-on: ubuntu-latest
23
23
  steps:
24
- - uses: actions/checkout@v5
24
+ - uses: actions/checkout@v6
25
25
  - name: Use Node.js
26
26
  uses: actions/setup-node@v4
27
27
  with:
@@ -33,7 +33,7 @@ jobs:
33
33
  lint:
34
34
  runs-on: ubuntu-latest
35
35
  steps:
36
- - uses: actions/checkout@v5
36
+ - uses: actions/checkout@v6
37
37
  - name: Use Node.js
38
38
  uses: actions/setup-node@v4
39
39
  with:
@@ -20,7 +20,7 @@ jobs:
20
20
  runs-on: ubuntu-latest
21
21
  steps:
22
22
  - name: Checkout repository
23
- uses: actions/checkout@v5
23
+ uses: actions/checkout@v6
24
24
  with:
25
25
  # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
26
26
  fetch-depth: 0
@@ -31,7 +31,7 @@ jobs:
31
31
  with:
32
32
  app-id: ${{ vars.PRIMER_APP_ID_SHARED }}
33
33
  private-key: ${{ secrets.PRIMER_APP_PRIVATE_KEY_SHARED }}
34
-
34
+
35
35
  - name: Set up Node.js
36
36
  uses: actions/setup-node@v6
37
37
  with:
@@ -56,7 +56,7 @@ jobs:
56
56
  runs-on: ubuntu-latest
57
57
  steps:
58
58
  - name: Checkout repository
59
- uses: actions/checkout@v5
59
+ uses: actions/checkout@v6
60
60
  with:
61
61
  # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
62
62
  fetch-depth: 0
@@ -106,7 +106,7 @@ jobs:
106
106
  runs-on: ubuntu-latest
107
107
  steps:
108
108
  - name: Checkout repository
109
- uses: actions/checkout@v5
109
+ uses: actions/checkout@v6
110
110
  with:
111
111
  # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
112
112
  fetch-depth: 0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # eslint-plugin-primer-react
2
2
 
3
+ ## 8.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#461](https://github.com/primer/eslint-plugin-primer-react/pull/461) [`75ae0a5`](https://github.com/primer/eslint-plugin-primer-react/commit/75ae0a5cb1d4587b5481c8a459033206aae8e5c3) Thanks [@joshfarrant](https://github.com/joshfarrant)! - Export `enforce-button-for-link-with-no-href` rule, which flags `Link` components which don't have a `href`.
8
+
3
9
  ## 8.5.0
4
10
 
5
11
  ### Minor Changes
@@ -8,6 +14,8 @@
8
14
 
9
15
  ### Patch Changes
10
16
 
17
+ - [#435](https://github.com/primer/eslint-plugin-primer-react/pull/435) [`aa12209`](https://github.com/primer/eslint-plugin-primer-react/commit/aa12209a5ede77f01217ff044192c2b4b15ae2ab) Thanks [@TylerJDev](https://github.com/TylerJDev)! - Adds `width` and `height` to `no-system-props` for `ConfirmationDialog`
18
+
11
19
  - [#454](https://github.com/primer/eslint-plugin-primer-react/pull/454) [`917f344`](https://github.com/primer/eslint-plugin-primer-react/commit/917f344f61beeb8bd5817e89456a135769319003) Thanks [@francinelucca](https://github.com/francinelucca)! - no-system-props: allow 'overflow' prop in Breadcrumbs
12
20
 
13
21
  ## 8.4.0
package/README.md CHANGED
@@ -31,13 +31,26 @@ ESLint rules for Primer React
31
31
 
32
32
  ## Rules
33
33
 
34
- - [direct-slot-children](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/direct-slot-children.md)
35
- - [no-system-props](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-system-props.md)
36
- - [new-css-color-vars](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/new-css-color-vars.md)
37
- - [no-deprecated-props](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-deprecated-props.md)
38
- - [a11y-tooltip-interactive-trigger](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-tooltip-interactive-trigger.md)
39
34
  - [a11y-explicit-heading](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-explicit-heading.md)
40
35
  - [a11y-link-in-text-block](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-link-in-text-block.md)
36
+ - [a11y-no-duplicate-form-labels](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-no-duplicate-form-labels.md)
37
+ - [a11y-no-title-usage](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-no-title-usage.md)
41
38
  - [a11y-remove-disable-tooltip](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-remove-disable-tooltip.md)
39
+ - [a11y-tooltip-interactive-trigger](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-tooltip-interactive-trigger.md)
42
40
  - [a11y-use-accessible-tooltip](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-use-accessible-tooltip.md)
41
+ - [direct-slot-children](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/direct-slot-children.md)
42
+ - [enforce-button-for-link-with-no-href](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/enforce-button-for-link-with-no-href.md)
43
+ - [enforce-css-module-default-import](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/enforce-css-module-default-import.md)
44
+ - [enforce-css-module-identifier-casing](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/enforce-css-module-identifier-casing.md)
45
+ - [new-color-css-vars](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/new-color-css-vars.md)
46
+ - [no-deprecated-entrypoints](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-deprecated-entrypoints.md)
43
47
  - [no-deprecated-experimental-components](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-deprecated-experimental-components.md)
48
+ - [no-deprecated-props](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-deprecated-props.md)
49
+ - [no-system-props](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-system-props.md)
50
+ - [no-unnecessary-components](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-unnecessary-components.md)
51
+ - [no-use-responsive-value](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-use-responsive-value.md)
52
+ - [no-wildcard-imports](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-wildcard-imports.md)
53
+ - [prefer-action-list-item-onselect](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/prefer-action-list-item-onselect.md)
54
+ - [spread-props-first](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/spread-props-first.md)
55
+ - [use-deprecated-from-deprecated](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/use-deprecated-from-deprecated.md)
56
+ - [use-styled-react-import](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/use-styled-react-import.md)
@@ -0,0 +1,41 @@
1
+ # Enforce Button for Link with No href (enforce-button-for-link-with-no-href)
2
+
3
+ Primer's `Link` component enables users to navigate between pages. Rendering it without an `href` makes the element behave like a button without the correct semantics, which negatively impacts accessibility. Use the `Button` component to trigger an action, or ensure the `Link` has a valid `href`.
4
+
5
+ ## Rule details
6
+
7
+ This rule reports any `Link` from `@primer/react` that does not include an `href` prop.
8
+
9
+ 👎 Examples of **incorrect** code for this rule:
10
+
11
+ ```jsx
12
+ /* eslint primer-react/enforce-button-for-link-with-no-href: "error" */
13
+ import {Link} from '@primer/react'
14
+ ;<Link onClick={handleClick}>Save changes</Link>
15
+ ```
16
+
17
+ ```jsx
18
+ /* eslint primer-react/enforce-button-for-link-with-no-href: "error" */
19
+ import {Link} from '@primer/react'
20
+ ;<Link className="text-right">Learn more</Link>
21
+ ```
22
+
23
+ 👍 Examples of **correct** code for this rule:
24
+
25
+ ```jsx
26
+ /* eslint primer-react/enforce-button-for-link-with-no-href: "error" */
27
+ import {Link} from '@primer/react'
28
+ ;<Link href="https://primer.style/react">Read the docs</Link>
29
+ ```
30
+
31
+ ```jsx
32
+ /* eslint primer-react/enforce-button-for-link-with-no-href: "error" */
33
+ import {Button, Link} from '@primer/react'
34
+
35
+ <Button onClick={handleClick}>Save changes</Button>
36
+ <Link href={issueUrl}>View issue</Link>
37
+ ```
38
+
39
+ ## Options
40
+
41
+ This rule has no options.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-primer-react",
3
- "version": "8.5.0-rc.8aa385c",
3
+ "version": "8.5.1-rc.213acde",
4
4
  "description": "ESLint rules for Primer React",
5
5
  "main": "src/index.js",
6
6
  "engines": {
package/src/index.js CHANGED
@@ -1,27 +1,28 @@
1
1
  module.exports = {
2
2
  rules: {
3
- 'direct-slot-children': require('./rules/direct-slot-children'),
4
- 'no-deprecated-entrypoints': require('./rules/no-deprecated-entrypoints'),
5
- 'no-system-props': require('./rules/no-system-props'),
6
- 'no-deprecated-experimental-components': require('./rules/no-deprecated-experimental-components'),
7
- 'a11y-tooltip-interactive-trigger': require('./rules/a11y-tooltip-interactive-trigger'),
8
- 'new-color-css-vars': require('./rules/new-color-css-vars'),
9
3
  'a11y-explicit-heading': require('./rules/a11y-explicit-heading'),
10
- 'no-deprecated-props': require('./rules/no-deprecated-props'),
11
4
  'a11y-link-in-text-block': require('./rules/a11y-link-in-text-block'),
5
+ 'a11y-no-duplicate-form-labels': require('./rules/a11y-no-duplicate-form-labels'),
6
+ 'a11y-no-title-usage': require('./rules/a11y-no-title-usage'),
12
7
  'a11y-remove-disable-tooltip': require('./rules/a11y-remove-disable-tooltip'),
8
+ 'a11y-tooltip-interactive-trigger': require('./rules/a11y-tooltip-interactive-trigger'),
13
9
  'a11y-use-accessible-tooltip': require('./rules/a11y-use-accessible-tooltip'),
14
- 'a11y-no-title-usage': require('./rules/a11y-no-title-usage'),
15
- 'a11y-no-duplicate-form-labels': require('./rules/a11y-no-duplicate-form-labels'),
16
- 'use-deprecated-from-deprecated': require('./rules/use-deprecated-from-deprecated'),
17
- 'no-wildcard-imports': require('./rules/no-wildcard-imports'),
10
+ 'direct-slot-children': require('./rules/direct-slot-children'),
11
+ 'enforce-button-for-link-with-no-href': require('./rules/enforce-button-for-link-with-no-href'),
12
+ 'enforce-css-module-default-import': require('./rules/enforce-css-module-default-import'),
13
+ 'enforce-css-module-identifier-casing': require('./rules/enforce-css-module-identifier-casing'),
14
+ 'new-color-css-vars': require('./rules/new-color-css-vars'),
15
+ 'no-deprecated-entrypoints': require('./rules/no-deprecated-entrypoints'),
16
+ 'no-deprecated-experimental-components': require('./rules/no-deprecated-experimental-components'),
17
+ 'no-deprecated-props': require('./rules/no-deprecated-props'),
18
+ 'no-system-props': require('./rules/no-system-props'),
18
19
  'no-unnecessary-components': require('./rules/no-unnecessary-components'),
20
+ 'no-use-responsive-value': require('./rules/no-use-responsive-value'),
21
+ 'no-wildcard-imports': require('./rules/no-wildcard-imports'),
19
22
  'prefer-action-list-item-onselect': require('./rules/prefer-action-list-item-onselect'),
20
- 'enforce-css-module-identifier-casing': require('./rules/enforce-css-module-identifier-casing'),
21
- 'enforce-css-module-default-import': require('./rules/enforce-css-module-default-import'),
22
- 'use-styled-react-import': require('./rules/use-styled-react-import'),
23
23
  'spread-props-first': require('./rules/spread-props-first'),
24
- 'no-use-responsive-value': require('./rules/no-use-responsive-value'),
24
+ 'use-deprecated-from-deprecated': require('./rules/use-deprecated-from-deprecated'),
25
+ 'use-styled-react-import': require('./rules/use-styled-react-import'),
25
26
  },
26
27
  configs: {
27
28
  recommended: require('./configs/recommended'),
@@ -1,4 +1,4 @@
1
- const rule = require('../enforce-button-for-link-with-nohref')
1
+ const rule = require('../enforce-button-for-link-with-no-href')
2
2
  const {RuleTester} = require('eslint')
3
3
 
4
4
  const ruleTester = new RuleTester({
@@ -13,7 +13,7 @@ const ruleTester = new RuleTester({
13
13
  },
14
14
  })
15
15
 
16
- ruleTester.run('enforce-button-for-link-with-nohref', rule, {
16
+ ruleTester.run('enforce-button-for-link-with-no-href', rule, {
17
17
  valid: [
18
18
  // Link with href attribute
19
19
  `import {Link} from '@primer/react';
@@ -24,6 +24,7 @@ const excludedComponentProps = new Map([
24
24
  ['Breadcrumbs', new Set(['overflow'])],
25
25
  ['Button', new Set(['alignContent'])],
26
26
  ['CircleOcticon', new Set(['size'])],
27
+ ['ConfirmationDialog', new Set(['width', 'height'])],
27
28
  ['Dialog', new Set(['width', 'height', 'position'])],
28
29
  ['IssueLabelToken', new Set(['size'])],
29
30
  ['Overlay', new Set(['width', 'height', 'maxHeight', 'position', 'top', 'right', 'bottom', 'left'])],