@eslint-react/jsx 1.5.20-next.4 → 1.5.20-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/dist/index.d.mts CHANGED
@@ -137,6 +137,7 @@ declare const JSXValueHint: {
137
137
  readonly SkipStringLiteral: bigint;
138
138
  readonly SkipNumberLiteral: bigint;
139
139
  readonly SkipCreateElement: bigint;
140
+ readonly SkipEmptyArray: bigint;
140
141
  readonly StrictArray: bigint;
141
142
  readonly StrictLogical: bigint;
142
143
  readonly StrictConditional: bigint;
package/dist/index.d.ts CHANGED
@@ -137,6 +137,7 @@ declare const JSXValueHint: {
137
137
  readonly SkipStringLiteral: bigint;
138
138
  readonly SkipNumberLiteral: bigint;
139
139
  readonly SkipCreateElement: bigint;
140
+ readonly SkipEmptyArray: bigint;
140
141
  readonly StrictArray: bigint;
141
142
  readonly StrictLogical: bigint;
142
143
  readonly StrictConditional: bigint;
package/dist/index.js CHANGED
@@ -2273,9 +2273,10 @@ var JSXValueHint = {
2273
2273
  SkipStringLiteral: 1n << 3n,
2274
2274
  SkipNumberLiteral: 1n << 4n,
2275
2275
  SkipCreateElement: 1n << 5n,
2276
- StrictArray: 1n << 6n,
2277
- StrictLogical: 1n << 7n,
2278
- StrictConditional: 1n << 8n
2276
+ SkipEmptyArray: 1n << 6n,
2277
+ StrictArray: 1n << 7n,
2278
+ StrictLogical: 1n << 8n,
2279
+ StrictConditional: 1n << 9n
2279
2280
  };
2280
2281
  var DEFAULT_JSX_VALUE_HINT = JSXValueHint.SkipUndefinedLiteral | JSXValueHint.SkipBooleanLiteral;
2281
2282
  function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
@@ -2288,6 +2289,7 @@ function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
2288
2289
  }).with({ type: ast.NodeType.ConditionalExpression }, (node2) => {
2289
2290
  function leftHasJSX(node3) {
2290
2291
  if (Array.isArray(node3.consequent)) {
2292
+ if (node3.consequent.length === 0) return !(hint & JSXValueHint.SkipEmptyArray);
2291
2293
  if (hint & JSXValueHint.StrictArray) {
2292
2294
  return node3.consequent.every((n2) => isJSXValue(n2, context, hint));
2293
2295
  }
@@ -2303,6 +2305,9 @@ function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
2303
2305
  }
2304
2306
  return leftHasJSX(node2) || rightHasJSX(node2);
2305
2307
  }).with({ type: ast.NodeType.LogicalExpression }, (node2) => {
2308
+ if (hint & JSXValueHint.StrictLogical) {
2309
+ return isJSXValue(node2.left, context, hint) && isJSXValue(node2.right, context, hint);
2310
+ }
2306
2311
  return isJSXValue(node2.left, context, hint) || isJSXValue(node2.right, context, hint);
2307
2312
  }).with({ type: ast.NodeType.SequenceExpression }, (node2) => {
2308
2313
  const exp = node2.expressions.at(-1);
package/dist/index.mjs CHANGED
@@ -2271,9 +2271,10 @@ var JSXValueHint = {
2271
2271
  SkipStringLiteral: 1n << 3n,
2272
2272
  SkipNumberLiteral: 1n << 4n,
2273
2273
  SkipCreateElement: 1n << 5n,
2274
- StrictArray: 1n << 6n,
2275
- StrictLogical: 1n << 7n,
2276
- StrictConditional: 1n << 8n
2274
+ SkipEmptyArray: 1n << 6n,
2275
+ StrictArray: 1n << 7n,
2276
+ StrictLogical: 1n << 8n,
2277
+ StrictConditional: 1n << 9n
2277
2278
  };
2278
2279
  var DEFAULT_JSX_VALUE_HINT = JSXValueHint.SkipUndefinedLiteral | JSXValueHint.SkipBooleanLiteral;
2279
2280
  function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
@@ -2286,6 +2287,7 @@ function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
2286
2287
  }).with({ type: NodeType.ConditionalExpression }, (node2) => {
2287
2288
  function leftHasJSX(node3) {
2288
2289
  if (Array.isArray(node3.consequent)) {
2290
+ if (node3.consequent.length === 0) return !(hint & JSXValueHint.SkipEmptyArray);
2289
2291
  if (hint & JSXValueHint.StrictArray) {
2290
2292
  return node3.consequent.every((n2) => isJSXValue(n2, context, hint));
2291
2293
  }
@@ -2301,6 +2303,9 @@ function isJSXValue(node, context, hint = DEFAULT_JSX_VALUE_HINT) {
2301
2303
  }
2302
2304
  return leftHasJSX(node2) || rightHasJSX(node2);
2303
2305
  }).with({ type: NodeType.LogicalExpression }, (node2) => {
2306
+ if (hint & JSXValueHint.StrictLogical) {
2307
+ return isJSXValue(node2.left, context, hint) && isJSXValue(node2.right, context, hint);
2308
+ }
2304
2309
  return isJSXValue(node2.left, context, hint) || isJSXValue(node2.right, context, hint);
2305
2310
  }).with({ type: NodeType.SequenceExpression }, (node2) => {
2306
2311
  const exp = node2.expressions.at(-1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/jsx",
3
- "version": "1.5.20-next.4",
3
+ "version": "1.5.20-next.6",
4
4
  "description": "ESLint React's TSESTree AST utility module for static analysis of JSX.",
5
5
  "homepage": "https://github.com/rel1cx/eslint-react",
6
6
  "bugs": {
@@ -38,11 +38,11 @@
38
38
  "@typescript-eslint/scope-manager": "^7.15.0",
39
39
  "@typescript-eslint/types": "^7.15.0",
40
40
  "@typescript-eslint/utils": "^7.15.0",
41
- "@eslint-react/ast": "1.5.20-next.4",
42
- "@eslint-react/shared": "1.5.20-next.4",
43
- "@eslint-react/types": "1.5.20-next.4",
44
- "@eslint-react/tools": "1.5.20-next.4",
45
- "@eslint-react/var": "1.5.20-next.4"
41
+ "@eslint-react/ast": "1.5.20-next.6",
42
+ "@eslint-react/tools": "1.5.20-next.6",
43
+ "@eslint-react/var": "1.5.20-next.6",
44
+ "@eslint-react/shared": "1.5.20-next.6",
45
+ "@eslint-react/types": "1.5.20-next.6"
46
46
  },
47
47
  "devDependencies": {
48
48
  "effect": "3.4.6",