eslint-plugin-react-x 1.22.2-next.1 → 1.22.2-next.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 (3) hide show
  1. package/dist/index.js +151 -213
  2. package/dist/index.mjs +152 -214
  3. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var eff = require('@eslint-react/eff');
4
- var JSX8 = require('@eslint-react/jsx');
4
+ var JSX7 = require('@eslint-react/jsx');
5
5
  var shared = require('@eslint-react/shared');
6
6
  var AST11 = require('@eslint-react/ast');
7
7
  var core = require('@eslint-react/core');
@@ -35,14 +35,14 @@ function _interopNamespace(e) {
35
35
  return Object.freeze(n);
36
36
  }
37
37
 
38
- var JSX8__namespace = /*#__PURE__*/_interopNamespace(JSX8);
38
+ var JSX7__namespace = /*#__PURE__*/_interopNamespace(JSX7);
39
39
  var AST11__namespace = /*#__PURE__*/_interopNamespace(AST11);
40
40
  var VAR__namespace = /*#__PURE__*/_interopNamespace(VAR);
41
41
  var ts__default = /*#__PURE__*/_interopDefault(ts);
42
42
 
43
43
  // package.json
44
44
  var name = "eslint-plugin-react-x";
45
- var version = "1.22.2-next.1";
45
+ var version = "1.22.2-next.10";
46
46
  var createRule = shared.createRuleForPlugin("x");
47
47
 
48
48
  // src/rules/avoid-shorthand-boolean.ts
@@ -70,7 +70,7 @@ var avoid_shorthand_boolean_default = createRule({
70
70
  messageId: "avoidShorthandBoolean",
71
71
  node,
72
72
  data: {
73
- propName: JSX8__namespace.getPropName(node)
73
+ propName: JSX7__namespace.getPropName(node)
74
74
  },
75
75
  fix: (fixer) => fixer.insertTextAfter(node.name, `={true}`)
76
76
  });
@@ -151,7 +151,7 @@ var RULE_FEATURES4 = [
151
151
  "CHK"
152
152
  ];
