eslint-plugin-react-hooks-extra 1.5.21-next.5 → 1.5.21
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 +48 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +8 -9
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# eslint-plugin-react-hooks-extra
|
|
2
|
+
|
|
3
|
+
Extra rules for React Hooks.
|
|
4
|
+
|
|
5
|
+
> [!TIP]
|
|
6
|
+
> This plugin is already included in `@eslint-react/eslint-plugin`. You don't need to install it separately if you are using `@eslint-react/eslint-plugin`.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
# npm
|
|
12
|
+
npm install --save-dev eslint-plugin-react-hooks-extra
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
Add the plugin to your `eslint.config.js`:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
// @ts-check
|
|
21
|
+
|
|
22
|
+
import js from "@eslint/js";
|
|
23
|
+
import reactHooksExtra from "eslint-plugin-react-hooks-extra";
|
|
24
|
+
|
|
25
|
+
export default [
|
|
26
|
+
js.configs.recommended,
|
|
27
|
+
{
|
|
28
|
+
files: ["**/*.{ts,tsx}"],
|
|
29
|
+
plugins: [
|
|
30
|
+
"react-hooks-extra": reactHooksExtra,
|
|
31
|
+
rules: {
|
|
32
|
+
// react-hooks-extra recommended rules
|
|
33
|
+
"react-hooks-extra/ensure-custom-hooks-using-other-hooks": "warn",
|
|
34
|
+
"react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
|
|
43
|
+
| Rule | Description | 💼 | 💭 | ❌ |
|
|
44
|
+
| :--------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------- | :-: | :-: | :-: |
|
|
45
|
+
| [`hooks-extra/ensure-custom-hooks-using-other-hooks`](hooks-extra-ensure-custom-hooks-using-other-hooks) | Warns when custom Hooks that don't use other Hooks. | ✔️ | | |
|
|
46
|
+
| [`hooks-extra/ensure-use-callback-has-non-empty-deps`](hooks-extra-ensure-use-callback-has-non-empty-deps) | Warns when `useCallback` is called with empty dependencies array. | 🧐 | | |
|
|
47
|
+
| [`hooks-extra/ensure-use-memo-has-non-empty-deps`](hooks-extra-ensure-use-memo-has-non-empty-deps) | Warns when `useMemo` is called with empty dependencies array. | 🧐 | | |
|
|
48
|
+
| [`hooks-extra/prefer-use-state-lazy-initialization`](hooks-extra-prefer-use-state-lazy-initialization) | Warns function calls made inside `useState` calls. | 🚀 | | |
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __export = (target, all2) => {
|
|
|
13
13
|
|
|
14
14
|
// package.json
|
|
15
15
|
var name = "eslint-plugin-react-hooks-extra";
|
|
16
|
-
var version = "1.5.21
|
|
16
|
+
var version = "1.5.21";
|
|
17
17
|
var createRule = shared.createRuleForPlugin("hooks-extra");
|
|
18
18
|
|
|
19
19
|
// src/rules/ensure-custom-hooks-using-other-hooks.ts
|
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ var __export = (target, all2) => {
|
|
|
11
11
|
|
|
12
12
|
// package.json
|
|
13
13
|
var name = "eslint-plugin-react-hooks-extra";
|
|
14
|
-
var version = "1.5.21
|
|
14
|
+
var version = "1.5.21";
|
|
15
15
|
var createRule = createRuleForPlugin("hooks-extra");
|
|
16
16
|
|
|
17
17
|
// src/rules/ensure-custom-hooks-using-other-hooks.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "1.5.21
|
|
3
|
+
"version": "1.5.21",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
|
|
5
5
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"@typescript-eslint/type-utils": "8.0.0-alpha.40",
|
|
40
40
|
"@typescript-eslint/types": "8.0.0-alpha.40",
|
|
41
41
|
"@typescript-eslint/utils": "8.0.0-alpha.40",
|
|
42
|
-
"@eslint-react/ast": "1.5.21
|
|
43
|
-
"@eslint-react/core": "1.5.21
|
|
44
|
-
"@eslint-react/jsx": "1.5.21
|
|
45
|
-
"@eslint-react/shared": "1.5.21
|
|
46
|
-
"@eslint-react/tools": "1.5.21
|
|
47
|
-
"@eslint-react/types": "1.5.21
|
|
48
|
-
"@eslint-react/var": "1.5.21
|
|
42
|
+
"@eslint-react/ast": "1.5.21",
|
|
43
|
+
"@eslint-react/core": "1.5.21",
|
|
44
|
+
"@eslint-react/jsx": "1.5.21",
|
|
45
|
+
"@eslint-react/shared": "1.5.21",
|
|
46
|
+
"@eslint-react/tools": "1.5.21",
|
|
47
|
+
"@eslint-react/types": "1.5.21",
|
|
48
|
+
"@eslint-react/var": "1.5.21"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"dedent": "1.5.3",
|
|
@@ -74,7 +74,6 @@
|
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"build": "tsup",
|
|
77
|
-
"build:docs": "typedoc",
|
|
78
77
|
"lint:publish": "publint",
|
|
79
78
|
"lint:type": "tsc --noEmit"
|
|
80
79
|
}
|