eslint-plugin-react-x 2.0.0-next.173 → 2.0.0-next.175
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 -3
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -115,7 +115,7 @@ const settings = { ...settings$1 };
|
|
|
115
115
|
//#endregion
|
|
116
116
|
//#region package.json
|
|
117
117
|
var name = "eslint-plugin-react-x";
|
|
118
|
-
var version = "2.0.0-next.
|
|
118
|
+
var version = "2.0.0-next.175";
|
|
119
119
|
|
|
120
120
|
//#endregion
|
|
121
121
|
//#region src/utils/create-rule.ts
|
|
@@ -2263,12 +2263,13 @@ var no_unnecessary_key_default = createRule({
|
|
|
2263
2263
|
defaultOptions: []
|
|
2264
2264
|
});
|
|
2265
2265
|
function create$18(context) {
|
|
2266
|
-
if (!context.sourceCode.
|
|
2266
|
+
if (!context.sourceCode.text.includes("key=")) return {};
|
|
2267
2267
|
return { JSXAttribute(node) {
|
|
2268
2268
|
if (node.name.name !== "key") return;
|
|
2269
2269
|
const jsxElement = node.parent.parent;
|
|
2270
|
+
const initialScope = context.sourceCode.getScope(jsxElement);
|
|
2270
2271
|
const pMapCallback = AST.findParentNode(jsxElement, isMapCallback);
|
|
2271
|
-
if (pMapCallback == null) return;
|
|
2272
|
+
if (pMapCallback == null || context.sourceCode.getScope(pMapCallback) !== initialScope) return;
|
|
2272
2273
|
const pKeyedElementOrElse = AST.findParentNode(jsxElement, (n) => {
|
|
2273
2274
|
if (n === pMapCallback) return true;
|
|
2274
2275
|
return AST.isJSXElement(n) && n.openingElement.attributes.some((n$1) => n$1.type === AST_NODE_TYPES.JSXAttribute && n$1.name.type === AST_NODE_TYPES.JSXIdentifier && n$1.name.name === "key");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-x",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.175",
|
|
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",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"is-immutable-type": "^5.0.1",
|
|
43
43
|
"string-ts": "^2.2.1",
|
|
44
44
|
"ts-pattern": "^5.8.0",
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/core": "2.0.0-next.
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/var": "2.0.0-next.
|
|
50
|
-
"@eslint-react/shared": "2.0.0-next.
|
|
45
|
+
"@eslint-react/ast": "2.0.0-next.175",
|
|
46
|
+
"@eslint-react/core": "2.0.0-next.175",
|
|
47
|
+
"@eslint-react/eff": "2.0.0-next.175",
|
|
48
|
+
"@eslint-react/kit": "2.0.0-next.175",
|
|
49
|
+
"@eslint-react/var": "2.0.0-next.175",
|
|
50
|
+
"@eslint-react/shared": "2.0.0-next.175"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/react": "^19.1.12",
|