eslint-plugin-primer-react 9.2.0 → 9.3.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.
@@ -94,7 +94,7 @@ jobs:
94
94
  discussions: write
95
95
  steps:
96
96
  - name: Setup Scripts
97
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
97
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
98
98
  with:
99
99
  destination: ${{ runner.temp }}/gh-aw/actions
100
100
 
@@ -113,7 +113,7 @@ jobs:
113
113
  issues: write
114
114
  steps:
115
115
  - name: Setup Scripts
116
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
116
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
117
117
  with:
118
118
  destination: ${{ runner.temp }}/gh-aw/actions
119
119
 
@@ -132,7 +132,7 @@ jobs:
132
132
  pull-requests: write
133
133
  steps:
134
134
  - name: Setup Scripts
135
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
135
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
136
136
  with:
137
137
  destination: ${{ runner.temp }}/gh-aw/actions
138
138
 
@@ -152,7 +152,7 @@ jobs:
152
152
  actions: write
153
153
  steps:
154
154
  - name: Setup Scripts
155
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
155
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
156
156
  with:
157
157
  destination: ${{ runner.temp }}/gh-aw/actions
158
158
 
@@ -181,7 +181,7 @@ jobs:
181
181
  persist-credentials: false
182
182
 
183
183
  - name: Setup Scripts
184
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
184
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
185
185
  with:
186
186
  destination: ${{ runner.temp }}/gh-aw/actions
187
187
 
@@ -196,7 +196,7 @@ jobs:
196
196
  await main();
197
197
 
198
198
  - name: Install gh-aw
199
- uses: github/gh-aw-actions/setup-cli@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
199
+ uses: github/gh-aw-actions/setup-cli@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
200
200
  with:
201
201
  version: v0.83.1
202
202
 
@@ -228,7 +228,7 @@ jobs:
228
228
  pull-requests: write
229
229
  steps:
230
230
  - name: Setup Scripts
231
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
231
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
232
232
  with:
233
233
  destination: ${{ runner.temp }}/gh-aw/actions
234
234
 
@@ -275,7 +275,7 @@ jobs:
275
275
  persist-credentials: false
276
276
 
277
277
  - name: Setup Scripts
278
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
278
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
279
279
  with:
280
280
  destination: ${{ runner.temp }}/gh-aw/actions
281
281
 
@@ -321,7 +321,7 @@ jobs:
321
321
  persist-credentials: false
322
322
 
323
323
  - name: Setup Scripts
324
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
324
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
325
325
  with:
326
326
  destination: ${{ runner.temp }}/gh-aw/actions
327
327
 
@@ -336,7 +336,7 @@ jobs:
336
336
  await main();
337
337
 
338
338
  - name: Install gh-aw
339
- uses: github/gh-aw-actions/setup-cli@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
339
+ uses: github/gh-aw-actions/setup-cli@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
340
340
  with:
341
341
  version: v0.83.1
342
342
 
@@ -367,7 +367,7 @@ jobs:
367
367
  persist-credentials: false
368
368
 
369
369
  - name: Setup Scripts
370
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
370
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
371
371
  with:
372
372
  destination: ${{ runner.temp }}/gh-aw/actions
373
373
 
@@ -382,7 +382,7 @@ jobs:
382
382
  await main();
383
383
 
384
384
  - name: Install gh-aw
385
- uses: github/gh-aw-actions/setup-cli@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
385
+ uses: github/gh-aw-actions/setup-cli@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
386
386
  with:
387
387
  version: v0.83.1
388
388
 
@@ -472,7 +472,7 @@ jobs:
472
472
  persist-credentials: false
473
473
 
474
474
  - name: Setup Scripts
475
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
475
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
476
476
  with:
477
477
  destination: ${{ runner.temp }}/gh-aw/actions
478
478
 
@@ -487,7 +487,7 @@ jobs:
487
487
  await main();
488
488
 
489
489
  - name: Install gh-aw
