eslint-plugin-hyper-fetch 8.1.1 โ†’ 8.2.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.
Files changed (2) hide show
  1. package/README.md +53 -50
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,84 +1,87 @@
1
- # Eslint Plugin Hyper Fetch
1
+ # ๐Ÿงน Hyper Fetch ESLint Plugin
2
2
 
3
- <p>
4
- <a href="https://bettertyped.com/">
5
- <img src="https://custom-icon-badges.demolab.com/static/v1?label=&message=BetterTyped&color=333&logo=BT" />
6
- </a>
3
+ <p align="center">
4
+ <b>ESLint rules to enforce HyperFetch best practices and catch type issues early.</b>
5
+ </p>
6
+
7
+ <p align="center">
7
8
  <a href="https://github.com/BetterTyped/hyper-fetch">
8
- <img src="https://custom-icon-badges.demolab.com/github/stars/BetterTyped/hyper-fetch?logo=star&color=118ab2" />
9
+ <img src="https://img.shields.io/github/stars/BetterTyped/hyper-fetch?style=flat" alt="GitHub stars" />
9
10
  </a>
10
- <a href="https://github.com/BetterTyped/hyper-fetch/blob/main/License.md">
11
- <img src="https://custom-icon-badges.demolab.com/github/license/BetterTyped/hyper-fetch?logo=law&color=yellow" />
11
+ <a href="https://www.npmjs.com/package/eslint-plugin-hyper-fetch">
12
+ <img src="https://img.shields.io/npm/v/eslint-plugin-hyper-fetch" alt="npm version" />
12
13
  </a>
13
- <a href="https://www.npmjs.com/package/@hyper-fetch/react">
14
- <img src="https://custom-icon-badges.demolab.com/npm/v/@hyper-fetch/react.svg?logo=npm&color=e76f51" />
14
+ <a href="https://github.com/BetterTyped/hyper-fetch/blob/main/License.md">
15
+ <img src="https://img.shields.io/github/license/BetterTyped/hyper-fetch" alt="License" />
15
16
  </a>
16
17
  <a href="https://github.com/BetterTyped/hyper-fetch">
17
- <img src="https://custom-icon-badges.demolab.com/badge/typescript-%23007ACC.svg?logo=typescript&logoColor=white" />
18
- </a>
19
- <a href="https://www.npmjs.com/package/@hyper-fetch/react">
20
- <img src="https://custom-icon-badges.demolab.com/bundlephobia/minzip/@hyper-fetch/react?color=64BC4B&logo=package" />
18
+ <img src="https://img.shields.io/badge/typescript-%23007ACC.svg?logo=typescript&logoColor=white" alt="TypeScript" />
21
19
  </a>
22
20
  </p>
23
21
 
24
- ## About
22
+ ## ๐Ÿ“– About
25
23
 
26
- **`Eslint Plugin Hyper Fetch`** is a plugin for eslint rules to add some additional functionality for your code static
27
- analysis. It allows to find generic types issues like typos, missing values or completely incorrect usage of types.
24
+ This ESLint plugin provides static analysis rules specific to HyperFetch. It catches generic type issues like typos, missing values, or incorrect usage of `createClient` and `createRequest` type parameters before they cause runtime errors.
28
25
 
29
- ## Installation
26
+ ## ๐ŸŽฏ Key Capabilities
30
27
 
31
- Assuming you already have ESLint installed, run:
28
+ - ๐Ÿ”ฎ **Catch type bugs before they run** โ€” Validates `createClient` and `createRequest` generic parameters at lint time
29
+ - โœจ **No more typo-induced `any`** โ€” Detects misspelled keys like `rsponse` instead of `response`
30
+ - ๐Ÿ”ง **Plug and play** โ€” Use the recommended preset or configure rules one by one
32
31
 
33
- ```sh
34
- #npm
35
- npm i eslint-plugin-hyper-fetch
32
+ ## ๐Ÿš€ Quick Start
36
33
 
37
- #yarn
38
- yarn add -D eslint-plugin-hyper-fetch
34
+ ```bash
35
+ npm install -D eslint-plugin-hyper-fetch
39
36
  ```
40
37
 
41
- Then extend the recommended eslint config:
42
-
43
- ```js
38
+ ```json
44
39
  {
45
- "extends": [
46
- // ...
47
- "plugin:hyper-fetch/recommended"
48
- ]
40
+ "extends": ["plugin:hyper-fetch/recommended"]
49
41
  }
50
42
  ```
51
43
 
52
- ### Custom Configuration
53
-
54
- If you want more fine-grained configuration, you can instead add a snippet like this to your ESLint configuration file:
44
+ Or configure individual rules:
55
45
 
56
- ```js
46
+ ```json
57
47
  {
58
- "plugins": [
59
- // ...
60
- "hyper-fetch"
61
- ],
48
+ "plugins": ["hyper-fetch"],
62
49
  "rules": {
63
- // ...
64
50
  "hyper-fetch/client-generic-types": "error",
65
51
  "hyper-fetch/request-generic-types": "error"
66
52
  }
67
53
  }
68
54
  ```
69
55
 
70
- ## Help me keep working on this project โค๏ธ
56
+ ## ๐Ÿ“š Documentation
57
+
58
+ - [ESLint Plugin Docs](https://hyperfetch.bettertyped.com/docs/integrations/plugin-eslint)
59
+ - [Getting Started](https://hyperfetch.bettertyped.com/docs/getting-started/quick-start)
71
60
 
72
- - [Become a Sponsor on GitHub](https://github.com/sponsors/prc5)
61
+ ## ๐Ÿ’ก Examples
73
62
 
74
- ## Sources
63
+ ### Catches incorrect generic types
75
64
 
76
- - #### [Installation](https://hyperfetch.bettertyped.com/docs/getting-started/installation)
77
- - #### [Docs](https://hyperfetch.bettertyped.com/docs/react/overview)
78
- - #### [API](https://hyperfetch.bettertyped.com/api/)
79
- - #### [NPM](https://www.npmjs.com/package/@hyper-fetch/react)
80
- - #### [Guides](https://hyperfetch.bettertyped.com/guides/basic/setup)
65
+ ```ts
66
+ // โŒ This will be flagged by hyper-fetch/request-generic-types
67
+ const getUser = client.createRequest<{
68
+ rsponse: User; // Typo: "rsponse" instead of "response"
69
+ }>()({
70
+ endpoint: "/users/:userId",
71
+ method: "GET",
72
+ });
73
+ ```
74
+
75
+ ```ts
76
+ // โœ… Correct usage โ€” no lint error
77
+ const getUser = client.createRequest<{
78
+ response: User;
79
+ }>()({
80
+ endpoint: "/users/:userId",
81
+ method: "GET",
82
+ });
83
+ ```
81
84
 
82
- ## Other Packages
85
+ ## License
83
86
 
84
- - - #### [Hyper Fetch](https://github.com/BetterTyped/hyper-fetch/tree/main/packages/core)
87
+ [MIT](https://github.com/BetterTyped/hyper-fetch/blob/main/License.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-hyper-fetch",
3
- "version": "8.1.1",
3
+ "version": "8.2.0",
4
4
  "description": "Eslint plugin for HyperFetch",
5
5
  "author": "Maciej Pyrc <maciekpyrc@gmail.com>, Kacper Skawina <kacper.skawina@gmail.com>",
6
6
  "homepage": "https://hyperfetch.bettertyped.com/",