eslint-plugin-react-x 1.40.4-next.4 → 1.40.4-next.6

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/README.md CHANGED
@@ -30,6 +30,7 @@ export default tseslint.config({
30
30
  parser: tseslint.parser,
31
31
  parserOptions: {
32
32
  projectService: true,
33
+ tsconfigRootDir: import.meta.dirname,
33
34
  },
34
35
  },
35
36
  rules: {
package/dist/index.js CHANGED
@@ -141,7 +141,7 @@ var settings3 = {
141
141
 
142
142
  // package.json
143
143
  var name4 = "eslint-plugin-react-x";
144
- var version = "1.40.4-next.4";
144
+ var version = "1.40.4-next.6";
145
145
  var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("x"));
146
146
 
147
147
  // src/rules/avoid-shorthand-boolean.ts
@@ -543,7 +543,8 @@ function getMapIndexParamName(context, node) {
543
543
  return eff._;
544
544
  }
545
545
  const { name: name5 } = callee.property;
546
- if (!AST8__namespace.ITERATOR_FUNCTION_INDEX_PARAM_POSITION.has(name5)) {
546
+ const indexPosition = AST8__namespace.getArrayMethodIndexParamPosition(name5);
547
+ if (indexPosition === -1) {
547
548
  return eff._;
548
549
  }
549
550
  const callbackArg = node.arguments[isUsingReactChildren(context, node) ? 1 : 0];
@@ -554,14 +555,10 @@ function getMapIndexParamName(context, node) {
554
555
  return eff._;
555
556
  }
556
557
  const { params } = callbackArg;
557
- const indexParamPosition = AST8__namespace.ITERATOR_FUNCTION_INDEX_PARAM_POSITION.get(name5);
558
- if (indexParamPosition == null) {
558
+ if (params.length < indexPosition + 1) {
559
559
  return eff._;
560
560
  }
561
- if (params.length < indexParamPosition + 1) {
562
- return eff._;
563
- }
564
- const param = params.at(indexParamPosition);
561
+ const param = params.at(indexPosition);
565
562
  return param != null && "name" in param ? param.name : eff._;
566
563
  }
567
564
  function getIdentifiersFromBinaryExpression(side) {
@@ -1403,7 +1400,7 @@ function create26(context) {
1403
1400
  break;
1404
1401
  }
1405
1402
  default: {
1406
- const call = AST8__namespace.findParentNode(jsxElement, AST8__namespace.isArrayMapCallLoose);
1403
+ const call = AST8__namespace.findParentNode(jsxElement, AST8__namespace.isArrayMapCall);
1407
1404
  const iter = AST8__namespace.findParentNode(jsxElement, (n) => n === call || AST8__namespace.isFunction(n));
1408
1405
  if (!AST8__namespace.isFunction(iter)) return;
1409
1406
  const arg0 = call?.arguments[0];
@@ -1940,7 +1937,7 @@ function create32(context) {
1940
1937
  if (state.isWithinChildrenToArray) {
1941
1938
  return;
1942
1939
  }
1943
- const isMapCall = AST8__namespace.isArrayMapCallLoose(node);
1940
+ const isMapCall = AST8__namespace.isArrayMapCall(node);
1944
1941
  if (!isMapCall && !isArrayFromCall(node)) {
1945
1942
  return;
1946
1943
  }
@@ -3104,7 +3101,7 @@ function create49(context, [option]) {
3104
3101
  const { allowExpressions = true } = option;
3105
3102
  return {
3106
3103
  JSXElement(node) {
3107
- if (!JSX8__namespace.isJsxFragmentElement(node)) return;
3104
+ if (!JSX8__namespace.isFragmentElement(node)) return;
3108
3105
  checkNode(context, node, allowExpressions);
3109
3106
  },
3110
3107
  JSXFragment(node) {
@@ -3127,15 +3124,15 @@ function trimLikeReact(text) {
3127
3124
  }
3128
3125
  function checkNode(context, node, allowExpressions) {
3129
3126
  const initialScope = context.sourceCode.getScope(node);
3130
- if (JSX8__namespace.isJsxKeyedElement(node, initialScope)) {
3127
+ if (JSX8__namespace.isKeyedElement(node, initialScope)) {
3131
3128
  return;
3132
3129
  }
3133
- if (JSX8__namespace.isJsxBuiltInElement(node.parent)) {
3130
+ if (JSX8__namespace.isHostElement(node.parent)) {
3134
3131
  context.report({
3135
3132
  messageId: "uselessFragment",
3136
3133
  node,
3137
3134
  data: {
3138
- reason: "placed inside a built-in component"
3135
+ reason: "placed inside a host component"
3139
3136
  },
3140
3137
  fix: getFix2(context, node)
3141
3138
  });
@@ -3210,7 +3207,7 @@ function getFix2(context, node) {
3210
3207
  }
3211
3208
  function canFix(node) {
3212
3209
  if (node.parent.type === types.AST_NODE_TYPES.JSXElement || node.parent.type === types.AST_NODE_TYPES.JSXFragment) {
3213
- return !JSX8__namespace.isJsxUserDefinedElement(node.parent);
3210
+ return JSX8__namespace.isHostElement(node.parent);
3214
3211
  }
3215
3212
  if (node.children.length === 0) {
3216
3213
  return false;
@@ -3473,7 +3470,7 @@ var prefer_shorthand_fragment_default = createRule({
3473
3470
  function create54(context) {
3474
3471
  return {
3475
3472
  JSXElement(node) {
3476
- if (!JSX8__namespace.isJsxFragmentElement(node)) return;
3473
+ if (!JSX8__namespace.isFragmentElement(node)) return;
3477
3474
  const hasAttributes = node.openingElement.attributes.length > 0;
3478
3475
  if (hasAttributes) {
3479
3476
  return;
package/dist/index.mjs CHANGED
@@ -113,7 +113,7 @@ var settings3 = {
113
113
 
114
114
  // package.json
115
115
  var name4 = "eslint-plugin-react-x";
116
- var version = "1.40.4-next.4";
116
+ var version = "1.40.4-next.6";
117
117
  var createRule = ESLintUtils.RuleCreator(getDocsUrl("x"));
118
118
 
119
119
  // src/rules/avoid-shorthand-boolean.ts
@@ -515,7 +515,8 @@ function getMapIndexParamName(context, node) {
515
515
  return _;
516
516
  }
517
517
  const { name: name5 } = callee.property;
518
- if (!AST8.ITERATOR_FUNCTION_INDEX_PARAM_POSITION.has(name5)) {
518
+ const indexPosition = AST8.getArrayMethodIndexParamPosition(name5);
519
+ if (indexPosition === -1) {
519
520
  return _;
520
521
  }
521
522
  const callbackArg = node.arguments[isUsingReactChildren(context, node) ? 1 : 0];
@@ -526,14 +527,10 @@ function getMapIndexParamName(context, node) {
526
527
  return _;
527
528
  }
528
529
  const { params } = callbackArg;
529
- const indexParamPosition = AST8.ITERATOR_FUNCTION_INDEX_PARAM_POSITION.get(name5);
530
- if (indexParamPosition == null) {
530
+ if (params.length < indexPosition + 1) {
531
531
  return _;
532
532
  }
533
- if (params.length < indexParamPosition + 1) {
534
- return _;
535
- }
536
- const param = params.at(indexParamPosition);
533
+ const param = params.at(indexPosition);
537
534
  return param != null && "name" in param ? param.name : _;
538
535
  }
539
536
  function getIdentifiersFromBinaryExpression(side) {
@@ -1375,7 +1372,7 @@ function create26(context) {
1375
1372
  break;
1376
1373
  }
1377
1374
  default: {
1378
- const call = AST8.findParentNode(jsxElement, AST8.isArrayMapCallLoose);
1375
+ const call = AST8.findParentNode(jsxElement, AST8.isArrayMapCall);
1379
1376
  const iter = AST8.findParentNode(jsxElement, (n) => n === call || AST8.isFunction(n));
1380
1377
  if (!AST8.isFunction(iter)) return;
1381
1378
  const arg0 = call?.arguments[0];
@@ -1912,7 +1909,7 @@ function create32(context) {
1912
1909
  if (state.isWithinChildrenToArray) {
1913
1910
  return;
1914
1911
  }
1915
- const isMapCall = AST8.isArrayMapCallLoose(node);
1912
+ const isMapCall = AST8.isArrayMapCall(node);
1916
1913
  if (!isMapCall && !isArrayFromCall(node)) {
1917
1914
  return;
1918
1915
  }
@@ -3076,7 +3073,7 @@ function create49(context, [option]) {
3076
3073
  const { allowExpressions = true } = option;
3077
3074
  return {
3078
3075
  JSXElement(node) {
3079
- if (!JSX8.isJsxFragmentElement(node)) return;
3076
+ if (!JSX8.isFragmentElement(node)) return;
3080
3077
  checkNode(context, node, allowExpressions);
3081
3078
  },
3082
3079
  JSXFragment(node) {
@@ -3099,15 +3096,15 @@ function trimLikeReact(text) {
3099
3096
  }
3100
3097
  function checkNode(context, node, allowExpressions) {
3101
3098
  const initialScope = context.sourceCode.getScope(node);
3102
- if (JSX8.isJsxKeyedElement(node, initialScope)) {
3099
+ if (JSX8.isKeyedElement(node, initialScope)) {
3103
3100
  return;
3104
3101
  }
3105
- if (JSX8.isJsxBuiltInElement(node.parent)) {
3102
+ if (JSX8.isHostElement(node.parent)) {
3106
3103
  context.report({
3107
3104
  messageId: "uselessFragment",
3108
3105
  node,
3109
3106
  data: {
3110
- reason: "placed inside a built-in component"
3107
+ reason: "placed inside a host component"
3111
3108
  },
3112
3109
  fix: getFix2(context, node)
3113
3110
  });
@@ -3182,7 +3179,7 @@ function getFix2(context, node) {
3182
3179
  }
3183
3180
  function canFix(node) {
3184
3181
  if (node.parent.type === AST_NODE_TYPES.JSXElement || node.parent.type === AST_NODE_TYPES.JSXFragment) {
3185
- return !JSX8.isJsxUserDefinedElement(node.parent);
3182
+ return JSX8.isHostElement(node.parent);
3186
3183
  }
3187
3184
  if (node.children.length === 0) {
3188
3185
  return false;
@@ -3445,7 +3442,7 @@ var prefer_shorthand_fragment_default = createRule({
3445
3442
  function create54(context) {
3446
3443
  return {
3447
3444
  JSXElement(node) {
3448
- if (!JSX8.isJsxFragmentElement(node)) return;
3445
+ if (!JSX8.isFragmentElement(node)) return;
3449
3446
  const hasAttributes = node.openingElement.attributes.length > 0;
3450
3447
  if (hasAttributes) {
3451
3448
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "1.40.4-next.4",
3
+ "version": "1.40.4-next.6",
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",
@@ -50,13 +50,13 @@
50
50
  "is-immutable-type": "^5.0.1",
51
51
  "string-ts": "^2.2.1",
52
52
  "ts-pattern": "^5.7.0",
53
- "@eslint-react/ast": "1.40.4-next.4",
54
- "@eslint-react/core": "1.40.4-next.4",
55
- "@eslint-react/eff": "1.40.4-next.4",
56
- "@eslint-react/jsx": "1.40.4-next.4",
57
- "@eslint-react/shared": "1.40.4-next.4",
58
- "@eslint-react/kit": "1.40.4-next.4",
59
- "@eslint-react/var": "1.40.4-next.4"
53
+ "@eslint-react/ast": "1.40.4-next.6",
54
+ "@eslint-react/kit": "1.40.4-next.6",
55
+ "@eslint-react/core": "1.40.4-next.6",
56
+ "@eslint-react/eff": "1.40.4-next.6",
57
+ "@eslint-react/var": "1.40.4-next.6",
58
+ "@eslint-react/jsx": "1.40.4-next.6",
59
+ "@eslint-react/shared": "1.40.4-next.6"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/react": "^19.1.0",