eslint-plugin-react-x 1.37.1-next.1 → 1.37.1-next.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 CHANGED
@@ -136,7 +136,7 @@ var settings3 = {
136
136
 
137
137
  // package.json
138
138
  var name4 = "eslint-plugin-react-x";
139
- var version = "1.37.1-next.1";
139
+ var version = "1.37.1-next.3";
140
140
  var createRule = shared.createRuleForPlugin("x");
141
141
 
142
142
  // src/rules/avoid-shorthand-boolean.ts
@@ -414,6 +414,7 @@ var no_array_index_key_default = createRule({
414
414
  defaultOptions: []
415
415
  });
416
416
  function create4(context) {
417
+ const report = shared.createReport(context);
417
418
  const indexParamNames = [];
418
419
  function isArrayIndex(node) {
419
420
  return node.type === types.AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
@@ -490,7 +491,7 @@ function create4(context) {
490
491
  if (!("value" in prop)) {
491
492
  continue;
492
493
  }
493
- getReportDescriptors(prop.value).map(shared.report(context));
494
+ getReportDescriptors(prop.value).forEach(report);
494
495
  }
495
496
  },
496
497
  "CallExpression:exit"() {
@@ -506,7 +507,7 @@ function create4(context) {
506
507
  if (node.value?.type !== types.AST_NODE_TYPES.JSXExpressionContainer) {
507
508
  return;
508
509
  }
509
- getReportDescriptors(node.value.expression).map(shared.report(context));
510
+ getReportDescriptors(node.value.expression).forEach(report);
510
511
  }
511
512
  };
512
513
  }
@@ -1594,7 +1595,7 @@ function create24(context) {
1594
1595
  return getReportDescriptor(initExpression);
1595
1596
  }).otherwise(() => eff._);
1596
1597
  }
