eslint-plugin-react-hooks-extra 1.52.3-next.11 → 1.52.3-next.2
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 +26 -2
- package/dist/index.mjs +26 -2
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -52,7 +52,7 @@ var rules = {
|
|
|
52
52
|
|
|
53
53
|
// package.json
|
|
54
54
|
var name2 = "eslint-plugin-react-hooks-extra";
|
|
55
|
-
var version = "1.52.3-next.
|
|
55
|
+
var version = "1.52.3-next.2";
|
|
56
56
|
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("hooks-extra"));
|
|
57
57
|
function isFromHookCall(context, name3, settings, predicate = eff.constTrue) {
|
|
58
58
|
const hookAlias = settings.additionalHooks[name3] ?? [];
|
|
@@ -600,9 +600,19 @@ function create5(context) {
|
|
|
600
600
|
if (containsUseComments(context, node)) {
|
|
601
601
|
continue;
|
|
602
602
|
}
|
|
603
|
+
if (id != null) {
|
|
604
|
+
context.report({
|
|
605
|
+
messageId: "noUnnecessaryUsePrefix",
|
|
606
|
+
data: {
|
|
607
|
+
name: name3
|
|
608
|
+
},
|
|
609
|
+
loc: getPreferredLoc(context, id)
|
|
610
|
+
});
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
603
613
|
context.report({
|
|
604
614
|
messageId: "noUnnecessaryUsePrefix",
|
|
605
|
-
node
|
|
615
|
+
node,
|
|
606
616
|
data: {
|
|
607
617
|
name: name3
|
|
608
618
|
}
|
|
@@ -611,6 +621,20 @@ function create5(context) {
|
|
|
611
621
|
}
|
|
612
622
|
};
|
|
613
623
|
}
|
|
624
|
+
function getPreferredLoc(context, id) {
|
|
625
|
+
if (AST__namespace.isMultiLine(id)) return id.loc;
|
|
626
|
+
if (!context.sourceCode.getText(id).startsWith("use")) return id.loc;
|
|
627
|
+
return {
|
|
628
|
+
end: {
|
|
629
|
+
column: id.loc.start.column + 3,
|
|
630
|
+
line: id.loc.start.line
|
|
631
|
+
},
|
|
632
|
+
start: {
|
|
633
|
+
column: id.loc.start.column,
|
|
634
|
+
line: id.loc.start.line
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
}
|
|
614
638
|
var RULE_NAME6 = "prefer-use-state-lazy-initialization";
|
|
615
639
|
var RULE_FEATURES6 = [
|
|
616
640
|
"EXP"
|
package/dist/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ var rules = {
|
|
|
28
28
|
|
|
29
29
|
// package.json
|
|
30
30
|
var name2 = "eslint-plugin-react-hooks-extra";
|
|
31
|
-
var version = "1.52.3-next.
|
|
31
|
+
var version = "1.52.3-next.2";
|
|
32
32
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("hooks-extra"));
|
|
33
33
|
function isFromHookCall(context, name3, settings, predicate = constTrue) {
|
|
34
34
|
const hookAlias = settings.additionalHooks[name3] ?? [];
|
|
@@ -576,9 +576,19 @@ function create5(context) {
|
|
|
576
576
|
if (containsUseComments(context, node)) {
|
|
577
577
|
continue;
|
|
578
578
|
}
|
|
579
|
+
if (id != null) {
|
|
580
|
+
context.report({
|
|
581
|
+
messageId: "noUnnecessaryUsePrefix",
|
|
582
|
+
data: {
|
|
583
|
+
name: name3
|
|
584
|
+
},
|
|
585
|
+
loc: getPreferredLoc(context, id)
|
|
586
|
+
});
|
|
587
|
+
continue;
|
|
588
|
+
}
|
|
579
589
|
context.report({
|
|
580
590
|
messageId: "noUnnecessaryUsePrefix",
|
|
581
|
-
node
|
|
591
|
+
node,
|
|
582
592
|
data: {
|
|
583
593
|
name: name3
|
|
584
594
|
}
|
|
@@ -587,6 +597,20 @@ function create5(context) {
|
|
|
587
597
|
}
|
|
588
598
|
};
|
|
589
599
|
}
|
|
600
|
+
function getPreferredLoc(context, id) {
|
|
601
|
+
if (AST.isMultiLine(id)) return id.loc;
|
|
602
|
+
if (!context.sourceCode.getText(id).startsWith("use")) return id.loc;
|
|
603
|
+
return {
|
|
604
|
+
end: {
|
|
605
|
+
column: id.loc.start.column + 3,
|
|
606
|
+
line: id.loc.start.line
|
|
607
|
+
},
|
|
608
|
+
start: {
|
|
609
|
+
column: id.loc.start.column,
|
|
610
|
+
line: id.loc.start.line
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
}
|
|
590
614
|
var RULE_NAME6 = "prefer-use-state-lazy-initialization";
|
|
591
615
|
var RULE_FEATURES6 = [
|
|
592
616
|
"EXP"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-hooks-extra",
|
|
3
|
-
"version": "1.52.3-next.
|
|
3
|
+
"version": "1.52.3-next.2",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for React Hooks related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -44,18 +44,18 @@
|
|
|
44
44
|
"./package.json"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
48
|
-
"@typescript-eslint/type-utils": "^8.
|
|
49
|
-
"@typescript-eslint/types": "^8.
|
|
50
|
-
"@typescript-eslint/utils": "^8.
|
|
47
|
+
"@typescript-eslint/scope-manager": "^8.34.0",
|
|
48
|
+
"@typescript-eslint/type-utils": "^8.34.0",
|
|
49
|
+
"@typescript-eslint/types": "^8.34.0",
|
|
50
|
+
"@typescript-eslint/utils": "^8.34.0",
|
|
51
51
|
"string-ts": "^2.2.1",
|
|
52
52
|
"ts-pattern": "^5.7.1",
|
|
53
|
-
"@eslint-react/ast": "1.52.3-next.
|
|
54
|
-
"@eslint-react/core": "1.52.3-next.
|
|
55
|
-
"@eslint-react/
|
|
56
|
-
"@eslint-react/
|
|
57
|
-
"@eslint-react/
|
|
58
|
-
"@eslint-react/var": "1.52.3-next.
|
|
53
|
+
"@eslint-react/ast": "1.52.3-next.2",
|
|
54
|
+
"@eslint-react/core": "1.52.3-next.2",
|
|
55
|
+
"@eslint-react/kit": "1.52.3-next.2",
|
|
56
|
+
"@eslint-react/shared": "1.52.3-next.2",
|
|
57
|
+
"@eslint-react/eff": "1.52.3-next.2",
|
|
58
|
+
"@eslint-react/var": "1.52.3-next.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/react": "^19.1.8",
|