153
153
  function getName(node) {
154
- if (node.type === types.AST_NODE_TYPES.TSAsExpression) {
154
+ if (AST11__namespace.isTypeExpression(node)) {
155
155
  return getName(node.expression);
156
156
  }
157
157
  if (node.type === types.AST_NODE_TYPES.Identifier || node.type === types.AST_NODE_TYPES.PrivateIdentifier) {
@@ -537,7 +537,7 @@ var no_children_prop_default = createRule({
537
537
  return {
538
538
  JSXElement(node) {
539
539
  const initialScope = context.sourceCode.getScope(node);
540
- const prop = JSX8__namespace.getProp(node.openingElement.attributes, "children", initialScope);
540
+ const prop = JSX7__namespace.getProp(node.openingElement.attributes, "children", initialScope);
541
541
  const reportDescriptor = eff.O.map(prop, (prop2) => ({ messageId: "noChildrenProp", node: prop2 }));
542
542
  eff.O.map(reportDescriptor, context.report);
543
543
  }
@@ -912,7 +912,7 @@ var no_context_provider_default = createRule({
912
912
  if (compareVersions.compare(version2, "19.0.0", "<")) return {};
913
913
  return {
914
914
  JSXElement(node) {
915
- const elementName = JSX8__namespace.getElementName(node.openingElement);
915
+ const elementName = JSX7__namespace.getElementName(node.openingElement);
916
916
  if (!elementName.endsWith(".Provider")) return;
917
917
  context.report({
918
918
  messageId: "noContextProvider",
@@ -1009,7 +1009,7 @@ var RULE_FEATURES22 = [
1009
1009
  "CHK"
1010
1010
  ];
1011
1011
  function getName2(node) {
1012
- if (node.type === types.AST_NODE_TYPES.TSAsExpression) {
1012
+ if (AST11__namespace.isTypeExpression(node)) {
1013
1013
  return getName2(node.expression);
1014
1014
  }
1015
1015
  if (node.type === types.AST_NODE_TYPES.Identifier || node.type === types.AST_NODE_TYPES.PrivateIdentifier) {
@@ -1123,116 +1123,61 @@ var no_duplicate_key_default = createRule({
1123
1123
  },
1124
1124
  name: RULE_NAME24,
1125
1125
  create(context) {
1126
- const isWithinChildrenToArrayRef = eff.MutRef.make(false);
1127
- function isKeyEqual(a, b) {
1128
- return VAR__namespace.isNodeValueEqual(a, b, [context.sourceCode.getScope(a), context.sourceCode.getScope(b)]);
1126
+ if (!context.sourceCode.getText().includes("key=")) return {};
1127
+ const keyedEntries = /* @__PURE__ */ new Map();
1128
+ function isKeyValueEqual(a, b) {
1129
+ const aValue = a.value;
1130
+ const bValue = b.value;
1131
+ if (aValue === null || bValue === null) return false;
1132
+ return AST11__namespace.isNodeEqual(aValue, bValue);
1129
1133
  }
1130
- function checkIteratorElement(node) {
1131
- if (node.type !== types.AST_NODE_TYPES.JSXElement) return eff.O.none();
1132
- const initialScope = context.sourceCode.getScope(node);
1133
- return eff.F.pipe(
1134
- JSX8__namespace.findPropInAttributes(node.openingElement.attributes, initialScope)("key"),
1135
- eff.O.flatMap((k) => "value" in k ? eff.O.fromNullable(k.value) : eff.O.none()),
1136
- eff.O.flatMap((v) => {
1137
- return isKeyEqual(v, v) ? eff.O.some({
1138
- messageId: "noDuplicateKey",
1139
- node: v,
1140
- data: {
1141
- value: context.sourceCode.getText(v)
1142
- }
1143
- }) : eff.O.none();
1144
- })
1145
- );
1146
- }
1147
- function checkExpression(node) {
1148
- switch (node.type) {
1149
- case types.AST_NODE_TYPES.ConditionalExpression:
1150
- if (!("consequent" in node)) return eff.O.none();
1151
- return eff.F.pipe(
1152
- checkIteratorElement(node.consequent),
1153
- eff.O.orElse(() => checkIteratorElement(node.alternate))
1154
- );
1155
- case types.AST_NODE_TYPES.JSXElement:
1156
- case types.AST_NODE_TYPES.JSXFragment:
1157
- return checkIteratorElement(node);
1158
- case types.AST_NODE_TYPES.LogicalExpression:
1159
- if (!("left" in node)) return eff.O.none();
1160
- return eff.F.pipe(
1161
- checkIteratorElement(node.left),
1162
- eff.O.orElse(() => checkIteratorElement(node.right))
1163
- );
1164
- default:
1165
- return eff.O.none();
1166
- }
1167
- }
1168
- function checkBlockStatement(node) {
1169
- return AST11__namespace.getNestedReturnStatements(node).reduce((acc, statement) => {
1170
- if (!statement.argument) return acc;
1171
- const maybeDescriptor = checkIteratorElement(statement.argument);
1172
- if (eff.O.isNone(maybeDescriptor)) return acc;
1173
- const descriptor = maybeDescriptor.value;
1174
- return [...acc, descriptor];
1175
- }, []);
1176
- }
1177
- const seen = /* @__PURE__ */ new WeakSet();
1178
1134
  return {
1179
- "ArrayExpression, JSXElement > JSXElement"(node) {
1180
- if (eff.MutRef.get(isWithinChildrenToArrayRef)) return;
1181
- const elements = tsPattern.match(node).with({ type: types.AST_NODE_TYPES.ArrayExpression }, ({ elements: elements2 }) => elements2).with({ type: types.AST_NODE_TYPES.JSXElement }, ({ parent }) => "children" in parent ? parent.children : []).otherwise(() => []).filter(AST11__namespace.is(types.AST_NODE_TYPES.JSXElement)).filter((element) => !seen.has(element));
1182
- const keys = elements.reduce(
1183
- (acc, element) => {
1184
- const attr = element.openingElement.attributes.findLast((attr2) => {
1185
- if (attr2.type !== types.AST_NODE_TYPES.JSXAttribute) return false;
1186
- return attr2.name.name === "key";
1135
+ "JSXAttribute[name.name='key']"(node) {
1136
+ const jsxElement = node.parent.parent;
1137
+ switch (jsxElement.parent.type) {
1138
+ case types.AST_NODE_TYPES.ArrayExpression:
1139
+ case types.AST_NODE_TYPES.JSXElement:
1140
+ case types.AST_NODE_TYPES.JSXFragment: {
1141
+ const root = jsxElement.parent;
1142
+ const prevKeys = keyedEntries.get(root)?.keys ?? [];
1143
+ keyedEntries.set(root, {
1144
+ hasDuplicate: prevKeys.some((prevKey) => isKeyValueEqual(prevKey, node)),
1145
+ keys: [...prevKeys, node],
1146
+ root: jsxElement.parent
1187
1147
  });
1188
- if (!attr || !("value" in attr) || attr.value === null) return acc;
1189
- const { value } = attr;
1190
- if (acc.length === 0) return [[element, attr, value]];
1191
- if (acc.some(([_, _1, v]) => isKeyEqual(v, value))) {
1192
- return [...acc, [element, attr, value]];
1193
- }
1194
- return acc;
1195
- },
1196
- []
1197
- );
1198
- if (keys.length < 2) return;
1199
- for (const [element, attr, value] of keys) {
1200
- seen.add(element);
1201
- context.report({
1202
- messageId: "noDuplicateKey",
1203
- node: attr,
1204
- data: {
1205
- value: context.sourceCode.getText(value)
1148
+ break;
1149
+ }
1150
+ default: {
1151
+ const entry = eff.F.pipe(
1152
+ eff.O.Do,
1153
+ eff.O.bind("call", () => AST11__namespace.traverseUpGuard(jsxElement, AST11__namespace.isMapCallLoose)),
1154
+ eff.O.bind("iter", ({ call }) => AST11__namespace.traverseUpStop(jsxElement, call, AST11__namespace.isFunction)),
1155
+ eff.O.bind("arg0", ({ call }) => eff.O.fromNullable(call.arguments[0]))
1156
+ );
1157
+ for (const { arg0, call, iter } of eff.O.toArray(entry)) {
1158
+ if (AST11__namespace.unwrapTypeExpression(arg0) !== iter) continue;
1159
+ keyedEntries.set(call, {
1160
+ hasDuplicate: node.value?.type === types.AST_NODE_TYPES.Literal,
1161
+ keys: [node],
1162
+ root: call
1163
+ });
1206
1164
  }
1207
- });
1165
+ }
1208
1166
  }
1209
1167
  },
1210
- CallExpression(node) {
1211
- if (core.isChildrenToArrayCall(node, context)) eff.MutRef.set(isWithinChildrenToArrayRef, true);
1212
- const isMapCall = AST11__namespace.isMapCallLoose(node);
1213
- const isArrayFromCall = tsPattern.isMatching({
1214
- type: types.AST_NODE_TYPES.CallExpression,
1215
- callee: {
1216
- type: types.AST_NODE_TYPES.MemberExpression,
1217
- property: {
1218
- name: "from"
1219
- }
1220
- }
1221
- }, node);
1222
- if (!isMapCall && !isArrayFromCall) return;
1223
- if (eff.MutRef.get(isWithinChildrenToArrayRef)) return;
1224
- const fn = node.arguments[isMapCall ? 0 : 1];
1225
- if (!AST11__namespace.isOneOf([types.AST_NODE_TYPES.ArrowFunctionExpression, types.AST_NODE_TYPES.FunctionExpression])(fn)) return;
1226
- if (fn.body.type === types.AST_NODE_TYPES.BlockStatement) {
1227
- for (const descriptor of checkBlockStatement(fn.body)) {
1228
- context.report(descriptor);
1168
+ "Program:exit"() {
1169
+ for (const { hasDuplicate, keys } of keyedEntries.values()) {
1170
+ if (!hasDuplicate) continue;
1171
+ for (const key of keys) {
1172
+ context.report({
1173
+ messageId: "noDuplicateKey",
1174
+ node: key,
1175
+ data: {
1176
+ value: context.sourceCode.getText(key)
1177
+ }
1178
+ });
1229
1179
  }
1230
- return;
1231
1180
  }
1232
- eff.O.map(checkExpression(fn.body), context.report);
1233
- },
1234
- "CallExpression:exit"(node) {
1235
- if (core.isChildrenToArrayCall(node, context)) eff.MutRef.set(isWithinChildrenToArrayRef, false);
1236
1181
  }
1237
1182
  };
1238
1183
  },
@@ -1355,7 +1300,7 @@ var no_implicit_key_default = createRule({
1355
1300
  create(context) {
1356
1301
  function getReportDescriptor(node) {
1357
1302
  const initialScope = context.sourceCode.getScope(node);
1358
- const keyPropFound = JSX8__namespace.findPropInAttributes(node.attributes, initialScope)("key");
1303
+ const keyPropFound = JSX7__namespace.findPropInAttributes(node.attributes, initialScope)("key");
1359
1304
  const keyPropOnElement = node.attributes.some(
1360
1305
  (n) => AST11__namespace.is(types.AST_NODE_TYPES.JSXAttribute)(n) && n.name.name === "key"
1361
1306
  );
@@ -1595,12 +1540,12 @@ var no_missing_key_default = createRule({
1595
1540
  },
1596
1541
  name: RULE_NAME29,
1597
1542
  create(context) {
1598
- const isWithinChildrenToArrayRef = eff.MutRef.make(false);
1543
+ const state = { isWithinChildrenToArray: false };
1599
1544
  function checkIteratorElement(node) {
1600
1545
  switch (node.type) {
1601
1546
  case types.AST_NODE_TYPES.JSXElement: {
1602
1547
  const initialScope = context.sourceCode.getScope(node);
1603
- if (!JSX8__namespace.hasProp(node.openingElement.attributes, "key", initialScope)) {
1548
+ if (!JSX7__namespace.hasProp(node.openingElement.attributes, "key", initialScope)) {
1604
1549
  return eff.O.some({
1605
1550
  messageId: "noMissingKey",
1606
1551
  node
@@ -1644,12 +1589,12 @@ var no_missing_key_default = createRule({
1644
1589
  }
1645
1590
  return {
1646
1591
  ArrayExpression(node) {
1647
- if (eff.MutRef.get(isWithinChildrenToArrayRef)) return;
1592
+ if (state.isWithinChildrenToArray) return;
1648
1593
  const elements = node.elements.filter(AST11__namespace.is(types.AST_NODE_TYPES.JSXElement));
1649
1594
  if (elements.length === 0) return;
1650
1595
  const initialScope = context.sourceCode.getScope(node);
1651
1596
  for (const element of elements) {
1652
- if (!JSX8__namespace.hasProp(element.openingElement.attributes, "key", initialScope)) {
1597
+ if (!JSX7__namespace.hasProp(element.openingElement.attributes, "key", initialScope)) {
1653
1598
  context.report({
1654
1599
  messageId: "noMissingKey",
1655
1600
  node: element
@@ -1658,7 +1603,8 @@ var no_missing_key_default = createRule({
1658
1603
  }
1659
1604
  },
1660
1605
  CallExpression(node) {
1661
- if (core.isChildrenToArrayCall(node, context)) eff.MutRef.set(isWithinChildrenToArrayRef, true);
1606
+ state.isWithinChildrenToArray ||= core.isChildrenToArrayCall(node, context);
1607
+ if (state.isWithinChildrenToArray) return;
1662
1608
  const isMapCall = AST11__namespace.isMapCallLoose(node);
1663
1609
  const isArrayFromCall = tsPattern.isMatching({
1664
1610
  type: types.AST_NODE_TYPES.CallExpression,
@@ -1670,7 +1616,6 @@ var no_missing_key_default = createRule({
1670
1616
  }
1671
1617
  }, node);
1672
1618
  if (!isMapCall && !isArrayFromCall) return;
1673
- if (eff.MutRef.get(isWithinChildrenToArrayRef)) return;
1674
1619
  const fn = node.arguments[isMapCall ? 0 : 1];
1675
1620
  if (!AST11__namespace.isOneOf([types.AST_NODE_TYPES.ArrowFunctionExpression, types.AST_NODE_TYPES.FunctionExpression])(fn)) return;
1676
1621
  if (fn.body.type === types.AST_NODE_TYPES.BlockStatement) {
@@ -1682,10 +1627,11 @@ var no_missing_key_default = createRule({
1682
1627
  eff.O.map(checkExpression(fn.body), context.report);
1683
1628
  },
1684
1629
  "CallExpression:exit"(node) {
1685
- if (core.isChildrenToArrayCall(node, context)) eff.MutRef.set(isWithinChildrenToArrayRef, false);
1630
+ if (!core.isChildrenToArrayCall(node, context)) return;
1631
+ state.isWithinChildrenToArray = false;
1686
1632
  },
1687
1633
  JSXFragment(node) {
1688
- if (eff.MutRef.get(isWithinChildrenToArrayRef)) return;
1634
+ if (state.isWithinChildrenToArray) return;
1689
1635
  if (node.parent.type === types.AST_NODE_TYPES.ArrayExpression) {
1690
1636
  context.report({
1691
1637
  messageId: "noMissingKeyWithFragment",
@@ -1736,7 +1682,7 @@ var no_nested_components_default = createRule({
1736
1682
  if (eff.O.isNone(componentName)) continue;
1737
1683
  const name2 = componentName.value;
1738
1684
  const isInsideProperty = component.parent.type === types.AST_NODE_TYPES.Property;
1739
- const isInsideJSXPropValue = component.parent.type === types.AST_NODE_TYPES.JSXAttribute || eff.O.isSome(JSX8__namespace.traverseUpProp(node, (n) => n.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer));
1685
+ const isInsideJSXPropValue = component.parent.type === types.AST_NODE_TYPES.JSXAttribute || eff.O.isSome(JSX7__namespace.traverseUpProp(node, (n) => n.value?.type === types.AST_NODE_TYPES.JSXExpressionContainer));
1740
1686
  if (isInsideJSXPropValue) {
1741
1687
  if (!core.isDeclaredInRenderPropLoose(component)) {
1742
1688
  context.report({
@@ -1782,7 +1728,7 @@ var no_nested_components_default = createRule({
1782
1728
  }
1783
1729
  }
1784
1730
  for (const { name: name2, node: component } of classComponents) {
1785
- if (eff.O.isNone(AST11__namespace.traverseUp(component, (node2) => isClassComponent11(node2) || isFunctionComponent(node2)))) {
1731
+ if (eff.O.isNone(AST11__namespace.traverseUp(component, eff.or(isClassComponent11, isFunctionComponent)))) {
1786
1732
  continue;
1787
1733
  }
1788
1734
  context.report({
@@ -1912,22 +1858,25 @@ var no_set_state_in_component_did_mount_default = createRule({
1912
1858
  if (!context.sourceCode.text.includes("componentDidMount")) return {};
1913
1859
  function getReportDescriptor(node) {
1914
1860
  if (!core.isThisSetState(node)) return eff.O.none();
1915
- const maybeParentClass = AST11__namespace.traverseUp(
1916
- node,
1917
- AST11__namespace.isOneOf([types.AST_NODE_TYPES.ClassDeclaration, types.AST_NODE_TYPES.ClassExpression])
1861
+ return eff.F.pipe(
1862
+ eff.O.Do,
1863
+ eff.O.bind("clazz", () => AST11__namespace.traverseUpGuard(node, core.isClassComponent)),
1864
+ eff.O.bind("method", ({ clazz }) => AST11__namespace.traverseUpStop(node, clazz, isComponentDidMount)),
1865
+ eff.O.bind("methodScope", ({ method }) => eff.O.some(context.sourceCode.getScope(method))),
1866
+ eff.O.bind("upperScope", () => eff.O.fromNullable(context.sourceCode.getScope(node).upper)),
1867
+ eff.O.filter(
1868
+ ({
1869
+ clazz,
1870
+ method,
1871
+ methodScope,
1872
+ upperScope
1873
+ }) => method.parent === clazz.body && upperScope === methodScope
1874
+ ),
1875
+ eff.O.map(() => ({
1876
+ messageId: "noSetStateInComponentDidMount",
1877
+ node
1878
+ }))
1918
1879
  );
1919
- if (eff.O.isNone(maybeParentClass)) return eff.O.none();
1920
- const parentClass = maybeParentClass.value;
1921
- if (!core.isClassComponent(parentClass)) return eff.O.none();
1922
- const maybeParentMethod = AST11__namespace.traverseUp(node, isComponentDidMount);
1923
- if (eff.O.isNone(maybeParentMethod)) return eff.O.none();
1924
- const parentMethod = maybeParentMethod.value;
1925
- if (parentMethod.parent !== parentClass.body) return eff.O.none();
1926
- if (context.sourceCode.getScope(node).upper !== context.sourceCode.getScope(parentMethod)) return eff.O.none();
1927
- return eff.O.some({
1928
- messageId: "noSetStateInComponentDidMount",
1929
- node
1930
- });
1931
1880
  }
1932
1881
  return {
1933
1882
  CallExpression: eff.F.flow(getReportDescriptor, eff.O.map(context.report))
@@ -1959,22 +1908,19 @@ var no_set_state_in_component_did_update_default = createRule({
1959
1908
  if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
1960
1909
  function getReportDescriptor(node) {
1961
1910
  if (!core.isThisSetState(node)) return eff.O.none();
1962
- const maybeParentClass = AST11__namespace.traverseUp(
1963
- node,
1964
- AST11__namespace.isOneOf([types.AST_NODE_TYPES.ClassDeclaration, types.AST_NODE_TYPES.ClassExpression])
1911
+ return eff.F.pipe(
1912
+ eff.O.Do,
1913
+ eff.O.bind("clazz", () => AST11__namespace.traverseUpGuard(node, core.isClassComponent)),
1914
+ eff.O.bind("method", ({ clazz }) => AST11__namespace.traverseUpStop(node, clazz, isComponentDidUpdate)),
1915
+ eff.O.bind("upperScope", () => eff.O.fromNullable(context.sourceCode.getScope(node).upper)),
1916
+ eff.O.filter(
1917
+ ({ clazz, method, upperScope }) => method.parent === clazz.body && upperScope === context.sourceCode.getScope(method)
1918
+ ),
1919
+ eff.O.map(() => ({
1920
+ messageId: "noSetStateInComponentDidUpdate",
1921
+ node
1922
+ }))
1965
1923
  );
1966
- if (eff.O.isNone(maybeParentClass)) return eff.O.none();
1967
- const parentClass = maybeParentClass.value;
1968
- if (!core.isClassComponent(parentClass)) return eff.O.none();
1969
- const maybeParentMethod = AST11__namespace.traverseUp(node, isComponentDidUpdate);
1970
- if (eff.O.isNone(maybeParentMethod)) return eff.O.none();
1971
- const parentMethod = maybeParentMethod.value;
1972
- if (parentMethod.parent !== parentClass.body) return eff.O.none();
1973
- if (context.sourceCode.getScope(node).upper !== context.sourceCode.getScope(parentMethod)) return eff.O.none();
1974
- return eff.O.some({
1975
- messageId: "noSetStateInComponentDidUpdate",
1976
- node
1977
- });
1978
1924
  }
1979
1925
  return {
1980
1926
  CallExpression: eff.F.flow(getReportDescriptor, eff.O.map(context.report))
@@ -2006,22 +1952,19 @@ var no_set_state_in_component_will_update_default = createRule({
2006
1952
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
2007
1953
  function getReportDescriptor(node) {
2008
1954
  if (!core.isThisSetState(node)) return eff.O.none();
2009
- const maybeParentClass = AST11__namespace.traverseUp(
2010
- node,
2011
- AST11__namespace.isOneOf([types.AST_NODE_TYPES.ClassDeclaration, types.AST_NODE_TYPES.ClassExpression])
1955
+ return eff.F.pipe(
1956
+ eff.O.Do,
1957
+ eff.O.bind("clazz", () => AST11__namespace.traverseUpGuard(node, core.isClassComponent)),
1958
+ eff.O.bind("method", ({ clazz }) => AST11__namespace.traverseUpStop(node, clazz, isComponentWillUpdate3)),
1959
+ eff.O.bind("upperScope", () => eff.O.fromNullable(context.sourceCode.getScope(node).upper)),
1960
+ eff.O.filter(
1961
+ ({ clazz, method, upperScope }) => method.parent === clazz.body && upperScope === context.sourceCode.getScope(method)
1962
+ ),
1963
+ eff.O.map(() => ({
1964
+ messageId: "noSetStateInComponentWillUpdate",
1965
+ node
1966
+ }))
2012
1967
  );
2013
- if (eff.O.isNone(maybeParentClass)) return eff.O.none();
2014
- const parentClass = maybeParentClass.value;
2015
- if (!core.isClassComponent(parentClass)) return eff.O.none();
2016
- const maybeParentMethod = AST11__namespace.traverseUp(node, isComponentWillUpdate3);
2017
- if (eff.O.isNone(maybeParentMethod)) return eff.O.none();
2018
- const parentMethod = maybeParentMethod.value;
2019
- if (parentMethod.parent !== parentClass.body) return eff.O.none();
2020
- if (context.sourceCode.getScope(node).upper !== context.sourceCode.getScope(parentMethod)) return eff.O.none();
2021
- return eff.O.some({
2022
- messageId: "noSetStateInComponentWillUpdate",
2023
- node
2024
- });
2025
1968
  }
2026
1969
  return {
2027
1970
  CallExpression: eff.F.flow(getReportDescriptor, eff.O.map(context.report))
@@ -2219,39 +2162,40 @@ var no_unstable_context_value_default = createRule({
2219
2162
  name: RULE_NAME40,
2220
2163
  create(context) {
2221
2164
  const { ctx, listeners } = core.useComponentCollector(context);
2222
- const possibleValueConstructions = /* @__PURE__ */ new Map();
2165
+ const constructions = /* @__PURE__ */ new Map();
2223
2166
  return {
2224
2167
  ...listeners,
2225
2168
  JSXOpeningElement(node) {
2226
2169
  const openingElementName = node.name;
2227
2170
  if (openingElementName.type !== types.AST_NODE_TYPES.JSXMemberExpression) return;
2228
2171
  if (openingElementName.property.name !== "Provider") return;
2229
- const maybeJSXValueAttribute = eff.O.fromNullable(
2230
- node.attributes.find((attribute) => {
2231
- return attribute.type === types.AST_NODE_TYPES.JSXAttribute && attribute.name.name === "value";
2232
- })
2172
+ const constructionEntry = eff.F.pipe(
2173
+ eff.O.Do,
2174
+ eff.O.bind("function", ctx.getCurrentFunction),
2175
+ eff.O.bind("attribute", () => eff.O.fromNullable(
2176
+ node.attributes.find((attribute) => {
2177
+ return attribute.type === types.AST_NODE_TYPES.JSXAttribute && attribute.name.name === "value";
2178
+ })
2179
+ )),
2180
+ eff.O.bind("value", ({ attribute }) => "value" in attribute ? eff.O.some(attribute.value) : eff.O.none()),
2181
+ eff.O.bind("valueExpression", ({ value }) => value?.type === types.AST_NODE_TYPES.JSXExpressionContainer ? eff.O.some(value.expression) : eff.O.none()),
2182
+ eff.O.bind("construction", ({ valueExpression }) => {
2183
+ const initialScope = context.sourceCode.getScope(valueExpression);
2184
+ return eff.O.some(VAR__namespace.inspectConstruction(valueExpression, initialScope));
2185
+ }),
2186
+ eff.O.filter(({ construction }) => construction._tag !== "None")
2233
2187
  );
2234
- if (eff.O.isNone(maybeJSXValueAttribute) || !("value" in maybeJSXValueAttribute.value)) return;
2235
- const valueNode = maybeJSXValueAttribute.value.value;
2236
- if (valueNode?.type !== types.AST_NODE_TYPES.JSXExpressionContainer) return;
2237
- const valueExpression = valueNode.expression;
2238
- const initialScope = context.sourceCode.getScope(valueExpression);
2239
- const construction = VAR__namespace.inspectConstruction(valueExpression, initialScope);
2240
- if (construction._tag === "None") return;
2241
- eff.O.map(
2242
- ctx.getCurrentFunction(),
2243
- ([_, currentFn]) => possibleValueConstructions.set(currentFn, [
2244
- ...possibleValueConstructions.get(currentFn) ?? [],
2188
+ for (const { construction, function: [_, fNode] } of eff.O.toArray(constructionEntry)) {
2189
+ constructions.set(fNode, [
2190
+ ...constructions.get(fNode) ?? [],
2245
2191
  construction
2246
- ])
2247
- );
2192
+ ]);
2193
+ }
2248
2194
  },
2249
2195
  "Program:exit"(node) {
2250
2196
  const components = ctx.getAllComponents(node).values();
2251
2197
  for (const { node: component } of components) {
2252
- const constructions = possibleValueConstructions.get(component);
2253
- if (!constructions) continue;
2254
- for (const construction of constructions) {
2198
+ for (const construction of constructions.get(component) ?? []) {
2255
2199
  if (construction._tag === "None") continue;
2256
2200
  const { node: constructionNode, _tag } = construction;
2257
2201
  const messageId = _tag.startsWith("Function") ? "noUnstableContextValueWithFunction" : "noUnstableContextValueWithIdentifier";
@@ -2288,7 +2232,7 @@ var no_unstable_default_props_default = createRule({
2288
2232
  name: RULE_NAME41,
2289
2233
  create(context) {
2290
2234
  const { ctx, listeners } = core.useComponentCollector(context);
2291
- const possibleDestructuringDeclarators = /* @__PURE__ */ new WeakMap();
2235
+ const declarators = /* @__PURE__ */ new WeakMap();
2292
2236
  return {
2293
2237
  ...listeners,
2294
2238
  "Program:exit"(node) {
@@ -2298,10 +2242,7 @@ var no_unstable_default_props_default = createRule({
2298
2242
  const [props] = params;
2299
2243
  if (!props) continue;
2300
2244
  const properties = tsPattern.match(props).with({ type: types.AST_NODE_TYPES.ObjectPattern }, ({ properties: properties2 }) => properties2).with({ type: types.AST_NODE_TYPES.Identifier }, ({ name: name2 }) => {
2301
- const variableDeclarators = possibleDestructuringDeclarators.get(component);
2302
- if (!variableDeclarators) return [];
2303
- const declarators = variableDeclarators.filter((d) => d.init.name === name2);
2304
- return declarators.flatMap((d) => d.id.properties);
2245
+ return declarators.get(component)?.filter((d) => d.init.name === name2).flatMap((d) => d.id.properties) ?? [];
2305
2246
  }).otherwise(() => []);
2306
2247
  for (const prop of properties) {
2307
2248
  if (prop.type !== types.AST_NODE_TYPES.Property || prop.value.type !== types.AST_NODE_TYPES.AssignmentPattern) continue;
@@ -2326,13 +2267,10 @@ var no_unstable_default_props_default = createRule({
2326
2267
  }
2327
2268
  },
2328
2269
  "VariableDeclarator[id.type='ObjectPattern'][init.type='Identifier']"(node) {
2329
- eff.O.map(
2330
- ctx.getCurrentFunction(),
2331
- ([_, currentFn]) => possibleDestructuringDeclarators.set(currentFn, [
2332
- ...possibleDestructuringDeclarators.get(currentFn) ?? [],
2333
- node
2334
- ])
2335
- );
2270
+ for (const [_, currentFn] of eff.O.toArray(ctx.getCurrentFunction())) {
2271
+ const prevDeclarators = declarators.get(currentFn) ?? [];
2272
+ declarators.set(currentFn, [...prevDeclarators, node]);
2273
+ }
2336
2274
  }
2337
2275
  };
2338
2276
  },
@@ -2360,7 +2298,7 @@ var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
2360
2298
  "UNSAFE_componentWillUpdate"
2361
2299
  ]);
2362
2300
  function getName3(node) {
2363
- if (node.type === types.AST_NODE_TYPES.TSAsExpression) {
2301
+ if (AST11__namespace.isTypeExpression(node)) {
2364
2302
  return getName3(node.expression);
2365
2303
  }
2366
2304
  if (node.type === types.AST_NODE_TYPES.Identifier || node.type === types.AST_NODE_TYPES.PrivateIdentifier) {
@@ -2460,7 +2398,9 @@ var no_unused_class_component_members_default = createRule({
2460
2398
  if (node.init && AST11__namespace.isThisExpression(node.init) && node.id.type === types.AST_NODE_TYPES.ObjectPattern) {
2461
2399
  for (const prop of node.id.properties) {
2462
2400
  if (prop.type === types.AST_NODE_TYPES.Property && AST11__namespace.isKeyLiteralLike(prop, prop.key)) {
2463
- eff.O.map(getName3(prop.key), (name2) => propertyUsages.get(currentClass)?.add(name2));
2401
+ for (const name2 of eff.O.toArray(getName3(prop.key))) {
2402
+ propertyUsages.get(currentClass)?.add(name2);
2403
+ }
2464
2404
  }
2465
2405
  }
2466
2406
  }
@@ -2474,7 +2414,7 @@ var RULE_FEATURES43 = [
2474
2414
  "CHK"
2475
2415
  ];
2476
2416
  function getName4(node) {
2477
- if (node.type === types.AST_NODE_TYPES.TSAsExpression) {
2417
+ if (AST11__namespace.isTypeExpression(node)) {
2478
2418
  return getName4(node.expression);
2479
2419
  }
2480
2420
  if (node.type === types.AST_NODE_TYPES.Identifier || node.type === types.AST_NODE_TYPES.PrivateIdentifier) {
@@ -2617,18 +2557,18 @@ var no_unused_state_default = createRule({
2617
2557
  var RULE_NAME44 = "no-useless-fragment";
2618
2558
  function check(node, context, allowExpressions) {
2619
2559
  const initialScope = context.sourceCode.getScope(node);
2620
- if (JSX8__namespace.isKeyedElement(node, initialScope)) return;
2621
- if (JSX8__namespace.isBuiltInElement(node.parent)) context.report({ messageId: "noUselessFragmentInBuiltIn", node });
2560
+ if (JSX7__namespace.isKeyedElement(node, initialScope)) return;
2561
+ if (JSX7__namespace.isBuiltInElement(node.parent)) context.report({ messageId: "noUselessFragmentInBuiltIn", node });
2622
2562
  if (node.children.length === 0) return context.report({ messageId: "noUselessFragment", node });
2623
2563
  const isChildren = AST11__namespace.isOneOf([types.AST_NODE_TYPES.JSXElement, types.AST_NODE_TYPES.JSXFragment])(node.parent);
2624
2564
  const [firstChildren] = node.children;
2625
- if (allowExpressions && node.children.length === 1 && JSX8__namespace.isLiteral(firstChildren) && !isChildren) return;
2565
+ if (allowExpressions && node.children.length === 1 && JSX7__namespace.isLiteral(firstChildren) && !isChildren) return;
2626
2566
  if (!allowExpressions && isChildren) {
2627
2567
  return context.report({ messageId: "noUselessFragment", node });
2628
2568
  } else if (!allowExpressions && !isChildren && node.children.length === 1) {
2629
2569
  return context.report({ messageId: "noUselessFragment", node });
2630
2570
  }
2631
- const nonPaddingChildren = node.children.filter((child) => !JSX8__namespace.isPaddingSpaces(child));
2571
+ const nonPaddingChildren = node.children.filter((child) => !JSX7__namespace.isPaddingSpaces(child));
2632
2572
  if (nonPaddingChildren.length > 1) return;
2633
2573
  if (nonPaddingChildren.length === 0) return context.report({ messageId: "noUselessFragment", node });
2634
2574
  const [first] = nonPaddingChildren;
@@ -2870,7 +2810,7 @@ var prefer_shorthand_boolean_default = createRule({
2870
2810
  create(context) {
2871
2811
  function getReportDescriptor(node) {
2872
2812
  const { value } = node;
2873
- const propName = JSX8__namespace.getPropName(node);
2813
+ const propName = JSX7__namespace.getPropName(node);
2874
2814
  const hasValueTrue = value?.type === types.AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === types.AST_NODE_TYPES.Literal && value.expression.value === true;
2875
2815
  if (!hasValueTrue) return eff.O.none();
2876
2816
  return eff.O.some({
@@ -2927,10 +2867,8 @@ var use_jsx_vars_default = createRule({
2927
2867
  meta: {
2928
2868
  type: "problem",
2929
2869
  docs: {
2930
- description: (
2931
- // eslint-disable-next-line eslint-plugin/require-meta-docs-description
2932
- "helpes `eslint/no-unused-vars` to correctly mark JSX variables as used."
2933
- ),
2870
+ // eslint-disable-next-line eslint-plugin/require-meta-docs-description
2871
+ description: "helpes `eslint/no-unused-vars` to correctly mark JSX variables as used.",
2934
2872
  [Symbol.for("rule_features")]: RULE_FEATURES49
2935
2873
  },
2936
2874
  messages: {
@@ -2953,9 +2891,9 @@ var use_jsx_vars_default = createRule({
2953
2891
  return {
2954
2892
  JSXOpeningElement(node) {
2955
2893
  if (node.name.type === types.AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.name.name)) return;
2956
- eff.O.map(getName5(node.name), (name2) => {
2894
+ for (const name2 of eff.O.toArray(getName5(node.name))) {
2957
2895
  context.sourceCode.markVariableAsUsed(name2, node);
2958
- });
2896
+ }
2959
2897
  }
2960
2898
  };
2961
2899
  },
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { F, O, isString, MutRef, isNullable } from '@eslint-react/eff';
2
- import * as JSX8 from '@eslint-react/jsx';
1
+ import { F, O, isString, or, isNullable } from '@eslint-react/eff';
2
+ import * as JSX7 from '@eslint-react/jsx';
3
3
  import { createRuleForPlugin, normalizeSettings, decodeSettings, unsafeReadSettings } from '@eslint-react/shared';
4
4
  import * as AST11 from '@eslint-react/ast';
5
- import { isForwardRefCall, isThisSetState, isClassComponent, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, useComponentCollectorLegacy, isCloneElementCall, isCreateRefCall, isComponentName, isChildrenToArrayCall, useComponentCollector, ERFunctionComponentFlag, ERComponentHint, isDirectValueOfRenderPropertyLoose, isDeclaredInRenderPropLoose, isInsideCreateElementProps, isInsideRenderMethod, ERClassComponentFlag, isFragmentElement, isCreateElementCall, isInitializedFromReact } from '@eslint-react/core';
5
+ import { isForwardRefCall, isThisSetState, isClassComponent, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, useComponentCollectorLegacy, isCloneElementCall, isCreateRefCall, isComponentName, useComponentCollector, ERFunctionComponentFlag, isChildrenToArrayCall, ERComponentHint, isDirectValueOfRenderPropertyLoose, isDeclaredInRenderPropLoose, isInsideCreateElementProps, isInsideRenderMethod, ERClassComponentFlag, isFragmentElement, isCreateElementCall, isInitializedFromReact } from '@eslint-react/core';
6
6
  import { AST_NODE_TYPES } from '@typescript-eslint/types';
7
7
  import { isMatching, P, match } from 'ts-pattern';
8
8
  import { compare } from 'compare-versions';
@@ -15,7 +15,7 @@ import { getTypeImmutability, isUnknown, isImmutable, isReadonlyShallow, isReado
15
15
 
16
16
  // package.json
17
17
  var name = "eslint-plugin-react-x";
18
- var version = "1.22.2-next.1";
18
+ var version = "1.22.2-next.10";
19
19
  var createRule = createRuleForPlugin("x");
20
20
 
21
21
  // src/rules/avoid-shorthand-boolean.ts
@@ -43,7 +43,7 @@ var avoid_shorthand_boolean_default = createRule({
43
43
  messageId: "avoidShorthandBoolean",
44
44
  node,
45
45
  data: {
46
- propName: JSX8.getPropName(node)
46
+ propName: JSX7.getPropName(node)
47
47
  },
48
48
  fix: (fixer) => fixer.insertTextAfter(node.name, `={true}`)
49
49
  });
@@ -124,7 +124,7 @@ var RULE_FEATURES4 = [
124
124
  "CHK"
125
125
  ];
126
126
  function getName(node) {
127
- if (node.type === AST_NODE_TYPES.TSAsExpression) {
127
+ if (AST11.isTypeExpression(node)) {
128
128
  return getName(node.expression);
129
129
  }
130
130
  if (node.type === AST_NODE_TYPES.Identifier || node.type === AST_NODE_TYPES.PrivateIdentifier) {
@@ -510,7 +510,7 @@ var no_children_prop_default = createRule({
510
510
  return {
511
511
  JSXElement(node) {
512
512
  const initialScope = context.sourceCode.getScope(node);
513
- const prop = JSX8.getProp(node.openingElement.attributes, "children", initialScope);
513
+ const prop = JSX7.getProp(node.openingElement.attributes, "children", initialScope);
514
514
  const reportDescriptor = O.map(prop, (prop2) => ({ messageId: "noChildrenProp", node: prop2 }));
515
515
  O.map(reportDescriptor, context.report);
516
516
  }
@@ -885,7 +885,7 @@ var no_context_provider_default = createRule({
885
885
  if (compare(version2, "19.0.0", "<")) return {};
886
886
  return {
887
887
  JSXElement(node) {
888
- const elementName = JSX8.getElementName(node.openingElement);
888
+ const elementName = JSX7.getElementName(node.openingElement);
889
889
  if (!elementName.endsWith(".Provider")) return;
890
890
  context.report({
891
891
  messageId: "noContextProvider",
@@ -982,7 +982,7 @@ var RULE_FEATURES22 = [
982
982
  "CHK"
983
983
  ];
984
984
  function getName2(node) {
985
- if (node.type === AST_NODE_TYPES.TSAsExpression) {
985
+ if (AST11.isTypeExpression(node)) {
986
986
  return getName2(node.expression);
987
987
  }
988
988
  if (node.type === AST_NODE_TYPES.Identifier || node.type === AST_NODE_TYPES.PrivateIdentifier) {
@@ -1096,116 +1096,61 @@ var no_duplicate_key_default = createRule({
1096
1096
  },
1097
1097
  name: RULE_NAME24,
1098
1098
  create(context) {
1099
- const isWithinChildrenToArrayRef = MutRef.make(false);
1100
- function isKeyEqual(a, b) {
1101
- return VAR.isNodeValueEqual(a, b, [context.sourceCode.getScope(a), context.sourceCode.getScope(b)]);
1099
+ if (!context.sourceCode.getText().includes("key=")) return {};
1100
+ const keyedEntries = /* @__PURE__ */ new Map();
1101
+ function isKeyValueEqual(a, b) {
1102
+ const aValue = a.value;
1103
+ const bValue = b.value;
1104
+ if (aValue === null || bValue === null) return false;
1105
+ return AST11.isNodeEqual(aValue, bValue);
1102
1106
  }
1103
- function checkIteratorElement(node) {
1104
- if (node.type !== AST_NODE_TYPES.JSXElement) return O.none();
1105
- const initialScope = context.sourceCode.getScope(node);
1106
- return F.pipe(
1107
- JSX8.findPropInAttributes(node.openingElement.attributes, initialScope)("key"),
1108
- O.flatMap((k) => "value" in k ? O.fromNullable(k.value) : O.none()),
1109
- O.flatMap((v) => {
1110
- return isKeyEqual(v, v) ? O.some({
1111
- messageId: "noDuplicateKey",
1112
- node: v,
1113
- data: {
1114
- value: context.sourceCode.getText(v)
1115
- }
1116
- }) : O.none();
1117
- })
1118
- );
1119
- }
1120
- function checkExpression(node) {
1121
- switch (node.type) {
1122
- case AST_NODE_TYPES.ConditionalExpression:
1123
- if (!("consequent" in node)) return O.none();
1124
- return F.pipe(
1125
- checkIteratorElement(node.consequent),
1126
- O.orElse(() => checkIteratorElement(node.alternate))
1127
- );
1128
- case AST_NODE_TYPES.JSXElement:
1129
- case AST_NODE_TYPES.JSXFragment:
1130
- return checkIteratorElement(node);
1131
- case AST_NODE_TYPES.LogicalExpression:
1132
- if (!("left" in node)) return O.none();
1133
- return F.pipe(
1134
- checkIteratorElement(node.left),
1135
- O.orElse(() => checkIteratorElement(node.right))
1136
- );
1137
- default:
1138
- return O.none();
1139
- }
1140
- }
1141
- function checkBlockStatement(node) {
1142
- return AST11.getNestedReturnStatements(node).reduce((acc, statement) => {
1143
- if (!statement.argument) return acc;
1144
- const maybeDescriptor = checkIteratorElement(statement.argument);
1145
- if (O.isNone(maybeDescriptor)) return acc;
1146
- const descriptor = maybeDescriptor.value;
1147
- return [...acc, descriptor];
1148
- }, []);
1149
- }
1150
- const seen = /* @__PURE__ */ new WeakSet();
1151
1107
  return {
1152
- "ArrayExpression, JSXElement > JSXElement"(node) {
1153
- if (MutRef.get(isWithinChildrenToArrayRef)) return;
1154
- const elements = match(node).with({ type: AST_NODE_TYPES.ArrayExpression }, ({ elements: elements2 }) => elements2).with({ type: AST_NODE_TYPES.JSXElement }, ({ parent }) => "children" in parent ? parent.children : []).otherwise(() => []).filter(AST11.is(AST_NODE_TYPES.JSXElement)).filter((element) => !seen.has(element));
1155
- const keys = elements.reduce(
1156
- (acc, element) => {
1157
- const attr = element.openingElement.attributes.findLast((attr2) => {
1158
- if (attr2.type !== AST_NODE_TYPES.JSXAttribute) return false;
1159
- return attr2.name.name === "key";
1108
+ "JSXAttribute[name.name='key']"(node) {
1109
+ const jsxElement = node.parent.parent;
1110
+ switch (jsxElement.parent.type) {
1111
+ case AST_NODE_TYPES.ArrayExpression:
1112
+ case AST_NODE_TYPES.JSXElement:
1113
+ case AST_NODE_TYPES.JSXFragment: {
1114
+ const root = jsxElement.parent;
1115
+ const prevKeys = keyedEntries.get(root)?.keys ?? [];
1116
+ keyedEntries.set(root, {
1117
+ hasDuplicate: prevKeys.some((prevKey) => isKeyValueEqual(prevKey, node)),
1118
+ keys: [...prevKeys, node],
1119
+ root: jsxElement.parent
1160
1120
  });
1161
- if (!attr || !("value" in attr) || attr.value === null) return acc;
1162
- const { value } = attr;
1163
- if (acc.length === 0) return [[element, attr, value]];
1164
- if (acc.some(([_, _1, v]) => isKeyEqual(v, value))) {
1165
- return [...acc, [element, attr, value]];
1166
- }
1167
- return acc;
1168
- },
1169
- []
1170
- );
1171
- if (keys.length < 2) return;
1172
- for (const [element, attr, value] of keys) {
1173
- seen.add(element);
1174
- context.report({
1175
- messageId: "noDuplicateKey",
1176
- node: attr,
1177
- data: {
1178
- value: context.sourceCode.getText(value)
1121
+ break;
1122
+ }
1123
+ default: {
1124
+ const entry = F.pipe(
1125
+ O.Do,
1126
+ O.bind("call", () => AST11.traverseUpGuard(jsxElement, AST11.isMapCallLoose)),
1127
+ O.bind("iter", ({ call }) => AST11.traverseUpStop(jsxElement, call, AST11.isFunction)),
1128
+ O.bind("arg0", ({ call }) => O.fromNullable(call.arguments[0]))
1129
+ );
1130
+ for (const { arg0, call, iter } of O.toArray(entry)) {
1131
+ if (AST11.unwrapTypeExpression(arg0) !== iter) continue;
1132
+ keyedEntries.set(call, {
1133
+ hasDuplicate: node.value?.type === AST_NODE_TYPES.Literal,
1134
+ keys: [node],
1135
+ root: call
1136
+ });
1179
1137
  }
1180
- });
1138
+ }
1181
1139
  }
1182
1140
  },
1183
- CallExpression(node) {
1184
- if (isChildrenToArrayCall(node, context)) MutRef.set(isWithinChildrenToArrayRef, true);
1185
- const isMapCall = AST11.isMapCallLoose(node);
1186
- const isArrayFromCall = isMatching({
1187
- type: AST_NODE_TYPES.CallExpression,
1188
- callee: {
1189
- type: AST_NODE_TYPES.MemberExpression,
1190
- property: {
1191
- name: "from"
1192
- }
1193
- }
1194
- }, node);
1195
- if (!isMapCall && !isArrayFromCall) return;
1196
- if (MutRef.get(isWithinChildrenToArrayRef)) return;
1197
- const fn = node.arguments[isMapCall ? 0 : 1];
1198
- if (!AST11.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(fn)) return;
1199
- if (fn.body.type === AST_NODE_TYPES.BlockStatement) {
1200
- for (const descriptor of checkBlockStatement(fn.body)) {
1201
- context.report(descriptor);
1141
+ "Program:exit"() {
1142
+ for (const { hasDuplicate, keys } of keyedEntries.values()) {
1143
+ if (!hasDuplicate) continue;
1144
+ for (const key of keys) {
1145
+ context.report({
1146
+ messageId: "noDuplicateKey",
1147
+ node: key,
1148
+ data: {
1149
+ value: context.sourceCode.getText(key)
1150
+ }
1151
+ });
1202
1152
  }
1203
- return;
1204
1153
  }
1205
- O.map(checkExpression(fn.body), context.report);
1206
- },
1207
- "CallExpression:exit"(node) {
1208
- if (isChildrenToArrayCall(node, context)) MutRef.set(isWithinChildrenToArrayRef, false);
1209
1154
  }
1210
1155
  };
1211
1156
  },
@@ -1328,7 +1273,7 @@ var no_implicit_key_default = createRule({
1328
1273
  create(context) {
1329
1274
  function getReportDescriptor(node) {
1330
1275
  const initialScope = context.sourceCode.getScope(node);
1331
- const keyPropFound = JSX8.findPropInAttributes(node.attributes, initialScope)("key");
1276
+ const keyPropFound = JSX7.findPropInAttributes(node.attributes, initialScope)("key");
1332
1277
  const keyPropOnElement = node.attributes.some(
1333
1278
  (n) => AST11.is(AST_NODE_TYPES.JSXAttribute)(n) && n.name.name === "key"
1334
1279
  );
@@ -1568,12 +1513,12 @@ var no_missing_key_default = createRule({
1568
1513
  },
1569
1514
  name: RULE_NAME29,
1570
1515
  create(context) {
1571
- const isWithinChildrenToArrayRef = MutRef.make(false);
1516
+ const state = { isWithinChildrenToArray: false };
1572
1517
  function checkIteratorElement(node) {
1573
1518
  switch (node.type) {
1574
1519
  case AST_NODE_TYPES.JSXElement: {
1575
1520
  const initialScope = context.sourceCode.getScope(node);
1576
- if (!JSX8.hasProp(node.openingElement.attributes, "key", initialScope)) {
1521
+ if (!JSX7.hasProp(node.openingElement.attributes, "key", initialScope)) {
1577
1522
  return O.some({
1578
1523
  messageId: "noMissingKey",
1579
1524
  node
@@ -1617,12 +1562,12 @@ var no_missing_key_default = createRule({
1617
1562
  }
1618
1563
  return {
1619
1564
  ArrayExpression(node) {
1620
- if (MutRef.get(isWithinChildrenToArrayRef)) return;
1565
+ if (state.isWithinChildrenToArray) return;
1621
1566
  const elements = node.elements.filter(AST11.is(AST_NODE_TYPES.JSXElement));
1622
1567
  if (elements.length === 0) return;
1623
1568
  const initialScope = context.sourceCode.getScope(node);
1624
1569
  for (const element of elements) {
1625
- if (!JSX8.hasProp(element.openingElement.attributes, "key", initialScope)) {
1570
+ if (!JSX7.hasProp(element.openingElement.attributes, "key", initialScope)) {
1626
1571
  context.report({
1627
1572
  messageId: "noMissingKey",
1628
1573
  node: element
@@ -1631,7 +1576,8 @@ var no_missing_key_default = createRule({
1631
1576
  }
1632
1577
  },
1633
1578
  CallExpression(node) {
1634
- if (isChildrenToArrayCall(node, context)) MutRef.set(isWithinChildrenToArrayRef, true);
1579
+ state.isWithinChildrenToArray ||= isChildrenToArrayCall(node, context);
1580
+ if (state.isWithinChildrenToArray) return;
1635
1581
  const isMapCall = AST11.isMapCallLoose(node);
1636
1582
  const isArrayFromCall = isMatching({
1637
1583
  type: AST_NODE_TYPES.CallExpression,
@@ -1643,7 +1589,6 @@ var no_missing_key_default = createRule({
1643
1589
  }
1644
1590
  }, node);
1645
1591
  if (!isMapCall && !isArrayFromCall) return;
1646
- if (MutRef.get(isWithinChildrenToArrayRef)) return;
1647
1592
  const fn = node.arguments[isMapCall ? 0 : 1];
1648
1593
  if (!AST11.isOneOf([AST_NODE_TYPES.ArrowFunctionExpression, AST_NODE_TYPES.FunctionExpression])(fn)) return;
1649
1594
  if (fn.body.type === AST_NODE_TYPES.BlockStatement) {
@@ -1655,10 +1600,11 @@ var no_missing_key_default = createRule({
1655
1600
  O.map(checkExpression(fn.body), context.report);
1656
1601
  },
1657
1602
  "CallExpression:exit"(node) {
1658
- if (isChildrenToArrayCall(node, context)) MutRef.set(isWithinChildrenToArrayRef, false);
1603
+ if (!isChildrenToArrayCall(node, context)) return;
1604
+ state.isWithinChildrenToArray = false;
1659
1605
  },
1660
1606
  JSXFragment(node) {
1661
- if (MutRef.get(isWithinChildrenToArrayRef)) return;
1607
+ if (state.isWithinChildrenToArray) return;
1662
1608
  if (node.parent.type === AST_NODE_TYPES.ArrayExpression) {
1663
1609
  context.report({
1664
1610
  messageId: "noMissingKeyWithFragment",
@@ -1709,7 +1655,7 @@ var no_nested_components_default = createRule({
1709
1655
  if (O.isNone(componentName)) continue;
1710
1656
  const name2 = componentName.value;
1711
1657
  const isInsideProperty = component.parent.type === AST_NODE_TYPES.Property;
1712
- const isInsideJSXPropValue = component.parent.type === AST_NODE_TYPES.JSXAttribute || O.isSome(JSX8.traverseUpProp(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer));
1658
+ const isInsideJSXPropValue = component.parent.type === AST_NODE_TYPES.JSXAttribute || O.isSome(JSX7.traverseUpProp(node, (n) => n.value?.type === AST_NODE_TYPES.JSXExpressionContainer));
1713
1659
  if (isInsideJSXPropValue) {
1714
1660
  if (!isDeclaredInRenderPropLoose(component)) {
1715
1661
  context.report({
@@ -1755,7 +1701,7 @@ var no_nested_components_default = createRule({
1755
1701
  }
1756
1702
  }
1757
1703
  for (const { name: name2, node: component } of classComponents) {
1758
- if (O.isNone(AST11.traverseUp(component, (node2) => isClassComponent11(node2) || isFunctionComponent(node2)))) {
1704
+ if (O.isNone(AST11.traverseUp(component, or(isClassComponent11, isFunctionComponent)))) {
1759
1705
  continue;
1760
1706
  }
1761
1707
  context.report({
@@ -1885,22 +1831,25 @@ var no_set_state_in_component_did_mount_default = createRule({
1885
1831
  if (!context.sourceCode.text.includes("componentDidMount")) return {};
1886
1832
  function getReportDescriptor(node) {
1887
1833
  if (!isThisSetState(node)) return O.none();
1888
- const maybeParentClass = AST11.traverseUp(
1889
- node,
1890
- AST11.isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression])
1834
+ return F.pipe(
1835
+ O.Do,
1836
+ O.bind("clazz", () => AST11.traverseUpGuard(node, isClassComponent)),
1837
+ O.bind("method", ({ clazz }) => AST11.traverseUpStop(node, clazz, isComponentDidMount)),
1838
+ O.bind("methodScope", ({ method }) => O.some(context.sourceCode.getScope(method))),
1839
+ O.bind("upperScope", () => O.fromNullable(context.sourceCode.getScope(node).upper)),
1840
+ O.filter(
1841
+ ({
1842
+ clazz,
1843
+ method,
1844
+ methodScope,
1845
+ upperScope
1846
+ }) => method.parent === clazz.body && upperScope === methodScope
1847
+ ),
1848
+ O.map(() => ({
1849
+ messageId: "noSetStateInComponentDidMount",
1850
+ node
1851
+ }))
1891
1852
  );
1892
- if (O.isNone(maybeParentClass)) return O.none();
1893
- const parentClass = maybeParentClass.value;
1894
- if (!isClassComponent(parentClass)) return O.none();
1895
- const maybeParentMethod = AST11.traverseUp(node, isComponentDidMount);
1896
- if (O.isNone(maybeParentMethod)) return O.none();
1897
- const parentMethod = maybeParentMethod.value;
1898
- if (parentMethod.parent !== parentClass.body) return O.none();
1899
- if (context.sourceCode.getScope(node).upper !== context.sourceCode.getScope(parentMethod)) return O.none();
1900
- return O.some({
1901
- messageId: "noSetStateInComponentDidMount",
1902
- node
1903
- });
1904
1853
  }
1905
1854
  return {
1906
1855
  CallExpression: F.flow(getReportDescriptor, O.map(context.report))
@@ -1932,22 +1881,19 @@ var no_set_state_in_component_did_update_default = createRule({
1932
1881
  if (!context.sourceCode.text.includes("componentDidUpdate")) return {};
1933
1882
  function getReportDescriptor(node) {
1934
1883
  if (!isThisSetState(node)) return O.none();
1935
- const maybeParentClass = AST11.traverseUp(
1936
- node,
1937
- AST11.isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression])
1884
+ return F.pipe(
1885
+ O.Do,
1886
+ O.bind("clazz", () => AST11.traverseUpGuard(node, isClassComponent)),
1887
+ O.bind("method", ({ clazz }) => AST11.traverseUpStop(node, clazz, isComponentDidUpdate)),
1888
+ O.bind("upperScope", () => O.fromNullable(context.sourceCode.getScope(node).upper)),
1889
+ O.filter(
1890
+ ({ clazz, method, upperScope }) => method.parent === clazz.body && upperScope === context.sourceCode.getScope(method)
1891
+ ),
1892
+ O.map(() => ({
1893
+ messageId: "noSetStateInComponentDidUpdate",
1894
+ node
1895
+ }))
1938
1896
  );
1939
- if (O.isNone(maybeParentClass)) return O.none();
1940
- const parentClass = maybeParentClass.value;
1941
- if (!isClassComponent(parentClass)) return O.none();
1942
- const maybeParentMethod = AST11.traverseUp(node, isComponentDidUpdate);
1943
- if (O.isNone(maybeParentMethod)) return O.none();
1944
- const parentMethod = maybeParentMethod.value;
1945
- if (parentMethod.parent !== parentClass.body) return O.none();
1946
- if (context.sourceCode.getScope(node).upper !== context.sourceCode.getScope(parentMethod)) return O.none();
1947
- return O.some({
1948
- messageId: "noSetStateInComponentDidUpdate",
1949
- node
1950
- });
1951
1897
  }
1952
1898
  return {
1953
1899
  CallExpression: F.flow(getReportDescriptor, O.map(context.report))
@@ -1979,22 +1925,19 @@ var no_set_state_in_component_will_update_default = createRule({
1979
1925
  if (!context.sourceCode.text.includes("componentWillUpdate")) return {};
1980
1926
  function getReportDescriptor(node) {
1981
1927
  if (!isThisSetState(node)) return O.none();
1982
- const maybeParentClass = AST11.traverseUp(
1983
- node,
1984
- AST11.isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression])
1928
+ return F.pipe(
1929
+ O.Do,
1930
+ O.bind("clazz", () => AST11.traverseUpGuard(node, isClassComponent)),
1931
+ O.bind("method", ({ clazz }) => AST11.traverseUpStop(node, clazz, isComponentWillUpdate3)),
1932
+ O.bind("upperScope", () => O.fromNullable(context.sourceCode.getScope(node).upper)),
1933
+ O.filter(
1934
+ ({ clazz, method, upperScope }) => method.parent === clazz.body && upperScope === context.sourceCode.getScope(method)
1935
+ ),
1936
+ O.map(() => ({
1937
+ messageId: "noSetStateInComponentWillUpdate",
1938
+ node
1939
+ }))
1985
1940
  );
1986
- if (O.isNone(maybeParentClass)) return O.none();
1987
- const parentClass = maybeParentClass.value;
1988
- if (!isClassComponent(parentClass)) return O.none();
1989
- const maybeParentMethod = AST11.traverseUp(node, isComponentWillUpdate3);
1990
- if (O.isNone(maybeParentMethod)) return O.none();
1991
- const parentMethod = maybeParentMethod.value;
1992
- if (parentMethod.parent !== parentClass.body) return O.none();
1993
- if (context.sourceCode.getScope(node).upper !== context.sourceCode.getScope(parentMethod)) return O.none();
1994
- return O.some({
1995
- messageId: "noSetStateInComponentWillUpdate",
1996
- node
1997
- });
1998
1941
  }
1999
1942
  return {
2000
1943
  CallExpression: F.flow(getReportDescriptor, O.map(context.report))
@@ -2192,39 +2135,40 @@ var no_unstable_context_value_default = createRule({
2192
2135
  name: RULE_NAME40,
2193
2136
  create(context) {
2194
2137
  const { ctx, listeners } = useComponentCollector(context);
2195
- const possibleValueConstructions = /* @__PURE__ */ new Map();
2138
+ const constructions = /* @__PURE__ */ new Map();
2196
2139
  return {
2197
2140
  ...listeners,
2198
2141
  JSXOpeningElement(node) {
2199
2142
  const openingElementName = node.name;
2200
2143
  if (openingElementName.type !== AST_NODE_TYPES.JSXMemberExpression) return;
2201
2144
  if (openingElementName.property.name !== "Provider") return;
2202
- const maybeJSXValueAttribute = O.fromNullable(
2203
- node.attributes.find((attribute) => {
2204
- return attribute.type === AST_NODE_TYPES.JSXAttribute && attribute.name.name === "value";
2205
- })
2145
+ const constructionEntry = F.pipe(
2146
+ O.Do,
2147
+ O.bind("function", ctx.getCurrentFunction),
2148
+ O.bind("attribute", () => O.fromNullable(
2149
+ node.attributes.find((attribute) => {
2150
+ return attribute.type === AST_NODE_TYPES.JSXAttribute && attribute.name.name === "value";
2151
+ })
2152
+ )),
2153
+ O.bind("value", ({ attribute }) => "value" in attribute ? O.some(attribute.value) : O.none()),
2154
+ O.bind("valueExpression", ({ value }) => value?.type === AST_NODE_TYPES.JSXExpressionContainer ? O.some(value.expression) : O.none()),
2155
+ O.bind("construction", ({ valueExpression }) => {
2156
+ const initialScope = context.sourceCode.getScope(valueExpression);
2157
+ return O.some(VAR.inspectConstruction(valueExpression, initialScope));
2158
+ }),
2159
+ O.filter(({ construction }) => construction._tag !== "None")
2206
2160
  );
2207
- if (O.isNone(maybeJSXValueAttribute) || !("value" in maybeJSXValueAttribute.value)) return;
2208
- const valueNode = maybeJSXValueAttribute.value.value;
2209
- if (valueNode?.type !== AST_NODE_TYPES.JSXExpressionContainer) return;
2210
- const valueExpression = valueNode.expression;
2211
- const initialScope = context.sourceCode.getScope(valueExpression);
2212
- const construction = VAR.inspectConstruction(valueExpression, initialScope);
2213
- if (construction._tag === "None") return;
2214
- O.map(
2215
- ctx.getCurrentFunction(),
2216
- ([_, currentFn]) => possibleValueConstructions.set(currentFn, [
2217
- ...possibleValueConstructions.get(currentFn) ?? [],
2161
+ for (const { construction, function: [_, fNode] } of O.toArray(constructionEntry)) {
2162
+ constructions.set(fNode, [
2163
+ ...constructions.get(fNode) ?? [],
2218
2164
  construction
2219
- ])
2220
- );
2165
+ ]);
2166
+ }
2221
2167
  },
2222
2168
  "Program:exit"(node) {
2223
2169
  const components = ctx.getAllComponents(node).values();
2224
2170
  for (const { node: component } of components) {
2225
- const constructions = possibleValueConstructions.get(component);
2226
- if (!constructions) continue;
2227
- for (const construction of constructions) {
2171
+ for (const construction of constructions.get(component) ?? []) {
2228
2172
  if (construction._tag === "None") continue;
2229
2173
  const { node: constructionNode, _tag } = construction;
2230
2174
  const messageId = _tag.startsWith("Function") ? "noUnstableContextValueWithFunction" : "noUnstableContextValueWithIdentifier";
@@ -2261,7 +2205,7 @@ var no_unstable_default_props_default = createRule({
2261
2205
  name: RULE_NAME41,
2262
2206
  create(context) {
2263
2207
  const { ctx, listeners } = useComponentCollector(context);
2264
- const possibleDestructuringDeclarators = /* @__PURE__ */ new WeakMap();
2208
+ const declarators = /* @__PURE__ */ new WeakMap();
2265
2209
  return {
2266
2210
  ...listeners,
2267
2211
  "Program:exit"(node) {
@@ -2271,10 +2215,7 @@ var no_unstable_default_props_default = createRule({
2271
2215
  const [props] = params;
2272
2216
  if (!props) continue;
2273
2217
  const properties = match(props).with({ type: AST_NODE_TYPES.ObjectPattern }, ({ properties: properties2 }) => properties2).with({ type: AST_NODE_TYPES.Identifier }, ({ name: name2 }) => {
2274
- const variableDeclarators = possibleDestructuringDeclarators.get(component);
2275
- if (!variableDeclarators) return [];
2276
- const declarators = variableDeclarators.filter((d) => d.init.name === name2);
2277
- return declarators.flatMap((d) => d.id.properties);
2218
+ return declarators.get(component)?.filter((d) => d.init.name === name2).flatMap((d) => d.id.properties) ?? [];
2278
2219
  }).otherwise(() => []);
2279
2220
  for (const prop of properties) {
2280
2221
  if (prop.type !== AST_NODE_TYPES.Property || prop.value.type !== AST_NODE_TYPES.AssignmentPattern) continue;
@@ -2299,13 +2240,10 @@ var no_unstable_default_props_default = createRule({
2299
2240
  }
2300
2241
  },
2301
2242
  "VariableDeclarator[id.type='ObjectPattern'][init.type='Identifier']"(node) {
2302
- O.map(
2303
- ctx.getCurrentFunction(),
2304
- ([_, currentFn]) => possibleDestructuringDeclarators.set(currentFn, [
2305
- ...possibleDestructuringDeclarators.get(currentFn) ?? [],
2306
- node
2307
- ])
2308
- );
2243
+ for (const [_, currentFn] of O.toArray(ctx.getCurrentFunction())) {
2244
+ const prevDeclarators = declarators.get(currentFn) ?? [];
2245
+ declarators.set(currentFn, [...prevDeclarators, node]);
2246
+ }
2309
2247
  }
2310
2248
  };
2311
2249
  },
@@ -2333,7 +2271,7 @@ var LIFECYCLE_METHODS = /* @__PURE__ */ new Set([
2333
2271
  "UNSAFE_componentWillUpdate"
2334
2272
  ]);
2335
2273
  function getName3(node) {
2336
- if (node.type === AST_NODE_TYPES.TSAsExpression) {
2274
+ if (AST11.isTypeExpression(node)) {
2337
2275
  return getName3(node.expression);
2338
2276
  }
2339
2277
  if (node.type === AST_NODE_TYPES.Identifier || node.type === AST_NODE_TYPES.PrivateIdentifier) {
@@ -2433,7 +2371,9 @@ var no_unused_class_component_members_default = createRule({
2433
2371
  if (node.init && AST11.isThisExpression(node.init) && node.id.type === AST_NODE_TYPES.ObjectPattern) {
2434
2372
  for (const prop of node.id.properties) {
2435
2373
  if (prop.type === AST_NODE_TYPES.Property && AST11.isKeyLiteralLike(prop, prop.key)) {
2436
- O.map(getName3(prop.key), (name2) => propertyUsages.get(currentClass)?.add(name2));
2374
+ for (const name2 of O.toArray(getName3(prop.key))) {
2375
+ propertyUsages.get(currentClass)?.add(name2);
2376
+ }
2437
2377
  }
2438
2378
  }
2439
2379
  }
@@ -2447,7 +2387,7 @@ var RULE_FEATURES43 = [
2447
2387
  "CHK"
2448
2388
  ];
2449
2389
  function getName4(node) {
2450
- if (node.type === AST_NODE_TYPES.TSAsExpression) {
2390
+ if (AST11.isTypeExpression(node)) {
2451
2391
  return getName4(node.expression);
2452
2392
  }
2453
2393
  if (node.type === AST_NODE_TYPES.Identifier || node.type === AST_NODE_TYPES.PrivateIdentifier) {
@@ -2590,18 +2530,18 @@ var no_unused_state_default = createRule({
2590
2530
  var RULE_NAME44 = "no-useless-fragment";
2591
2531
  function check(node, context, allowExpressions) {
2592
2532
  const initialScope = context.sourceCode.getScope(node);
2593
- if (JSX8.isKeyedElement(node, initialScope)) return;
2594
- if (JSX8.isBuiltInElement(node.parent)) context.report({ messageId: "noUselessFragmentInBuiltIn", node });
2533
+ if (JSX7.isKeyedElement(node, initialScope)) return;
2534
+ if (JSX7.isBuiltInElement(node.parent)) context.report({ messageId: "noUselessFragmentInBuiltIn", node });
2595
2535
  if (node.children.length === 0) return context.report({ messageId: "noUselessFragment", node });
2596
2536
  const isChildren = AST11.isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment])(node.parent);
2597
2537
  const [firstChildren] = node.children;
2598
- if (allowExpressions && node.children.length === 1 && JSX8.isLiteral(firstChildren) && !isChildren) return;
2538
+ if (allowExpressions && node.children.length === 1 && JSX7.isLiteral(firstChildren) && !isChildren) return;
2599
2539
  if (!allowExpressions && isChildren) {
2600
2540
  return context.report({ messageId: "noUselessFragment", node });
2601
2541
  } else if (!allowExpressions && !isChildren && node.children.length === 1) {
2602
2542
  return context.report({ messageId: "noUselessFragment", node });
2603
2543
  }
2604
- const nonPaddingChildren = node.children.filter((child) => !JSX8.isPaddingSpaces(child));
2544
+ const nonPaddingChildren = node.children.filter((child) => !JSX7.isPaddingSpaces(child));
2605
2545
  if (nonPaddingChildren.length > 1) return;
2606
2546
  if (nonPaddingChildren.length === 0) return context.report({ messageId: "noUselessFragment", node });
2607
2547
  const [first] = nonPaddingChildren;
@@ -2843,7 +2783,7 @@ var prefer_shorthand_boolean_default = createRule({
2843
2783
  create(context) {
2844
2784
  function getReportDescriptor(node) {
2845
2785
  const { value } = node;
2846
- const propName = JSX8.getPropName(node);
2786
+ const propName = JSX7.getPropName(node);
2847
2787
  const hasValueTrue = value?.type === AST_NODE_TYPES.JSXExpressionContainer && value.expression.type === AST_NODE_TYPES.Literal && value.expression.value === true;
2848
2788
  if (!hasValueTrue) return O.none();
2849
2789
  return O.some({
@@ -2900,10 +2840,8 @@ var use_jsx_vars_default = createRule({
2900
2840
  meta: {
2901
2841
  type: "problem",
2902
2842
  docs: {
2903
- description: (
2904
- // eslint-disable-next-line eslint-plugin/require-meta-docs-description
2905
- "helpes `eslint/no-unused-vars` to correctly mark JSX variables as used."
2906
- ),
2843
+ // eslint-disable-next-line eslint-plugin/require-meta-docs-description
2844
+ description: "helpes `eslint/no-unused-vars` to correctly mark JSX variables as used.",
2907
2845
  [Symbol.for("rule_features")]: RULE_FEATURES49
2908
2846
  },
2909
2847
  messages: {
@@ -2926,9 +2864,9 @@ var use_jsx_vars_default = createRule({
2926
2864
  return {
2927
2865
  JSXOpeningElement(node) {
2928
2866
  if (node.name.type === AST_NODE_TYPES.JSXIdentifier && /^[a-z]/u.test(node.name.name)) return;
2929
- O.map(getName5(node.name), (name2) => {
2867
+ for (const name2 of O.toArray(getName5(node.name))) {
2930
2868
  context.sourceCode.markVariableAsUsed(name2, node);
2931
- });
2869
+ }
2932
2870
  }
2933
2871
  };
2934
2872
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "1.22.2-next.1",
3
+ "version": "1.22.2-next.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",
@@ -9,13 +9,13 @@
9
9
  "eslint-plugin",
10
10
  "eslint-plugin-react-x"
11
11
  ],
12
- "homepage": "https://github.com/rel1cx/eslint-react",
12
+ "homepage": "https://github.com/rEl1cx/eslint-react",
13
13
  "bugs": {
14
- "url": "https://github.com/rel1cx/eslint-react/issues"
14
+ "url": "https://github.com/rEl1cx/eslint-react/issues"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "git+https://github.com/Rel1cx/eslint-react.git",
18
+ "url": "git+https://github.com/rEl1cx/eslint-react.git",
19
19
  "directory": "packages/plugins/eslint-plugin-react-x"
20
20
  },
21
21
  "license": "MIT",
@@ -49,13 +49,13 @@
49
49
  "string-ts": "^2.2.0",
50
50
  "ts-api-utils": "^2.0.0",
51
51
  "ts-pattern": "^5.6.0",
52
- "@eslint-react/ast": "1.22.2-next.1",
53
- "@eslint-react/core": "1.22.2-next.1",
54
- "@eslint-react/jsx": "1.22.2-next.1",
55
- "@eslint-react/types": "1.22.2-next.1",
56
- "@eslint-react/eff": "1.22.2-next.1",
57
- "@eslint-react/shared": "1.22.2-next.1",
58
- "@eslint-react/var": "1.22.2-next.1"
52
+ "@eslint-react/ast": "1.22.2-next.10",
53
+ "@eslint-react/core": "1.22.2-next.10",
54
+ "@eslint-react/eff": "1.22.2-next.10",
55
+ "@eslint-react/jsx": "1.22.2-next.10",
56
+ "@eslint-react/shared": "1.22.2-next.10",
57
+ "@eslint-react/types": "1.22.2-next.10",
58
+ "@eslint-react/var": "1.22.2-next.10"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/react": "^19.0.2",