eslint-plugin-react-x 5.28.2 → 5.28.4
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 +9 -11
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { P, isMatching, match } from "ts-pattern";
|
|
|
8
8
|
import { isAssignmentTargetEqual, isInitializedFromReact, resolveEnclosingAssignmentTarget, resolveObjectType, resolveOrigin } from "@eslint-react/var";
|
|
9
9
|
import { DefinitionType, ScopeType } from "@typescript-eslint/scope-manager";
|
|
10
10
|
import { findVariable, getStaticValue } from "@typescript-eslint/utils/ast-utils";
|
|
11
|
-
import { findParentAttribute, getElementFullType, hasAttribute } from "@eslint-react/jsx";
|
|
11
|
+
import { findParentAttribute, getElementFullType, hasAttribute, isAttribute } from "@eslint-react/jsx";
|
|
12
12
|
import { compare } from "compare-versions";
|
|
13
13
|
import { unionConstituents } from "ts-api-utils";
|
|
14
14
|
import "typescript";
|
|
@@ -135,7 +135,7 @@ const rules$6 = {
|
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region package.json
|
|
137
137
|
var name$6 = "eslint-plugin-react-x";
|
|
138
|
-
var version = "5.28.
|
|
138
|
+
var version = "5.28.4";
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region src/utils/create-rule.ts
|
|
141
141
|
function getDocsUrl(ruleName) {
|
|
@@ -157,7 +157,7 @@ var error_boundaries_default = createRule({
|
|
|
157
157
|
});
|
|
158
158
|
function create$50(context) {
|
|
159
159
|
if (!context.sourceCode.text.includes("try")) return {};
|
|
160
|
-
const hint = core.
|
|
160
|
+
const hint = core.JSXDetectionHint.DoNotIncludeJSXWithNullValue | core.JSXDetectionHint.DoNotIncludeJSXWithNumberValue | core.JSXDetectionHint.DoNotIncludeJSXWithBigIntValue | core.JSXDetectionHint.DoNotIncludeJSXWithStringValue | core.JSXDetectionHint.DoNotIncludeJSXWithBooleanValue | core.JSXDetectionHint.DoNotIncludeJSXWithUndefinedValue | core.JSXDetectionHint.DoNotIncludeJSXWithEmptyArrayValue;
|
|
161
161
|
const fc = core.getFunctionComponentCollector(context);
|
|
162
162
|
const hc = core.getHookCollector(context);
|
|
163
163
|
const reported = /* @__PURE__ */ new Set();
|
|
@@ -184,7 +184,7 @@ function create$50(context) {
|
|
|
184
184
|
}
|
|
185
185
|
for (const { rets } of funcs) for (const ret of rets) {
|
|
186
186
|
if (ret == null) continue;
|
|
187
|
-
if (!core.
|
|
187
|
+
if (!core.isJSXLike(context, ret, hint)) continue;
|
|
188
188
|
const stmt = Traverse.findEnclosingTryBlock(ret);
|
|
189
189
|
if (stmt != null && !reported.has(stmt)) {
|
|
190
190
|
context.report({
|
|
@@ -2920,7 +2920,7 @@ var no_nested_component_definitions_default = createRule({
|
|
|
2920
2920
|
create: create$22
|
|
2921
2921
|
});
|
|
2922
2922
|
function create$22(context) {
|
|
2923
|
-
const hint = core.FunctionComponentDetectionHint.
|
|
2923
|
+
const hint = core.FunctionComponentDetectionHint.DoNotIncludeJSXWithNumberValue | core.FunctionComponentDetectionHint.DoNotIncludeJSXWithBooleanValue | core.FunctionComponentDetectionHint.DoNotIncludeJSXWithNullValue | core.FunctionComponentDetectionHint.DoNotIncludeJSXWithStringValue | core.FunctionComponentDetectionHint.DoNotIncludeJSXWithUndefinedValue | core.FunctionComponentDetectionHint.RequireBothSidesOfLogicalExpressionToBeJSX | core.FunctionComponentDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJSX | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayPatternElement | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayExpressionElement | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayMapCallback | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayFlatMapCallback;
|
|
2924
2924
|
const fc = core.getFunctionComponentCollector(context, { hint });
|
|
2925
2925
|
const cc = core.getClassComponentCollector(context);
|
|
2926
2926
|
return merge(fc.visitor, cc.visitor, { "Program:exit"(program) {
|
|
@@ -3241,11 +3241,9 @@ function create$13(context) {
|
|
|
3241
3241
|
const enclosingFunction = Traverse.findParent(node, Check.isFunction);
|
|
3242
3242
|
if (enclosingFunction == null) return;
|
|
3243
3243
|
if (compilationMode === "annotation" && core.isFunctionHasDirective(enclosingFunction, "use memo")) return;
|
|
3244
|
-
const attribute = node.attributes.
|
|
3245
|
-
if (attribute
|
|
3246
|
-
const
|
|
3247
|
-
if (value?.type !== AST_NODE_TYPES.JSXExpressionContainer) return;
|
|
3248
|
-
const valueExpression = value.expression;
|
|
3244
|
+
const attribute = node.attributes.findLast(isAttribute("value"));
|
|
3245
|
+
if (attribute?.value?.type !== AST_NODE_TYPES.JSXExpressionContainer) return;
|
|
3246
|
+
const valueExpression = attribute.value.expression;
|
|
3249
3247
|
const construction = resolveObjectType(context, valueExpression);
|
|
3250
3248
|
if (construction == null) return;
|
|
3251
3249
|
if (core.isHookCall(construction.node)) return;
|
|
@@ -7134,7 +7132,7 @@ var static_components_default = createRule({
|
|
|
7134
7132
|
create: create$3
|
|
7135
7133
|
});
|
|
7136
7134
|
function create$3(context) {
|
|
7137
|
-
const hint = core.FunctionComponentDetectionHint.
|
|
7135
|
+
const hint = core.FunctionComponentDetectionHint.DoNotIncludeJSXWithNumberValue | core.FunctionComponentDetectionHint.DoNotIncludeJSXWithBooleanValue | core.FunctionComponentDetectionHint.DoNotIncludeJSXWithNullValue | core.FunctionComponentDetectionHint.DoNotIncludeJSXWithStringValue | core.FunctionComponentDetectionHint.DoNotIncludeJSXWithUndefinedValue | core.FunctionComponentDetectionHint.RequireBothSidesOfLogicalExpressionToBeJSX | core.FunctionComponentDetectionHint.RequireBothBranchesOfConditionalExpressionToBeJSX | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayPatternElement | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayExpressionElement | core.FunctionComponentDetectionHint.DoNotIncludeFunctionDefinedAsArrayMapCallback;
|
|
7138
7136
|
const fc = core.getFunctionComponentCollector(context, { hint });
|
|
7139
7137
|
const cc = core.getClassComponentCollector(context);
|
|
7140
7138
|
const { facts, visitor } = createFactCollector$1();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "5.28.
|
|
3
|
+
"version": "5.28.4",
|
|
4
4
|
"description": "A set of composable ESLint rules for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@eslint-react/ast": "5.28.
|
|
40
|
-
"@eslint-react/core": "5.28.
|
|
41
|
-
"@eslint-react/eslint": "5.28.
|
|
42
|
-
"@eslint-react/jsx": "5.28.
|
|
43
|
-
"@eslint-react/shared": "5.28.
|
|
44
|
-
"@eslint-react/var": "5.28.
|
|
45
|
-
"@typescript-eslint/scope-manager": "^8.
|
|
46
|
-
"@typescript-eslint/types": "^8.
|
|
47
|
-
"@typescript-eslint/typescript-estree": "^8.
|
|
48
|
-
"@typescript-eslint/utils": "^8.
|
|
39
|
+
"@eslint-react/ast": "5.28.4",
|
|
40
|
+
"@eslint-react/core": "5.28.4",
|
|
41
|
+
"@eslint-react/eslint": "5.28.4",
|
|
42
|
+
"@eslint-react/jsx": "5.28.4",
|
|
43
|
+
"@eslint-react/shared": "5.28.4",
|
|
44
|
+
"@eslint-react/var": "5.28.4",
|
|
45
|
+
"@typescript-eslint/scope-manager": "^8.72.0",
|
|
46
|
+
"@typescript-eslint/types": "^8.72.0",
|
|
47
|
+
"@typescript-eslint/typescript-estree": "^8.72.0",
|
|
48
|
+
"@typescript-eslint/utils": "^8.72.0",
|
|
49
49
|
"compare-versions": "^6.1.1",
|
|
50
50
|
"string-ts": "^2.3.1",
|
|
51
51
|
"ts-api-utils": "^2.5.0",
|