eslint-plugin-nextfriday 1.23.0 → 1.24.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # eslint-plugin-nextfriday
2
2
 
3
+ ## 1.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#97](https://github.com/next-friday/eslint-plugin-nextfriday/pull/97) [`a5cada9`](https://github.com/next-friday/eslint-plugin-nextfriday/commit/a5cada9216e31e85db990513e7f36a11a4bb5308) Thanks [@joetakara](https://github.com/joetakara)! - Add jsx-spread-props-last rule. Enforces that JSX spread attributes (`{...props}`) appear after all other props on the same element. Included in `react`, `react/recommended`, `nextjs`, and `nextjs/recommended` presets.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#97](https://github.com/next-friday/eslint-plugin-nextfriday/pull/97) [`a5cada9`](https://github.com/next-friday/eslint-plugin-nextfriday/commit/a5cada9216e31e85db990513e7f36a11a4bb5308) Thanks [@joetakara](https://github.com/joetakara)! - Upgrade dependencies to latest compatible versions: typescript-eslint 8.58 → 8.59, eslint-plugin-unicorn 63 → 64, eslint-plugin-sonarjs 4.0.2 → 4.0.3, plus dev tooling (prettier, changesets, commitlint, swc). Pinned eslint, typescript, and @types/node to their latest 9.x/5.x/22.x lines for ecosystem and engine compatibility.
12
+
13
+ ## 1.23.1
14
+
15
+ ### Patch Changes
16
+
17
+ - [#96](https://github.com/next-friday/eslint-plugin-nextfriday/pull/96) [`1821f08`](https://github.com/next-friday/eslint-plugin-nextfriday/commit/1821f08a00cf60a0b1ab6d654e700b54b86f364b) Thanks [@joetakara](https://github.com/joetakara)! - Upgrade dependencies to latest compatible versions: typescript-eslint 8.58 → 8.59, eslint-plugin-unicorn 63 → 64, eslint-plugin-sonarjs 4.0.2 → 4.0.3, plus dev tooling (prettier, changesets, commitlint, swc). Pinned eslint, typescript, and @types/node to their latest 9.x/5.x/22.x lines for ecosystem and engine compatibility.
18
+
3
19
  ## 1.23.0
4
20
 
5
21
  ### Minor Changes
package/README.md CHANGED
@@ -136,6 +136,7 @@ export default [
136
136
  "nextfriday/jsx-require-suspense": "error",
137
137
  "nextfriday/jsx-simple-props": "error",
138
138
  "nextfriday/jsx-sort-props": "error",
139
+ "nextfriday/jsx-spread-props-last": "error",
139
140
  "nextfriday/prefer-jsx-template-literals": "error",
140
141
  "nextfriday/react-props-destructure": "error",
141
142
  "nextfriday/enforce-props-suffix": "error",
@@ -232,6 +233,7 @@ export default [
232
233
  | [jsx-require-suspense](docs/rules/JSX_REQUIRE_SUSPENSE.md) | Require lazy-loaded components to be wrapped in Suspense | ❌ |
233
234
  | [jsx-simple-props](docs/rules/JSX_SIMPLE_PROPS.md) | Enforce simple prop values (strings, variables, callbacks, ReactNode) | ❌ |
234
235
  | [jsx-sort-props](docs/rules/JSX_SORT_PROPS.md) | Enforce JSX props are sorted by value type | ✅ |
236
+ | [jsx-spread-props-last](docs/rules/JSX_SPREAD_PROPS_LAST.md) | Enforce JSX spread attributes appear after all other props | ❌ |
235
237
  | [prefer-jsx-template-literals](docs/rules/PREFER_JSX_TEMPLATE_LITERALS.md) | Enforce template literals instead of mixing text and JSX expressions | ✅ |
236
238
  | [react-props-destructure](docs/rules/REACT_PROPS_DESTRUCTURE.md) | Enforce destructuring props inside React component body | ❌ |
237
239
  | [enforce-props-suffix](docs/rules/ENFORCE_PROPS_SUFFIX.md) | Enforce 'Props' suffix for interfaces and types in \*.tsx files | ❌ |
@@ -301,7 +303,7 @@ Included in `base`, `base/recommended`, and all other presets:
301
303
  - `nextfriday/sort-type-alphabetically`
302
304
  - `nextfriday/sort-type-required-first`
303
305
 
304
- ### JSX Rules (15 rules)
306
+ ### JSX Rules (16 rules)
305
307
 
306
308
  Additionally included in `react`, `react/recommended`, `nextjs`, `nextjs/recommended`:
307
309
 
@@ -317,6 +319,7 @@ Additionally included in `react`, `react/recommended`, `nextjs`, `nextjs/recomme
317
319
  - `nextfriday/jsx-require-suspense`
318
320
  - `nextfriday/jsx-simple-props`
319
321
  - `nextfriday/jsx-sort-props`
322
+ - `nextfriday/jsx-spread-props-last`
320
323
  - `nextfriday/prefer-interface-over-inline-types`
321
324
  - `nextfriday/prefer-jsx-template-literals`
322
325
  - `nextfriday/react-props-destructure`
@@ -0,0 +1,42 @@
1
+ # jsx-spread-props-last
2
+
3
+ Enforce JSX spread attributes appear after all other props.
4
+
5
+ ## Rule Details
6
+
7
+ This rule flags JSX spread attributes (`{...props}`) that appear before any non-spread prop. Spreads must come at the end so they consistently override or extend the explicit props above them. When multiple spreads exist on the same element, all of them must sit at the tail.
8
+
9
+ ### Why?
10
+
11
+ - **Predictability**: Spread-last makes precedence consistent across the codebase
12
+ - **Readability**: Explicit props are visible up front; the spread is a clear extension point
13
+ - **Consistency**: Removes ambiguity about which props win when names collide
14
+
15
+ ## Examples
16
+
17
+ ### Incorrect
18
+
19
+ ```tsx
20
+ <Component {...bes} baz="baz" foobar={foobar} />
21
+ <Component baz="baz" {...bes} foobar={foobar} />
22
+ <Component {...a} name="x" {...b} />
23
+ <Component {...a} {...b} name="x" />
24
+ ```
25
+
26
+ ### Correct
27
+
28
+ ```tsx
29
+ <Component baz="baz" foobar={foobar} {...bes} />
30
+ <Component name="x" {...a} {...b} />
31
+ <Component {...bes} />
32
+ <Component name="x" count={1} disabled />
33
+ ```
34
+
35
+ ## When Not To Use It
36
+
37
+ - If your team intentionally puts spreads first so explicit props always win
38
+ - If you control prop precedence on a per-call basis by mixing spread and explicit props
39
+
40
+ ## Related Rules
41
+
42
+ - [jsx-sort-props](./JSX_SORT_PROPS.md) - Enforce JSX props are sorted by value type