Skip to content

Commit bcd1055

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/changesets/cli-2.29.7
2 parents 2e3e262 + b339779 commit bcd1055

16 files changed

+941
-546
lines changed

.changeset/cyan-carrots-boil.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/check-for-changeset.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
name: Check for changeset
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v5
2020
- name: 'Check for changeset'
2121
uses: brettcannon/check-for-changed-files@v1
2222
with:

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
format:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v5
1313
- name: Use Node.js
1414
uses: actions/setup-node@v4
1515
with:
@@ -21,7 +21,7 @@ jobs:
2121
test:
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v5
2525
- name: Use Node.js
2626
uses: actions/setup-node@v4
2727
with:
@@ -33,7 +33,7 @@ jobs:
3333
lint:
3434
runs-on: ubuntu-latest
3535
steps:
36-
- uses: actions/checkout@v4
36+
- uses: actions/checkout@v5
3737
- name: Use Node.js
3838
uses: actions/setup-node@v4
3939
with:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout repository
11-
uses: actions/checkout@v4
11+
uses: actions/checkout@v5
1212
with:
1313
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1414
fetch-depth: 0

.github/workflows/release_canary.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout repository
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919
with:
2020
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
2121
fetch-depth: 0

.github/workflows/release_candidate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout repository
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v5
1515
with:
1616
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1717
fetch-depth: 0

.github/workflows/release_tracking.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ on:
1414
jobs:
1515
release-tracking:
1616
name: Release Tracking
17-
uses: primer/.github/.github/workflows/release_tracking.yml@v2.2.0
17+
uses: primer/.github/.github/workflows/release_tracking.yml@v2.2.1
1818
secrets:
1919
datadog_api_key: ${{ secrets.DATADOG_API_KEY }}

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# eslint-plugin-primer-react
22

3+
## 8.4.0
4+
5+
### Minor Changes
6+
7+
- [#437](https://github.com/primer/eslint-plugin-primer-react/pull/437) [`9270d40`](https://github.com/primer/eslint-plugin-primer-react/commit/9270d40d73bd046e21156b68ef6bd13a20008585) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Add spread-props-first rule to ensure spread props come before other props
8+
9+
## 8.3.0
10+
11+
### Minor Changes
12+
13+
- [#426](https://github.com/primer/eslint-plugin-primer-react/pull/426) [`b83f467`](https://github.com/primer/eslint-plugin-primer-react/commit/b83f46761945d73dfea6c1381ff776e9f50e0bd2) Thanks [@siddharthkp](https://github.com/siddharthkp)! - use-styled-react-import: Add ThemeProvider, BaseStyles and useTheme. Allow theme components to be imported from styled-react without sx
14+
15+
## 8.2.1
16+
17+
### Patch Changes
18+
19+
- [#410](https://github.com/primer/eslint-plugin-primer-react/pull/410) [`f3e47b1`](https://github.com/primer/eslint-plugin-primer-react/commit/f3e47b1a75ad27aceaed89d50175cc59754c8b9d) Thanks [@jonrohan](https://github.com/jonrohan)! - Fix for deprecated and experimental import paths
20+
321
## 8.2.0
422

523
### Minor Changes

docs/rules/spread-props-first.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Ensure spread props come before other props (spread-props-first)
2+
3+
Spread props should come before other named props to avoid unintentionally overriding props. When spread props are placed after named props, they can override the named props, which is often unintended and can lead to UI bugs.
4+
5+
## Rule details
6+
7+
This rule enforces that all spread props (`{...rest}`, `{...props}`, etc.) come before any named props in JSX elements.
8+
9+
👎 Examples of **incorrect** code for this rule:
10+
11+
```jsx
12+
/* eslint primer-react/spread-props-first: "error" */
13+
14+
// ❌ Spread after named prop
15+
<Example className="..." {...rest} />
16+
17+
// ❌ Spread in the middle
18+
<Example className="..." {...rest} id="foo" />
19+
20+
// ❌ Multiple spreads after named props
21+
<Example className="..." {...rest} {...other} />
22+
```
23+
24+
👍 Examples of **correct** code for this rule:
25+
26+
```jsx
27+
/* eslint primer-react/spread-props-first: "error" */
28+
29+
// ✅ Spread before named props
30+
<Example {...rest} className="..." />
31+
32+
// ✅ Multiple spreads before named props
33+
<Example {...rest} {...other} className="..." />
34+
35+
// ✅ Only spread props
36+
<Example {...rest} />
37+
38+
// ✅ Only named props
39+
<Example className="..." id="foo" />
40+
```
41+
42+
## Why this matters
43+
44+
Placing spread props after named props can cause unexpected behavior:
45+
46+
```jsx
47+
// ❌ Bad: className might get overridden by rest
48+
<Button className="custom-class" {...rest} />
49+
50+
// If rest = { className: "other-class" }
51+
// Result: className="other-class" (custom-class is lost!)
52+
53+
// ✅ Good: className will override any className in rest
54+
<Button {...rest} className="custom-class" />
55+
56+
// If rest = { className: "other-class" }
57+
// Result: className="custom-class" (as intended)
58+
```
59+
60+
## Options
61+
62+
This rule has no configuration options.
63+
64+
## When to use autofix
65+
66+
This rule includes an autofix that will automatically reorder your props to place all spread props first. The autofix is safe to use as it preserves the order of spreads relative to each other and the order of named props relative to each other.

0 commit comments

Comments
 (0)