eslint-plugin-react-hooks-extra 1.14.3 → 1.15.0-beta.7
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/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var VAR3__namespace = /*#__PURE__*/_interopNamespace(VAR3);
|
|
|
32
32
|
|
|
33
33
|
// package.json
|
|
34
34
|
var name = "eslint-plugin-react-hooks-extra";
|
|
35
|
-
var version = "1.
|
|
35
|
+
var version = "1.15.0-beta.7";
|
|
36
36
|
var createRule = shared.createRuleForPlugin("hooks-extra");
|
|
37
37
|
function isFromHookCall(name2, context, settings, predicate = tools.F.constTrue) {
|
|
38
38
|
const hookAlias = settings.additionalHooks?.[name2] ?? [];
|
|
@@ -520,7 +520,10 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
520
520
|
const hasFunctionCall = nestedCallExpressions.some((n) => {
|
|
521
521
|
return "name" in n.callee && !ALLOW_LIST.includes(n.callee.name);
|
|
522
522
|
});
|
|
523
|
-
|
|
523
|
+
const hasNewCall = AST2__namespace.getNestedNewExpressions(useStateInput).some((n) => {
|
|
524
|
+
return "name" in n.callee && !ALLOW_LIST.includes(n.callee.name);
|
|
525
|
+
});
|
|
526
|
+
if (!hasFunctionCall && !hasNewCall) return;
|
|
524
527
|
context.report({
|
|
525
528
|
messageId: "preferUseStateLazyInitialization",
|
|
526
529
|
node: useStateInput
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { getStaticValue } from '@typescript-eslint/utils/ast-utils';
|
|
|
9
9
|
|
|
10
10
|
// package.json
|
|
11
11
|
var name = "eslint-plugin-react-hooks-extra";
|
|
12
|
-
var version = "1.
|
|
12
|
+
var version = "1.15.0-beta.7";
|
|
13
13
|
var createRule = createRuleForPlugin("hooks-extra");
|
|
14
14
|
function isFromHookCall(name2, context, settings, predicate = F.constTrue) {
|
|
15
15
|
const hookAlias = settings.additionalHooks?.[name2] ?? [];
|
|
@@ -497,7 +497,10 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
497
497
|
const hasFunctionCall = nestedCallExpressions.some((n) => {
|
|
498
498
|
return "name" in n.callee && !ALLOW_LIST.includes(n.callee.name);
|
|
499
499
|
});
|
|
500
|
-
|
|
500
|
+
const hasNewCall = AST2.getNestedNewExpressions(useStateInput).some((n) => {
|
|
501
|
+
return "name" in n.callee && !ALLOW_LIST.includes(n.callee.name);
|
|
502
|
+
});
|
|
503
|
+
if (!hasFunctionCall && !hasNewCall) return;
|
|
501
504
|
context.report({
|
|
502
505
|
messageId: "preferUseStateLazyInitialization",
|
|
503
506
|
node: useStateInput
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0-beta.7",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
"./package.json"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
45
|
-
"@typescript-eslint/type-utils": "^8.
|
|
46
|
-
"@typescript-eslint/types": "^8.
|
|
47
|
-
"@typescript-eslint/utils": "^8.
|
|
44
|
+
"@typescript-eslint/scope-manager": "^8.8.1",
|
|
45
|
+
"@typescript-eslint/type-utils": "^8.8.1",
|
|
46
|
+
"@typescript-eslint/types": "^8.8.1",
|
|
47
|
+
"@typescript-eslint/utils": "^8.8.1",
|
|
48
48
|
"ts-pattern": "^5.4.0",
|
|
49
|
-
"@eslint-react/ast": "1.
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/var": "1.
|
|
55
|
-
"@eslint-react/
|
|
49
|
+
"@eslint-react/ast": "1.15.0-beta.7",
|
|
50
|
+
"@eslint-react/jsx": "1.15.0-beta.7",
|
|
51
|
+
"@eslint-react/shared": "1.15.0-beta.7",
|
|
52
|
+
"@eslint-react/core": "1.15.0-beta.7",
|
|
53
|
+
"@eslint-react/tools": "1.15.0-beta.7",
|
|
54
|
+
"@eslint-react/var": "1.15.0-beta.7",
|
|
55
|
+
"@eslint-react/types": "1.15.0-beta.7"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@types/react": "^18.3.
|
|
58
|
+
"@types/react": "^18.3.11",
|
|
59
59
|
"@types/react-dom": "^18.3.0",
|
|
60
60
|
"string-ts": "^2.2.0",
|
|
61
61
|
"tsup": "^8.3.0"
|