eslint-plugin-react-x 1.24.0-next.14 → 1.24.0-next.16

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
@@ -42,7 +42,7 @@ var ts__default = /*#__PURE__*/_interopDefault(ts);
42
42
 
43
43
  // package.json
44
44
  var name = "eslint-plugin-react-x";
45
- var version = "1.24.0-next.14";
45
+ var version = "1.24.0-next.16";
46
46
  var createRule = shared.createRuleForPlugin("x");
47
47
 
48
48
  // src/rules/avoid-shorthand-boolean.ts
@@ -301,7 +301,7 @@ function isReactChildrenMethod(name2) {
301
301
  return reactChildrenMethod.some((method) => method === name2);
302
302
  }
303
303
  function isUsingReactChildren(node, context) {
304
- const settings = shared.unsafeDecodeSettings(context.settings);
304
+ const { importSource = "react" } = shared.unsafeDecodeSettings(context.settings);
305
305
  const { callee } = node;
306
306
  if (!("property" in callee) || !("object" in callee) || !("name" in callee.property)) {
307
307
  return false;
@@ -314,7 +314,7 @@ function isUsingReactChildren(node, context) {
314
314
  return true;
315
315
  }
316
316
  if (callee.object.type === types.AST_NODE_TYPES.MemberExpression && "name" in callee.object.object) {
317
- return core.isInitializedFromReact(callee.object.object.name, initialScope, settings.importSource);
317
+ return core.isInitializedFromReact(callee.object.object.name, importSource, initialScope);
318
318
  }
319
319
  return false;
320
320
  }
@@ -612,8 +612,8 @@ var no_children_prop_default = createRule({
612
612
  JSXElement(node) {
613
613
  const attribute = JSX7__namespace.getAttribute(
614
614
  "children",
615
- context.sourceCode.getScope(node),
616
- node.openingElement.attributes
615
+ node.openingElement.attributes,
616
+ context.sourceCode.getScope(node)
617
617
  );
618
618
  if (attribute != null) {
619
619
  context.report({
@@ -1438,7 +1438,7 @@ var no_implicit_key_default = createRule({
1438
1438
  return {
1439
1439
  JSXOpeningElement(node) {
1440
1440
  const initialScope = context.sourceCode.getScope(node);
1441
- const keyPropFound = JSX7__namespace.getAttribute("key", initialScope, node.attributes);
1441
+ const keyPropFound = JSX7__namespace.getAttribute("key", node.attributes, initialScope);
1442
1442
  const keyPropOnElement = node.attributes.some(
1443
1443
  (n) => n.type === types.AST_NODE_TYPES.JSXAttribute && n.name.type === types.AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
1444
1444
  );
@@ -1702,7 +1702,7 @@ var no_missing_key_default = createRule({
1702
1702
  switch (node.type) {
1703
1703
  case types.AST_NODE_TYPES.JSXElement: {
1704
1704
  const initialScope = context.sourceCode.getScope(node);
1705
- if (!JSX7__namespace.hasAttribute("key", initialScope, node.openingElement.attributes)) {
1705
+ if (!JSX7__namespace.hasAttribute("key", node.openingElement.attributes, initialScope)) {
1706
1706
  return {
1707
1707
  messageId: "noMissingKey",
1708
1708
  node
@@ -1763,7 +1763,7 @@ var no_missing_key_default = createRule({
1763
1763
  }
1764
1764
  const initialScope = context.sourceCode.getScope(node);
1765
1765
  for (const element of elements) {
1766
- if (!JSX7__namespace.hasAttribute("key", initialScope, element.openingElement.attributes)) {
1766
+ if (!JSX7__namespace.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1767
1767
  context.report({
1768
1768
  messageId: "noMissingKey",
1769
1769
  node: element
@@ -2893,9 +2893,7 @@ var no_useless_fragment_default = createRule({
2893
2893
  const { allowExpressions = true } = option;
2894
2894
  return {
2895
2895
  JSXElement(node) {
2896
- if (JSX7__namespace.getElementName(node).split(".").at(-1) !== "Fragment") {
2897
- return;
2898
- }
2896
+ if (!JSX7__namespace.isFragmentElement(node)) return;
2899
2897
  checkAndReport(node, context, allowExpressions);
2900
2898
  },
2901
2899
  JSXFragment(node) {
@@ -3007,7 +3005,7 @@ var prefer_react_namespace_import_default = createRule({
3007
3005
  },
3008
3006
  name: RULE_NAME46,
3009
3007
  create(context) {
3010
- const importSource = shared.getSettingsFromContext(context).importSource ?? "react";
3008
+ const { importSource } = shared.getSettingsFromContext(context);
3011
3009
  return {
3012
3010
  [`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
3013
3011
  const hasOtherSpecifiers = node.parent.specifiers.length > 1;
@@ -3153,9 +3151,7 @@ var prefer_shorthand_fragment_default = createRule({
3153
3151
  create(context) {
3154
3152
  return {
3155
3153
  JSXElement(node) {
3156
- if (JSX7__namespace.getElementName(node).split(".").at(-1) !== "Fragment") {
3157
- return;
3158
- }
3154
+ if (!JSX7__namespace.isFragmentElement(node)) return;
3159
3155
  const hasAttributes = node.openingElement.attributes.length > 0;
3160
3156
  if (hasAttributes) {
3161
3157
  return;
package/dist/index.mjs CHANGED
@@ -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.24.0-next.14";
18
+ var version = "1.24.0-next.16";
19
19
  var createRule = createRuleForPlugin("x");
20
20
 
21
21
  // src/rules/avoid-shorthand-boolean.ts
@@ -274,7 +274,7 @@ function isReactChildrenMethod(name2) {
274
274
  return reactChildrenMethod.some((method) => method === name2);
275
275
  }
276
276
  function isUsingReactChildren(node, context) {
277
- const settings = unsafeDecodeSettings(context.settings);
277
+ const { importSource = "react" } = unsafeDecodeSettings(context.settings);
278
278
  const { callee } = node;
279
279
  if (!("property" in callee) || !("object" in callee) || !("name" in callee.property)) {
280
280
  return false;
@@ -287,7 +287,7 @@ function isUsingReactChildren(node, context) {
287
287
  return true;
288
288
  }
289
289
  if (callee.object.type === AST_NODE_TYPES.MemberExpression && "name" in callee.object.object) {
290
- return isInitializedFromReact(callee.object.object.name, initialScope, settings.importSource);
290
+ return isInitializedFromReact(callee.object.object.name, importSource, initialScope);
291
291
  }
292
292
  return false;
293
293
  }
@@ -585,8 +585,8 @@ var no_children_prop_default = createRule({
585
585
  JSXElement(node) {
586
586
  const attribute = JSX7.getAttribute(
587
587
  "children",
588
- context.sourceCode.getScope(node),
589
- node.openingElement.attributes
588
+ node.openingElement.attributes,
589
+ context.sourceCode.getScope(node)
590
590
  );
591
591
  if (attribute != null) {
592
592
  context.report({
@@ -1411,7 +1411,7 @@ var no_implicit_key_default = createRule({
1411
1411
  return {
1412
1412
  JSXOpeningElement(node) {
1413
1413
  const initialScope = context.sourceCode.getScope(node);
1414
- const keyPropFound = JSX7.getAttribute("key", initialScope, node.attributes);
1414
+ const keyPropFound = JSX7.getAttribute("key", node.attributes, initialScope);
1415
1415
  const keyPropOnElement = node.attributes.some(
1416
1416
  (n) => n.type === AST_NODE_TYPES.JSXAttribute && n.name.type === AST_NODE_TYPES.JSXIdentifier && n.name.name === "key"
1417
1417
  );
@@ -1675,7 +1675,7 @@ var no_missing_key_default = createRule({
1675
1675
  switch (node.type) {
1676
1676
  case AST_NODE_TYPES.JSXElement: {
1677
1677
  const initialScope = context.sourceCode.getScope(node);
1678
- if (!JSX7.hasAttribute("key", initialScope, node.openingElement.attributes)) {
1678
+ if (!JSX7.hasAttribute("key", node.openingElement.attributes, initialScope)) {
1679
1679
  return {
1680
1680
  messageId: "noMissingKey",
1681
1681
  node
@@ -1736,7 +1736,7 @@ var no_missing_key_default = createRule({
1736
1736
  }
1737
1737
  const initialScope = context.sourceCode.getScope(node);
1738
1738
  for (const element of elements) {
1739
- if (!JSX7.hasAttribute("key", initialScope, element.openingElement.attributes)) {
1739
+ if (!JSX7.hasAttribute("key", element.openingElement.attributes, initialScope)) {
1740
1740
  context.report({
1741
1741
  messageId: "noMissingKey",
1742
1742
  node: element
@@ -2866,9 +2866,7 @@ var no_useless_fragment_default = createRule({
2866
2866
  const { allowExpressions = true } = option;
2867
2867
  return {
2868
2868
  JSXElement(node) {
2869
- if (JSX7.getElementName(node).split(".").at(-1) !== "Fragment") {
2870
- return;
2871
- }
2869
+ if (!JSX7.isFragmentElement(node)) return;
2872
2870
  checkAndReport(node, context, allowExpressions);
2873
2871
  },
2874
2872
  JSXFragment(node) {
@@ -2980,7 +2978,7 @@ var prefer_react_namespace_import_default = createRule({
2980
2978
  },
2981
2979
  name: RULE_NAME46,
2982
2980
  create(context) {
2983
- const importSource = getSettingsFromContext(context).importSource ?? "react";
2981
+ const { importSource } = getSettingsFromContext(context);
2984
2982
  return {
2985
2983
  [`ImportDeclaration[source.value="${importSource}"] ImportDefaultSpecifier`](node) {
2986
2984
  const hasOtherSpecifiers = node.parent.specifiers.length > 1;
@@ -3126,9 +3124,7 @@ var prefer_shorthand_fragment_default = createRule({
3126
3124
  create(context) {
3127
3125
  return {
3128
3126
  JSXElement(node) {
3129
- if (JSX7.getElementName(node).split(".").at(-1) !== "Fragment") {
3130
- return;
3131
- }
3127
+ if (!JSX7.isFragmentElement(node)) return;
3132
3128
  const hasAttributes = node.openingElement.attributes.length > 0;
3133
3129
  if (hasAttributes) {
3134
3130
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-x",
3
- "version": "1.24.0-next.14",
3
+ "version": "1.24.0-next.16",
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",
@@ -48,12 +48,12 @@
48
48
  "is-immutable-type": "^5.0.1",
49
49
  "string-ts": "^2.2.0",
50
50
  "ts-pattern": "^5.6.0",
51
- "@eslint-react/ast": "1.24.0-next.14",
52
- "@eslint-react/eff": "1.24.0-next.14",
53
- "@eslint-react/jsx": "1.24.0-next.14",
54
- "@eslint-react/core": "1.24.0-next.14",
55
- "@eslint-react/shared": "1.24.0-next.14",
56
- "@eslint-react/var": "1.24.0-next.14"
51
+ "@eslint-react/ast": "1.24.0-next.16",
52
+ "@eslint-react/eff": "1.24.0-next.16",
53
+ "@eslint-react/core": "1.24.0-next.16",
54
+ "@eslint-react/jsx": "1.24.0-next.16",
55
+ "@eslint-react/shared": "1.24.0-next.16",
56
+ "@eslint-react/var": "1.24.0-next.16"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/react": "^19.0.7",