eslint-plugin-react-x 5.24.9 → 5.24.10

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 +9 -12
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -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.24.9";
138
+ var version = "5.24.10";
139
139
  //#endregion
140
140
  //#region src/utils/create-rule.ts
141
141
  function getDocsUrl(ruleName) {
@@ -1709,7 +1709,8 @@ function create$47(context) {
1709
1709
  }
1710
1710
  //#endregion
1711
1711
  //#region src/rules/no-array-index-key/lib.ts
1712
- const INDEX_PARAM_POSITIONS$1 = /* @__PURE__ */ new Map([
1712
+ const KNOWN_COERCION_FUNCTIONS = /* @__PURE__ */ new Set(["Number", "String"]);
1713
+ const KNOWN_INDEX_PARAM_POSITIONS = /* @__PURE__ */ new Map([
1713
1714
  ["every", 1],
1714
1715
  ["filter", 1],
1715
1716
  ["find", 1],
@@ -1735,7 +1736,7 @@ function isArrayIndexReference(context, node) {
1735
1736
  const callee = Extract.unwrap(call.callee);
1736
1737
  if (callee.type !== AST_NODE_TYPES.MemberExpression) return false;
1737
1738
  if (!Check.isIdentifier(callee.property)) return false;
1738
- const indexPosition = INDEX_PARAM_POSITIONS$1.get(callee.property.name);
1739
+ const indexPosition = KNOWN_INDEX_PARAM_POSITIONS.get(callee.property.name);
1739
1740
  if (indexPosition == null) return false;
1740
1741
  const callbackPosition = core.isChildrenMap(context, callee) || core.isChildrenForEach(context, callee) ? 1 : 0;
1741
1742
  if (call.arguments[callbackPosition] !== argument) return false;
@@ -1748,10 +1749,6 @@ function getIdentifiersFromBinaryExpression(side) {
1748
1749
  if (side.type === AST_NODE_TYPES.BinaryExpression) return [...getIdentifiersFromBinaryExpression(side.left), ...getIdentifiersFromBinaryExpression(side.right)];
1749
1750
  return [];
1750
1751
  }
1751
- //#endregion
1752
- //#region src/rules/no-array-index-key/no-array-index-key.ts
1753
- const RULE_NAME$46 = "no-array-index-key";
1754
- const COERCION_FUNCTIONS = /* @__PURE__ */ new Set(["Number", "String"]);
1755
1752
  var no_array_index_key_default = createRule({
1756
1753
  meta: {
1757
1754
  type: "suggestion",
@@ -1759,12 +1756,12 @@ var no_array_index_key_default = createRule({
1759
1756
  messages: { default: "Do not use item index in the array as its key." },
1760
1757
  schema: []
1761
1758
  },
1762
- name: RULE_NAME$46,
1759
+ name: "no-array-index-key",
1763
1760
  create: create$46
1764
1761
  });
1765
1762
  function create$46(context) {
1766
1763
  function isArrayIndex(node) {
1767
- return Check.isIdentifier(node) && isArrayIndexReference(context, node);
1764
+ return node != null && Check.isIdentifier(node) && isArrayIndexReference(context, node);
1768
1765
  }
1769
1766
  function getPropsObject(node) {
1770
1767
  const props = node.arguments[1];
@@ -1795,7 +1792,7 @@ function create$46(context) {
1795
1792
  node: callee.object
1796
1793
  }];
1797
1794
  const argument = node.arguments.at(0);
1798
- if (callee.type === AST_NODE_TYPES.Identifier && COERCION_FUNCTIONS.has(callee.name) && argument != null && isArrayIndex(argument)) return [{
1795
+ if (callee.type === AST_NODE_TYPES.Identifier && KNOWN_COERCION_FUNCTIONS.has(callee.name) && isArrayIndex(argument)) return [{
1799
1796
  messageId: "default",
1800
1797
  node: argument
1801
1798
  }];
@@ -2694,7 +2691,7 @@ function create$25(context) {
2694
2691
  }
2695
2692
  //#endregion
2696
2693
  //#region src/rules/no-missing-key/lib.ts
2697
- const INDEX_PARAM_POSITIONS = /* @__PURE__ */ new Map([
2694
+ const KNOWN_CALLBACK_POSITIONS = /* @__PURE__ */ new Map([
2698
2695
  ["flatMap", 0],
2699
2696
  ["from", 1],
2700
2697
  ["map", 0]
@@ -2726,7 +2723,7 @@ function getIteratorCallback(node) {
2726
2723
  const callee = Extract.unwrap(node.callee);
2727
2724
  if (callee.type !== AST_NODE_TYPES.MemberExpression) return null;
2728
2725
  if (!Check.isIdentifier(callee.property)) return null;
2729
- const position = INDEX_PARAM_POSITIONS.get(callee.property.name);
2726
+ const position = KNOWN_CALLBACK_POSITIONS.get(callee.property.name);
2730
2727
  if (position == null) return null;
2731
2728
  const callback = node.arguments[position];
2732
2729
  if (callback == null || !Check.isFunction(callback)) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "5.24.9",
3
+ "version": "5.24.10",
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,12 +36,12 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@eslint-react/ast": "5.24.9",
40
- "@eslint-react/core": "5.24.9",
41
- "@eslint-react/eslint": "5.24.9",
42
- "@eslint-react/jsx": "5.24.9",
43
- "@eslint-react/shared": "5.24.9",
44
- "@eslint-react/var": "5.24.9",
39
+ "@eslint-react/ast": "5.24.10",
40
+ "@eslint-react/core": "5.24.10",
41
+ "@eslint-react/eslint": "5.24.10",
42
+ "@eslint-react/jsx": "5.24.10",
43
+ "@eslint-react/shared": "5.24.10",
44
+ "@eslint-react/var": "5.24.10",
45
45
  "@typescript-eslint/scope-manager": "^8.71.1",
46
46
  "@typescript-eslint/types": "^8.71.1",
47
47
  "@typescript-eslint/typescript-estree": "^8.71.1",