490
- uses: github/gh-aw-actions/setup-cli@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
490
+ uses: github/gh-aw-actions/setup-cli@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
491
491
  with:
492
492
  version: v0.83.1
493
493
 
@@ -564,7 +564,7 @@ jobs:
564
564
  issues: write
565
565
  steps:
566
566
  - name: Setup Scripts
567
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
567
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
568
568
  with:
569
569
  destination: ${{ runner.temp }}/gh-aw/actions
570
570
 
@@ -601,7 +601,7 @@ jobs:
601
601
  persist-credentials: false
602
602
 
603
603
  - name: Setup Scripts
604
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
604
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
605
605
  with:
606
606
  destination: ${{ runner.temp }}/gh-aw/actions
607
607
 
@@ -616,7 +616,7 @@ jobs:
616
616
  await main();
617
617
 
618
618
  - name: Install gh-aw
619
- uses: github/gh-aw-actions/setup-cli@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
619
+ uses: github/gh-aw-actions/setup-cli@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
620
620
  with:
621
621
  version: v0.83.1
622
622
 
@@ -18,7 +18,7 @@ jobs:
18
18
  steps:
19
19
  - uses: actions/checkout@v7
20
20
  - name: 'Check for changeset'
21
- uses: brettcannon/check-for-changed-files@v1.2.1
21
+ uses: brettcannon/check-for-changed-files@v1.2.2
22
22
  with:
23
23
  file-pattern: '.changeset/*.md'
24
24
  skip-label: 'skip changeset'
@@ -11,7 +11,7 @@ jobs:
11
11
  steps:
12
12
  - uses: actions/checkout@v7
13
13
  - name: Use Node.js
14
- uses: actions/setup-node@v4
14
+ uses: actions/setup-node@v7
15
15
  with:
16
16
  node-version: 20
17
17
  cache: 'npm'
@@ -23,7 +23,7 @@ jobs:
23
23
  steps:
24
24
  - uses: actions/checkout@v7
25
25
  - name: Use Node.js
26
- uses: actions/setup-node@v4
26
+ uses: actions/setup-node@v7
27
27
  with:
28
28
  node-version: 20
29
29
  cache: 'npm'
@@ -35,7 +35,7 @@ jobs:
35
35
  steps:
36
36
  - uses: actions/checkout@v7
37
37
  - name: Use Node.js
38
- uses: actions/setup-node@v4
38
+ uses: actions/setup-node@v7
39
39
  with:
40
40
  node-version: 20
41
41
  cache: 'npm'
@@ -45,7 +45,7 @@
45
45
  # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9)
46
46
  # - actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
47
47
  # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
48
- # - github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
48
+ # - github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
49
49
  #
50
50
  # Container images used:
51
51
  # - ghcr.io/github/gh-aw-firewall/agent:0.27.38@sha256:cb928eb62d9139a013c2d278dab19af232d35a2d83dca71a3d98eb431f786243
@@ -102,7 +102,7 @@ jobs:
102
102
  steps:
103
103
  - name: Setup Scripts
104
104
  id: setup
105
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
105
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
106
106
  with:
107
107
  destination: ${{ runner.temp }}/gh-aw/actions
108
108
  job-name: ${{ github.job }}
@@ -449,7 +449,7 @@ jobs:
449
449
  steps:
450
450
  - name: Setup Scripts
451
451
  id: setup
452
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
452
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
453
453
  with:
454
454
  destination: ${{ runner.temp }}/gh-aw/actions
455
455
  job-name: ${{ github.job }}
@@ -1137,7 +1137,7 @@ jobs:
1137
1137
  steps:
1138
1138
  - name: Setup Scripts
1139
1139
  id: setup
1140
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
1140
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
1141
1141
  with:
1142
1142
  destination: ${{ runner.temp }}/gh-aw/actions
1143
1143
  job-name: ${{ github.job }}
@@ -1390,7 +1390,7 @@ jobs:
1390
1390
  steps:
