eslint-plugin-react-x 2.5.7-beta.2 → 2.5.7-beta.3
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 +4 -4
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
|
3
3
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
4
4
|
import { P, isMatching, match } from "ts-pattern";
|
|
5
5
|
import ts from "typescript";
|
|
6
|
-
import { ComponentDetectionHint, ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit,
|
|
6
|
+
import { ComponentDetectionHint, ComponentFlag, DEFAULT_COMPONENT_DETECTION_HINT, JsxEmit, findEnclosingAssignmentTarget, findParentJsxAttribute, getJsxAttribute, getJsxAttributeName, getJsxConfigFromAnnotation, getJsxConfigFromContext, getJsxElementType, isAssignmentToThisState, isCaptureOwnerStackCall, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, isChildrenToArrayCall, isClassComponent, isCloneElementCall, isComponentDidCatch, isComponentDidMount, isComponentDidUpdate, isComponentNameLoose, isComponentWillMount, isComponentWillReceiveProps, isComponentWillUpdate, isCreateContextCall, isCreateElementCall, isCreateRefCall, isDeclaredInRenderPropLoose, isDirectValueOfRenderPropertyLoose, isForwardRefCall, isGetDerivedStateFromError, isGetDerivedStateFromProps, isInitializedFromReact, isInstanceIdEqual, isJsxFragmentElement, isJsxHostElement, isJsxText, isLazyCall, isReactHookCall, isReactHookName, isRenderMethodLike, isThisSetState, isUnsafeComponentWillMount, isUnsafeComponentWillReceiveProps, isUnsafeComponentWillUpdate, isUseCall, isUseCallbackCall, isUseContextCall, isUseEffectLikeCall, isUseMemoCall, isUseRefCall, isUseStateCall, useComponentCollector, useComponentCollectorLegacy, useHookCollector } from "@eslint-react/core";
|
|
7
7
|
import * as AST from "@eslint-react/ast";
|
|
8
8
|
import { findVariable, getChildScopes, getObjectType, getVariableDefinitionNode } from "@eslint-react/var";
|
|
9
9
|
import { constFalse, constTrue, flow, getOrElseUpdate, identity, unit } from "@eslint-react/eff";
|
|
@@ -34,7 +34,7 @@ var __exportAll = (all, symbols) => {
|
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region package.json
|
|
36
36
|
var name$6 = "eslint-plugin-react-x";
|
|
37
|
-
var version = "2.5.7-beta.
|
|
37
|
+
var version = "2.5.7-beta.3";
|
|
38
38
|
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/utils/create-rule.ts
|
|
@@ -1492,7 +1492,7 @@ function create$31(context) {
|
|
|
1492
1492
|
},
|
|
1493
1493
|
"Program:exit"() {
|
|
1494
1494
|
for (const call of createCalls) {
|
|
1495
|
-
const id =
|
|
1495
|
+
const id = findEnclosingAssignmentTarget(call);
|
|
1496
1496
|
if (id == null) {
|
|
1497
1497
|
context.report({
|
|
1498
1498
|
messageId: "noMissingContextDisplayName",
|
|
@@ -2081,7 +2081,7 @@ function create$20(context) {
|
|
|
2081
2081
|
if (jsxElement.openingElement.attributes.some((attr) => attr.type === AST_NODE_TYPES.JSXSpreadAttribute)) return;
|
|
2082
2082
|
const mapCallback = AST.findParentNode(jsxElement, isMapCallback);
|
|
2083
2083
|
if (mapCallback == null || AST.findParentNode(jsxElement, AST.isFunction) !== mapCallback) {
|
|
2084
|
-
if (!(AST.findParentNode(jsxElement, (n) => AST.isConditional(n) || AST.isControlFlow(n) ||
|
|
2084
|
+
if (!(AST.findParentNode(jsxElement, (n) => AST.isConditional(n) || AST.isControlFlow(n) || findEnclosingAssignmentTarget(n) != null) != null)) context.report({
|
|
2085
2085
|
messageId: "noUnnecessaryKey",
|
|
2086
2086
|
node,
|
|
2087
2087
|
data: { reason: "The `key` prop is not needed outside of dynamic rendering contexts." }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "2.5.7-beta.
|
|
3
|
+
"version": "2.5.7-beta.3",
|
|
4
4
|
"description": "A set of composable ESLint rules for for libraries and frameworks that use React as a UI runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"string-ts": "^2.3.1",
|
|
47
47
|
"ts-api-utils": "^2.4.0",
|
|
48
48
|
"ts-pattern": "^5.9.0",
|
|
49
|
-
"@eslint-react/
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/eff": "2.5.7-beta.
|
|
49
|
+
"@eslint-react/core": "2.5.7-beta.3",
|
|
50
|
+
"@eslint-react/shared": "2.5.7-beta.3",
|
|
51
|
+
"@eslint-react/var": "2.5.7-beta.3",
|
|
52
|
+
"@eslint-react/ast": "2.5.7-beta.3",
|
|
53
|
+
"@eslint-react/eff": "2.5.7-beta.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/react": "^19.2.8",
|