eslint-plugin-react-hooks-extra 1.14.3 → 1.15.0-beta.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/dist/index.js +6 -2
- package/dist/index.mjs +6 -2
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ var VAR3 = require('@eslint-react/var');
|
|
|
8
8
|
var types = require('@typescript-eslint/types');
|
|
9
9
|
var tsPattern = require('ts-pattern');
|
|
10
10
|
var astUtils = require('@typescript-eslint/utils/ast-utils');
|
|
11
|
+
require('@typescript-eslint/utils');
|
|
11
12
|
|
|
12
13
|
function _interopNamespace(e) {
|
|
13
14
|
if (e && e.__esModule) return e;
|
|
@@ -32,7 +33,7 @@ var VAR3__namespace = /*#__PURE__*/_interopNamespace(VAR3);
|
|
|
32
33
|
|
|
33
34
|
// package.json
|
|
34
35
|
var name = "eslint-plugin-react-hooks-extra";
|
|
35
|
-
var version = "1.
|
|
36
|
+
var version = "1.15.0-beta.0";
|
|
36
37
|
var createRule = shared.createRuleForPlugin("hooks-extra");
|
|
37
38
|
function isFromHookCall(name2, context, settings, predicate = tools.F.constTrue) {
|
|
38
39
|
const hookAlias = settings.additionalHooks?.[name2] ?? [];
|
|
@@ -520,7 +521,10 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
520
521
|
const hasFunctionCall = nestedCallExpressions.some((n) => {
|
|
521
522
|
return "name" in n.callee && !ALLOW_LIST.includes(n.callee.name);
|
|
522
523
|
});
|
|
523
|
-
|
|
524
|
+
const hasNewCall = AST2__namespace.getNestedNewExpressions(useStateInput).some((n) => {
|
|
525
|
+
return "name" in n.callee && !ALLOW_LIST.includes(n.callee.name);
|
|
526
|
+
});
|
|
527
|
+
if (!hasFunctionCall && !hasNewCall) return;
|
|
524
528
|
context.report({
|
|
525
529
|
messageId: "preferUseStateLazyInitialization",
|
|
526
530
|
node: useStateInput
|
package/dist/index.mjs
CHANGED
|
@@ -6,10 +6,11 @@ import * as VAR3 from '@eslint-react/var';
|
|
|
6
6
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
7
7
|
import { match, isMatching } from 'ts-pattern';
|
|
8
8
|
import { getStaticValue } from '@typescript-eslint/utils/ast-utils';
|
|
9
|
+
import '@typescript-eslint/utils';
|
|
9
10
|
|
|
10
11
|
// package.json
|
|
11
12
|
var name = "eslint-plugin-react-hooks-extra";
|
|
12
|
-
var version = "1.
|
|
13
|
+
var version = "1.15.0-beta.0";
|
|
13
14
|
var createRule = createRuleForPlugin("hooks-extra");
|
|
14
15
|
function isFromHookCall(name2, context, settings, predicate = F.constTrue) {
|
|
15
16
|
const hookAlias = settings.additionalHooks?.[name2] ?? [];
|
|
@@ -497,7 +498,10 @@ var prefer_use_state_lazy_initialization_default = createRule({
|
|
|
497
498
|
const hasFunctionCall = nestedCallExpressions.some((n) => {
|
|
498
499
|
return "name" in n.callee && !ALLOW_LIST.includes(n.callee.name);
|
|
499
500
|
});
|
|
500
|
-
|
|
501
|
+
const hasNewCall = AST2.getNestedNewExpressions(useStateInput).some((n) => {
|
|
502
|
+
return "name" in n.callee && !ALLOW_LIST.includes(n.callee.name);
|
|
503
|
+
});
|
|
504
|
+
if (!hasFunctionCall && !hasNewCall) return;
|
|
501
505
|
context.report({
|
|
502
506
|
messageId: "preferUseStateLazyInitialization",
|
|
503
507
|
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.0",
|
|
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.0",
|
|
45
|
+
"@typescript-eslint/type-utils": "^8.8.0",
|
|
46
|
+
"@typescript-eslint/types": "^8.8.0",
|
|
47
|
+
"@typescript-eslint/utils": "^8.8.0",
|
|
48
48
|
"ts-pattern": "^5.4.0",
|
|
49
|
-
"@eslint-react/ast": "1.
|
|
50
|
-
"@eslint-react/core": "1.
|
|
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.0",
|
|
50
|
+
"@eslint-react/core": "1.15.0-beta.0",
|
|
51
|
+
"@eslint-react/shared": "1.15.0-beta.0",
|
|
52
|
+
"@eslint-react/types": "1.15.0-beta.0",
|
|
53
|
+
"@eslint-react/jsx": "1.15.0-beta.0",
|
|
54
|
+
"@eslint-react/var": "1.15.0-beta.0",
|
|
55
|
+
"@eslint-react/tools": "1.15.0-beta.0"
|
|
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"
|