1391
1391
  - name: Setup Scripts
1392
1392
  id: setup
1393
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
1393
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
1394
1394
  with:
1395
1395
  destination: ${{ runner.temp }}/gh-aw/actions
1396
1396
  job-name: ${{ github.job }}
@@ -1629,7 +1629,7 @@ jobs:
1629
1629
  steps:
1630
1630
  - name: Setup Scripts
1631
1631
  id: setup
1632
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
1632
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
1633
1633
  with:
1634
1634
  destination: ${{ runner.temp }}/gh-aw/actions
1635
1635
  job-name: ${{ github.job }}
@@ -1695,7 +1695,7 @@ jobs:
1695
1695
  steps:
1696
1696
  - name: Setup Scripts
1697
1697
  id: setup
1698
- uses: github/gh-aw-actions/setup@8bdba8075360648fe6802302a5b4e016361dc6ac # v0.83.1
1698
+ uses: github/gh-aw-actions/setup@6aab9e5b5c91c615506061f09bedd81a23babe3c # v0.86.2
1699
1699
  with:
1700
1700
  destination: ${{ runner.temp }}/gh-aw/actions
1701
1701
  job-name: ${{ github.job }}
@@ -33,7 +33,7 @@ jobs:
33
33
  private-key: ${{ secrets.PRIMER_APP_PRIVATE_KEY_SHARED }}
34
34
 
35
35
  - name: Set up Node.js
36
- uses: actions/setup-node@v6
36
+ uses: actions/setup-node@v7
37
37
  with:
38
38
  node-version: 24
39
39
 
@@ -62,7 +62,7 @@ jobs:
62
62
  fetch-depth: 0
63
63
 
64
64
  - name: Set up Node.js
65
- uses: actions/setup-node@v6
65
+ uses: actions/setup-node@v7
66
66
  with:
67
67
  node-version: 24
68
68
 
@@ -112,7 +112,7 @@ jobs:
112
112
  fetch-depth: 0
113
113
 
114
114
  - name: Set up Node.js
115
- uses: actions/setup-node@v6
115
+ uses: actions/setup-node@v7
116
116
  with:
117
117
  node-version: 24
118
118
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # eslint-plugin-primer-react
2
2
 
3
+ ## 9.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#630](https://github.com/primer/eslint-plugin-primer-react/pull/630) [`7e5fc05`](https://github.com/primer/eslint-plugin-primer-react/commit/7e5fc05e6b227a29bd757779688e325c6f61ccbc) Thanks [@llastflowers](https://github.com/llastflowers)! - Add lint rule to discourage Flash usage
8
+
3
9
  ## 9.2.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -45,6 +45,7 @@ ESLint rules for Primer React
45
45
  - [new-color-css-vars](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/new-color-css-vars.md)
46
46
  - [no-deprecated-entrypoints](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-deprecated-entrypoints.md)
47
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-flash](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-deprecated-flash.md)
48
49
  - [no-deprecated-props](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-deprecated-props.md)
49
50
 
50
51
  - [no-use-responsive-value](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-use-responsive-value.md)