1597
- const visitorFunction = eff.flow(getReportDescriptor, shared.report(context));
1598
+ const visitorFunction = eff.flow(getReportDescriptor, shared.createReport(context));
1598
1599
  return {
1599
1600
  "JSXExpressionContainer > ConditionalExpression": visitorFunction,
1600
1601
  "JSXExpressionContainer > LogicalExpression": visitorFunction
@@ -1729,6 +1730,7 @@ var no_missing_key_default = createRule({
1729
1730
  defaultOptions: []
1730
1731
  });
1731
1732
  function create27(context) {
1733
+ const report = shared.createReport(context);
1732
1734
  const state = { isWithinChildrenToArray: false };
1733
1735
  function checkIteratorElement(node) {
1734
1736
  switch (node.type) {
@@ -1792,7 +1794,7 @@ function create27(context) {
1792
1794
  const initialScope = context.sourceCode.getScope(node);
1793
1795
  for (const element of elements) {
1794
1796
  if (!JSX8__namespace.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1795
- shared.report(context)({
1797
+ report({
1796
1798
  messageId: "missingKey",
1797
1799
  node: element
1798
1800
  });
@@ -1813,12 +1815,10 @@ function create27(context) {
1813
1815
  return;
1814
1816
  }
1815
1817
  if (fn.body.type === types.AST_NODE_TYPES.BlockStatement) {
1816
- for (const descriptor of checkBlockStatement(fn.body)) {
1817
- shared.report(context)(descriptor);
1818
- }
1818
+ checkBlockStatement(fn.body).forEach(report);
1819
1819
  return;
1820
1820
  }
1821
- shared.report(context)(checkExpression(fn.body));
1821
+ report(checkExpression(fn.body));
1822
1822
  },
1823
1823
  "CallExpression:exit"(node) {
1824
1824
  if (!core.isChildrenToArrayCall(context, node)) {
@@ -1831,7 +1831,7 @@ function create27(context) {
1831
1831
  return;
1832
1832
  }
1833
1833
  if (node.parent.type === types.AST_NODE_TYPES.ArrayExpression) {
1834
- shared.report(context)({
1834
+ report({
1835
1835
  messageId: "unexpectedFragmentSyntax",
1836
1836
  node
1837
1837
  });
@@ -2952,7 +2952,7 @@ function trimLikeReact(text) {
2952
2952
  const end = trailingSpaces.includes("\n") ? text.length - trailingSpaces.length : text.length;
2953
2953
  return text.slice(start, end);
2954
2954
  }
2955
- function checkAndReport(context, node, allowExpressions) {
2955
+ function doCheck(context, node, allowExpressions) {
2956
2956
  function fix(fixer) {
2957
2957
  if (node.parent.type !== types.AST_NODE_TYPES.JSXElement && node.parent.type !== types.AST_NODE_TYPES.JSXFragment) {
2958
2958
  if (node.children.length === 0) {
@@ -3076,10 +3076,10 @@ function create44(context, [option]) {
3076
3076
  return {
3077
3077
  JSXElement(node) {
3078
3078
  if (!JSX8__namespace.isFragmentElement(node)) return;
3079
- checkAndReport(context, node, allowExpressions);
3079
+ doCheck(context, node, allowExpressions);
3080
3080
  },
3081
3081
  JSXFragment(node) {
3082
- checkAndReport(context, node, allowExpressions);
3082
+ doCheck(context, node, allowExpressions);
3083
3083
  }
3084
3084
  };
3085
3085
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createRuleForPlugin, report, getSettingsFromContext, unsafeDecodeSettings, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
1
+ import { createRuleForPlugin, createReport, getSettingsFromContext, unsafeDecodeSettings, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
2
2
  import * as JSX8 from '@eslint-react/jsx';
3
3
  import * as AST11 from '@eslint-react/ast';
4
4
  import { isClassComponent, isThisSetState, isChildrenCount, isChildrenForEach, isChildrenMap, isChildrenOnly, isChildrenToArray, useComponentCollectorLegacy, isComponentDidCatch, isGetDerivedStateFromError, isCloneElementCall, isComponentNameLoose, isCreateRefCall, isAssignmentToThisState, isForwardRefCall, useComponentCollector, DEFAULT_COMPONENT_HINT, ERComponentFlag, getInstanceId, isInstanceIdEqual, DISPLAY_NAME_ASSIGNMENT_SELECTOR, isCreateContextCall, isChildrenToArrayCall, ERComponentHint, isDirectValueOfRenderPropertyLoose, isDeclaredInRenderPropLoose, isInsideRenderMethod, isCreateElementCall, isReactHookCall, isReactHookCallWithNameAlias, isGetDerivedStateFromProps, isInitializedFromReact } from '@eslint-react/core';
@@ -109,7 +109,7 @@ var settings3 = {
109
109
 
110
110
  // package.json
111
111
  var name4 = "eslint-plugin-react-x";
112
- var version = "1.37.1-next.1";
112
+ var version = "1.37.1-next.3";
113
113
  var createRule = createRuleForPlugin("x");
114
114
 
115
115
  // src/rules/avoid-shorthand-boolean.ts
@@ -387,6 +387,7 @@ var no_array_index_key_default = createRule({
387
387
  defaultOptions: []
388
388
  });
389
389
  function create4(context) {
390
+ const report = createReport(context);
390
391
  const indexParamNames = [];
391
392
  function isArrayIndex(node) {
392
393
  return node.type === AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
@@ -463,7 +464,7 @@ function create4(context) {
463
464
  if (!("value" in prop)) {
464
465
  continue;
465
466
  }
466
- getReportDescriptors(prop.value).map(report(context));
467
+ getReportDescriptors(prop.value).forEach(report);
467
468
  }
468
469
  },
469
470
  "CallExpression:exit"() {
@@ -479,7 +480,7 @@ function create4(context) {
479
480
  if (node.value?.type !== AST_NODE_TYPES.JSXExpressionContainer) {
480
481
  return;
481
482
  }
482
- getReportDescriptors(node.value.expression).map(report(context));
483
+ getReportDescriptors(node.value.expression).forEach(report);
483
484
  }
484
485
  };
485
486
  }
@@ -1567,7 +1568,7 @@ function create24(context) {
1567
1568
  return getReportDescriptor(initExpression);
1568
1569
  }).otherwise(() => _);
1569
1570
  }
1570
- const visitorFunction = flow(getReportDescriptor, report(context));
1571
+ const visitorFunction = flow(getReportDescriptor, createReport(context));
1571
1572
  return {
1572
1573
  "JSXExpressionContainer > ConditionalExpression": visitorFunction,
1573
1574
  "JSXExpressionContainer > LogicalExpression": visitorFunction
@@ -1702,6 +1703,7 @@ var no_missing_key_default = createRule({
1702
1703
  defaultOptions: []
1703
1704
  });
1704
1705
  function create27(context) {
1706
+ const report = createReport(context);
1705
1707
  const state = { isWithinChildrenToArray: false };
1706
1708
  function checkIteratorElement(node) {
1707
1709
  switch (node.type) {
@@ -1765,7 +1767,7 @@ function create27(context) {
1765
1767
  const initialScope = context.sourceCode.getScope(node);
1766
1768
  for (const element of elements) {
1767
1769
  if (!JSX8.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1768
- report(context)({
1770
+ report({
1769
1771
  messageId: "missingKey",
1770
1772
  node: element
1771
1773
  });
@@ -1786,12 +1788,10 @@ function create27(context) {
1786
1788
  return;
1787
1789
  }
1788
1790
  if (fn.body.type === AST_NODE_TYPES.BlockStatement) {
1789
- for (const descriptor of checkBlockStatement(fn.body)) {
1790
- report(context)(descriptor);
1791
- }
1791
+ checkBlockStatement(fn.body).forEach(report);
1792
1792
  return;
1793
1793
  }
1794
- report(context)(checkExpression(fn.body));
1794
+ report(checkExpression(fn.body));
1795
1795
  },
1796
1796
  "CallExpression:exit"(node) {
1797
1797
  if (!isChildrenToArrayCall(context, node)) {
@@ -1804,7 +1804,7 @@ function create27(context) {
1804
1804
  return;
1805
1805
  }
1806
1806
  if (node.parent.type === AST_NODE_TYPES.ArrayExpression) {
1807
- report(context)({
1807
+ report({
1808
1808
  messageId: "unexpectedFragmentSyntax",
1809
1809
  node
1810
1810
  });
@@ -2925,7 +2925,7 @@ function trimLikeReact(text) {
2925
2925
  const end = trailingSpaces.includes("\n") ? text.length - trailingSpaces.length : text.length;
2926
2926
  return text.slice(start, end);
2927
2927
  }
2928
- function checkAndReport(context, node, allowExpressions) {
2928
+ function doCheck(context, node, allowExpressions) {
2929
2929
  function fix(fixer) {
2930
2930
  if (node.parent.type !== AST_NODE_TYPES.JSXElement && node.parent.type !== AST_NODE_TYPES.JSXFragment) {
2931
2931
  if (node.children.length === 0) {
@@ -3049,10 +3049,10 @@ function create44(context, [option]) {
3049
3049
  return {
3050
3050
  JSXElement(node) {
3051
3051
  if (!JSX8.isFragmentElement(node)) return;
3052
- checkAndReport(context, node, allowExpressions);
3052
+ doCheck(context, node, allowExpressions);
3053
3053
  },
3054
3054
  JSXFragment(node) {
3055
- checkAndReport(context, node, allowExpressions);
3055
+ doCheck(context, node, allowExpressions);
3056
3056
  }
3057
3057
  };
3058
3058
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "1.37.1-next.1",
3
+ "version": "1.37.1-next.3",
4
4
  "description": "A set of composable linting rules for libraries and frameworks that use React as a UI runtime.",
5
5
  "keywords": [
6
6
  "react",
@@ -49,12 +49,12 @@
49
49
  "compare-versions": "^6.1.1",
50
50
  "string-ts": "^2.2.1",
51
51
  "ts-pattern": "^5.6.2",
52
- "@eslint-react/ast": "1.37.1-next.1",
53
- "@eslint-react/core": "1.37.1-next.1",
54
- "@eslint-react/eff": "1.37.1-next.1",
55
- "@eslint-react/jsx": "1.37.1-next.1",
56
- "@eslint-react/var": "1.37.1-next.1",
57
- "@eslint-react/shared": "1.37.1-next.1"
52
+ "@eslint-react/ast": "1.37.1-next.3",
53
+ "@eslint-react/core": "1.37.1-next.3",
54
+ "@eslint-react/eff": "1.37.1-next.3",
55
+ "@eslint-react/jsx": "1.37.1-next.3",
56
+ "@eslint-react/shared": "1.37.1-next.3",
57
+ "@eslint-react/var": "1.37.1-next.3"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/react": "^19.0.12",