eslint-plugin-react-x 1.37.1-beta.4 → 1.37.1-next.1

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
@@ -91,7 +91,6 @@ var rules = {
91
91
  "react-x/no-unused-state": "warn",
92
92
  "react-x/no-use-context": "warn",
93
93
  "react-x/no-useless-forward-ref": "warn",
94
- "react-x/no-useless-fragment": "warn",
95
94
  "react-x/use-jsx-vars": "warn"
96
95
  };
97
96
  var settings = {
@@ -116,6 +115,7 @@ __export(recommended_typescript_exports, {
116
115
  var name2 = "react-x/recommended-typescript";
117
116
  var rules2 = {
118
117
  ...rules,
118
+ "react-x/dom/no-unknown-property": "off",
119
119
  "react-x/no-duplicate-jsx-props": "off",
120
120
  "react-x/use-jsx-vars": "off"
121
121
  };
@@ -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-beta.4";
139
+ var version = "1.37.1-next.1";
140
140
  var createRule = shared.createRuleForPlugin("x");
141
141
 
142
142
  // src/rules/avoid-shorthand-boolean.ts
@@ -414,7 +414,6 @@ var no_array_index_key_default = createRule({
414
414
  defaultOptions: []
415
415
  });
416
416
  function create4(context) {
417
- const report = shared.createReport(context);
418
417
  const indexParamNames = [];
419
418
  function isArrayIndex(node) {
420
419
  return node.type === types.AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
@@ -491,7 +490,7 @@ function create4(context) {
491
490
  if (!("value" in prop)) {
492
491
  continue;
493
492
  }
494
- getReportDescriptors(prop.value).forEach(report);
493
+ getReportDescriptors(prop.value).map(shared.report(context));
495
494
  }
496
495
  },
497
496
  "CallExpression:exit"() {
@@ -507,7 +506,7 @@ function create4(context) {
507
506
  if (node.value?.type !== types.AST_NODE_TYPES.JSXExpressionContainer) {
508
507
  return;
509
508
  }
510
- getReportDescriptors(node.value.expression).forEach(report);
509
+ getReportDescriptors(node.value.expression).map(shared.report(context));
511
510
  }
512
511
  };
513
512
  }
@@ -1595,7 +1594,7 @@ function create24(context) {
1595
1594
  return getReportDescriptor(initExpression);
1596
1595
  }).otherwise(() => eff._);
1597
1596
  }
1598
- const visitorFunction = eff.flow(getReportDescriptor, shared.createReport(context));
1597
+ const visitorFunction = eff.flow(getReportDescriptor, shared.report(context));
1599
1598
  return {
1600
1599
  "JSXExpressionContainer > ConditionalExpression": visitorFunction,
1601
1600
  "JSXExpressionContainer > LogicalExpression": visitorFunction
@@ -1730,7 +1729,6 @@ var no_missing_key_default = createRule({
1730
1729
  defaultOptions: []
1731
1730
  });
1732
1731
  function create27(context) {
1733
- const report = shared.createReport(context);
1734
1732
  const state = { isWithinChildrenToArray: false };
1735
1733
  function checkIteratorElement(node) {
1736
1734
  switch (node.type) {
@@ -1794,7 +1792,7 @@ function create27(context) {
1794
1792
  const initialScope = context.sourceCode.getScope(node);
1795
1793
  for (const element of elements) {
1796
1794
  if (!JSX8__namespace.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1797
- report({
1795
+ shared.report(context)({
1798
1796
  messageId: "missingKey",
1799
1797
  node: element
1800
1798
  });
@@ -1815,10 +1813,12 @@ function create27(context) {
1815
1813
  return;
1816
1814
  }
1817
1815
  if (fn.body.type === types.AST_NODE_TYPES.BlockStatement) {
1818
- checkBlockStatement(fn.body).forEach(report);
1816
+ for (const descriptor of checkBlockStatement(fn.body)) {
1817
+ shared.report(context)(descriptor);
1818
+ }
1819
1819
  return;
1820
1820
  }
1821
- report(checkExpression(fn.body));
1821
+ shared.report(context)(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
- report({
1834
+ shared.report(context)({
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 doCheck(context, node, allowExpressions) {
2955
+ function checkAndReport(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
- doCheck(context, node, allowExpressions);
3079
+ checkAndReport(context, node, allowExpressions);
3080
3080
  },
3081
3081
  JSXFragment(node) {
3082
- doCheck(context, node, allowExpressions);
3082
+ checkAndReport(context, node, allowExpressions);
3083
3083
  }
3084
3084
  };
3085
3085
  }
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createRuleForPlugin, createReport, getSettingsFromContext, unsafeDecodeSettings, DEFAULT_ESLINT_REACT_SETTINGS } from '@eslint-react/shared';
1
+ import { createRuleForPlugin, report, 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';
@@ -64,7 +64,6 @@ var rules = {
64
64
  "react-x/no-unused-state": "warn",
65
65
  "react-x/no-use-context": "warn",
66
66
  "react-x/no-useless-forward-ref": "warn",
67
- "react-x/no-useless-fragment": "warn",
68
67
  "react-x/use-jsx-vars": "warn"
69
68
  };
70
69
  var settings = {
@@ -89,6 +88,7 @@ __export(recommended_typescript_exports, {
89
88
  var name2 = "react-x/recommended-typescript";
90
89
  var rules2 = {
91
90
  ...rules,
91
+ "react-x/dom/no-unknown-property": "off",
92
92
  "react-x/no-duplicate-jsx-props": "off",
93
93
  "react-x/use-jsx-vars": "off"
94
94
  };
@@ -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-beta.4";
112
+ var version = "1.37.1-next.1";
113
113
  var createRule = createRuleForPlugin("x");
114
114
 
115
115
  // src/rules/avoid-shorthand-boolean.ts
@@ -387,7 +387,6 @@ var no_array_index_key_default = createRule({
387
387
  defaultOptions: []
388
388
  });
389
389
  function create4(context) {
390
- const report = createReport(context);
391
390
  const indexParamNames = [];
392
391
  function isArrayIndex(node) {
393
392
  return node.type === AST_NODE_TYPES.Identifier && indexParamNames.some((name5) => name5 != null && name5 === node.name);
@@ -464,7 +463,7 @@ function create4(context) {
464
463
  if (!("value" in prop)) {
465
464
  continue;
466
465
  }
467
- getReportDescriptors(prop.value).forEach(report);
466
+ getReportDescriptors(prop.value).map(report(context));
468
467
  }
469
468
  },
470
469
  "CallExpression:exit"() {
@@ -480,7 +479,7 @@ function create4(context) {
480
479
  if (node.value?.type !== AST_NODE_TYPES.JSXExpressionContainer) {
481
480
  return;
482
481
  }
483
- getReportDescriptors(node.value.expression).forEach(report);
482
+ getReportDescriptors(node.value.expression).map(report(context));
484
483
  }
485
484
  };
486
485
  }
@@ -1568,7 +1567,7 @@ function create24(context) {
1568
1567
  return getReportDescriptor(initExpression);
1569
1568
  }).otherwise(() => _);
1570
1569
  }
1571
- const visitorFunction = flow(getReportDescriptor, createReport(context));
1570
+ const visitorFunction = flow(getReportDescriptor, report(context));
1572
1571
  return {
1573
1572
  "JSXExpressionContainer > ConditionalExpression": visitorFunction,
1574
1573
  "JSXExpressionContainer > LogicalExpression": visitorFunction
@@ -1703,7 +1702,6 @@ var no_missing_key_default = createRule({
1703
1702
  defaultOptions: []
1704
1703
  });
1705
1704
  function create27(context) {
1706
- const report = createReport(context);
1707
1705
  const state = { isWithinChildrenToArray: false };
1708
1706
  function checkIteratorElement(node) {
1709
1707
  switch (node.type) {
@@ -1767,7 +1765,7 @@ function create27(context) {
1767
1765
  const initialScope = context.sourceCode.getScope(node);
1768
1766
  for (const element of elements) {
1769
1767
  if (!JSX8.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1770
- report({
1768
+ report(context)({
1771
1769
  messageId: "missingKey",
1772
1770
  node: element
1773
1771
  });
@@ -1788,10 +1786,12 @@ function create27(context) {
1788
1786
  return;
1789
1787
  }
1790
1788
  if (fn.body.type === AST_NODE_TYPES.BlockStatement) {
1791
- checkBlockStatement(fn.body).forEach(report);
1789
+ for (const descriptor of checkBlockStatement(fn.body)) {
1790
+ report(context)(descriptor);
1791
+ }
1792
1792
  return;
1793
1793
  }
1794
- report(checkExpression(fn.body));
1794
+ report(context)(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({
1807
+ report(context)({
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 doCheck(context, node, allowExpressions) {
2928
+ function checkAndReport(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
- doCheck(context, node, allowExpressions);
3052
+ checkAndReport(context, node, allowExpressions);
3053
3053
  },
3054
3054
  JSXFragment(node) {
3055
- doCheck(context, node, allowExpressions);
3055
+ checkAndReport(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-beta.4",
3
+ "version": "1.37.1-next.1",
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-beta.4",
53
- "@eslint-react/core": "1.37.1-beta.4",
54
- "@eslint-react/jsx": "1.37.1-beta.4",
55
- "@eslint-react/shared": "1.37.1-beta.4",
56
- "@eslint-react/var": "1.37.1-beta.4",
57
- "@eslint-react/eff": "1.37.1-beta.4"
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"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/react": "^19.0.12",