eslint-plugin-react-x 2.6.5-next.1 → 2.7.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.
Files changed (2) hide show
  1. package/dist/index.js +4 -3
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -68,7 +68,7 @@ const rules$7 = {
68
68
  //#endregion
69
69
  //#region package.json
70
70
  var name$6 = "eslint-plugin-react-x";
71
- var version = "2.6.5-next.1";
71
+ var version = "2.7.0-beta.0";
72
72
 
73
73
  //#endregion
74
74
  //#region src/utils/create-rule.ts
@@ -2155,10 +2155,10 @@ function create$20(context) {
2155
2155
  "Program:exit"(node) {
2156
2156
  const components = ctx.getAllComponents(node);
2157
2157
  for (const key of constantKeys) {
2158
- if (AST.findParentNode(key, (n) => AST.isConditional(n) || AST.isControlFlow(n) || findEnclosingAssignmentTarget(n) != null || components.some((comp) => comp.node === n && comp.rets.length > 1)) != null) return;
2158
+ if (AST.findParentNode(key, (n) => AST.isConditional(n) || AST.isControlFlow(n) || findEnclosingAssignmentTarget(n) != null || components.some((comp) => comp.node === n && comp.rets.length > 1)) != null) continue;
2159
2159
  context.report({
2160
2160
  messageId: "noUnnecessaryKey",
2161
- node,
2161
+ node: key,
2162
2162
  data: { reason: "The `key` prop is not needed outside of dynamic rendering contexts." }
2163
2163
  });
2164
2164
  }
@@ -2390,6 +2390,7 @@ function create$16(context) {
2390
2390
  if (id.type !== AST_NODE_TYPES.Identifier || init == null || !isUseRefCall(init)) return;
2391
2391
  const [ref, ...rest] = context.sourceCode.getDeclaredVariables(node);
2392
2392
  if (ref == null || rest.length > 0) return;
2393
+ if (ref.name.toLowerCase().startsWith("prev")) return;
2393
2394
  const effects = /* @__PURE__ */ new Set();
2394
2395
  let globalUsages = 0;
2395
2396
  for (const { identifier, init: init$1 } of ref.references) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "2.6.5-next.1",
3
+ "version": "2.7.0-beta.0",
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/ast": "2.6.5-next.1",
50
- "@eslint-react/core": "2.6.5-next.1",
51
- "@eslint-react/eff": "2.6.5-next.1",
52
- "@eslint-react/shared": "2.6.5-next.1",
53
- "@eslint-react/var": "2.6.5-next.1"
49
+ "@eslint-react/ast": "2.7.0-beta.0",
50
+ "@eslint-react/core": "2.7.0-beta.0",
51
+ "@eslint-react/eff": "2.7.0-beta.0",
52
+ "@eslint-react/shared": "2.7.0-beta.0",
53
+ "@eslint-react/var": "2.7.0-beta.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/react": "^19.2.8",