functype-react 1.20.0 → 1.21.1
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/README.md +27 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -259,10 +259,36 @@ Both the hooks and the primitives are generic over any `IO<never, E, A>` — not
|
|
|
259
259
|
- **SSR / RSC**: hooks are client-only and marked with `"use client"`. `<Match>` family components are pure and render fine in Server Components.
|
|
260
260
|
- **React Query**: Tier 5 targets `@tanstack/react-query` v5 (`>=5.0.0`), an optional peer. The `ioQueryFn` / `ioMutationFn` primitives type their context structurally, so they carry no `@tanstack` types and are unaffected by its major-version churn.
|
|
261
261
|
|
|
262
|
+
## Linting
|
|
263
|
+
|
|
264
|
+
`eslint-plugin-functype` ships two React rules:
|
|
265
|
+
|
|
266
|
+
- `functype/no-getOrThrow-in-render` reports a bare `.orThrow()` in a component or hook body, where a missing value would throw during render and unmount the tree.
|
|
267
|
+
- `functype/must-fold-on-component-return` reports a component that picks what it renders with an `isSome()` / `isLeft()` early return or `&&`, instead of `fold` or a `Match` component.
|
|
268
|
+
|
|
269
|
+
Both are on (`warn`) in `functype.configs.strict`. With `recommended`, turn them on yourself:
|
|
270
|
+
|
|
271
|
+
```js
|
|
272
|
+
// eslint.config.mjs
|
|
273
|
+
import functype from "eslint-plugin-functype"
|
|
274
|
+
|
|
275
|
+
export default [
|
|
276
|
+
functype.configs.recommended,
|
|
277
|
+
{
|
|
278
|
+
files: ["**/*.tsx", "**/*.jsx"],
|
|
279
|
+
rules: {
|
|
280
|
+
"functype/no-getOrThrow-in-render": "error",
|
|
281
|
+
"functype/must-fold-on-component-return": "warn",
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
]
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
They work without type information and are more precise with it (`parserOptions.projectService`). See the [plugin README](../eslint-plugin-functype/README.md#react-rules) for what each one reports.
|
|
288
|
+
|
|
262
289
|
## Deferred to v0.2
|
|
263
290
|
|
|
264
291
|
- `./optics` subpath (`useLens`, `useOptional`, `useSelector`) — blocked on core not shipping a lens module yet.
|
|
265
|
-
- React-specific ESLint rules (`must-fold-on-component-return`, `no-getOrThrow-in-render`, etc.) — land in `eslint-functype@2.4.0` once the API stabilizes.
|
|
266
292
|
- Codemods, Storybook, cookbook recipes on the Astro site.
|
|
267
293
|
- Playwright browser-based testing for `useTaskValue` + `<TaskBoundary>` (jsdom doesn't unsuspend React 19's `use()` reliably).
|
|
268
294
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functype-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"description": "React bindings for functype — ADT-aware hooks and exhaustive pattern matching components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"functype",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@types/react": "^19.3.0",
|
|
49
49
|
"@types/react-dom": "^19.3.0",
|
|
50
50
|
"fast-check": "^4.10.2",
|
|
51
|
-
"functype": "^1.
|
|
51
|
+
"functype": "^1.21.1",
|
|
52
52
|
"jsdom": "^30.1.1",
|
|
53
53
|
"react": "^19.3.0",
|
|
54
54
|
"react-dom": "^19.3.0",
|