@@ -0,0 +1,22 @@
1
+ # No deprecated Flash
2
+
3
+ ## Rule details
4
+
5
+ This rule discourages imports of the deprecated `Flash` component from
6
+ `@primer/react` and `@primer/react/deprecated`.
7
+
8
+ 👎 Example of **incorrect** code for this rule:
9
+
10
+ ```jsx
11
+ import {Flash} from '@primer/react'
12
+ ```
13
+
14
+ 👍 Example of **correct** code for this rule:
15
+
16
+ ```jsx
17
+ import {Banner} from '@primer/react'
18
+ ```
19
+
20
+ Follow the
21
+ [Flash migration guide](https://primer.style/product/getting-started/react/migration-guides/primer-flash)
22
+ when replacing `Flash` with `Banner`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-primer-react",
3
- "version": "9.2.0",
3
+ "version": "9.3.0",
4
4
  "description": "ESLint rules for Primer React",
5
5
  "main": "src/index.js",
6
6
  "engines": {
package/src/index.js CHANGED
@@ -14,6 +14,7 @@ module.exports = {
14
14
  'new-color-css-vars': require('./rules/new-color-css-vars'),
15
15
  'no-deprecated-entrypoints': require('./rules/no-deprecated-entrypoints'),
16
16
  'no-deprecated-experimental-components': require('./rules/no-deprecated-experimental-components'),
17
+ 'no-deprecated-flash': require('./rules/no-deprecated-flash'),
17
18
  'no-deprecated-props': require('./rules/no-deprecated-props'),
18
19
 
19
20
  'no-use-responsive-value': require('./rules/no-use-responsive-value'),
@@ -0,0 +1,48 @@
1
+ 'use strict'
2
+
3
+ const {RuleTester} = require('eslint')
4
+ const rule = require('../no-deprecated-flash')
5
+
6
+ const ruleTester = new RuleTester({
7
+ languageOptions: {
8
+ ecmaVersion: 'latest',
9
+ sourceType: 'module',
10
+ },
11
+ })
12
+
13
+ const error = {messageId: 'deprecatedFlash'}
14
+
15
+ ruleTester.run('no-deprecated-flash', rule, {
16
+ valid: [
17
+ {
18
+ code: `import {Banner} from '@primer/react'`,
19
+ },
20
+ {
21
+ code: `import {Flash} from '@example/react'`,
22
+ },
23
+ {
24
+ code: `import PrimerReact from '@primer/react'`,
25
+ },
26
+ {
27
+ code: `import * as PrimerReact from '@primer/react'`,
28
+ },
29
+ ],
30
+ invalid: [
31
+ {
32
+ code: `import {Flash} from '@primer/react'`,
33
+ errors: [error],
34
+ },
35
+ {
36
+ code: `import {Flash} from '@primer/react/deprecated'`,
37
+ errors: [error],
38
+ },
39
+ {
40
+ code: `import {Flash as LegacyFlash} from '@primer/react'`,
41
+ errors: [error],
42
+ },
43
+ {
44
+ code: `import {Button, Flash, Link} from '@primer/react'`,
45
+ errors: [error],
46
+ },
47
+ ],
48
+ })
@@ -0,0 +1,48 @@
1
+ 'use strict'
2
+
3
+ const url = require('../url')
4
+
5
+ const migrationGuide = 'https://primer.style/product/getting-started/react/migration-guides/primer-flash'
6
+ const primerReactEntrypoints = new Set(['@primer/react', '@primer/react/deprecated'])
7
+
8
+ /**
9
+ * @type {import('eslint').Rule.RuleModule}
10
+ */
11
+ module.exports = {
12
+ meta: {
13
+ type: 'problem',
14
+ docs: {
15
+ description: 'Discourage the use of the deprecated Flash component',
16
+ recommended: false,
17
+ url: url(module),
18
+ },
19
+ messages: {
20
+ deprecatedFlash: `\`Flash\` is deprecated. Use \`Banner\` from \`@primer/react\` instead. See the migration guide: ${migrationGuide}`,
21
+ },
22
+ schema: [],
23
+ },
24
+ create(context) {
25
+ return {
26
+ ImportDeclaration(node) {
27
+ if (!primerReactEntrypoints.has(node.source.value)) {
28
+ return
29
+ }
30
+
31
+ for (const specifier of node.specifiers) {
32
+ if (specifier.type !== 'ImportSpecifier') {
33
+ continue
34
+ }
35
+
36
+ if (specifier.imported.name !== 'Flash') {
37
+ continue
38
+ }
39
+
40
+ context.report({
41
+ node: specifier,
42
+ messageId: 'deprecatedFlash',
43
+ })
44
+ }
45
+ },
46
+ }
47
+ },
48
+ }