@eslint-react/jsx 0.7.0 → 0.7.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.cjs +228 -24
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +228 -24
- package/dist/index.mjs +228 -24
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -6233,6 +6233,17 @@ const t$1 = Symbol.for("@ts-pattern/matcher"), e$1 = Symbol.for("@ts-pattern/isV
|
|
|
6233
6233
|
var n, s, a;
|
|
6234
6234
|
return r$1(e) ? i$1(e) ? null != (n = null == (s = (a = e[t$1]()).getSelectionKeys) ? void 0 : s.call(a)) ? n : [] : Array.isArray(e) ? c$1(e, o$1) : c$1(Object.values(e), o$1) : [];
|
|
6235
6235
|
}, c$1 = (t, e)=>t.reduce((t, n)=>t.concat(e(n)), []);
|
|
6236
|
+
function a$1(...t) {
|
|
6237
|
+
if (1 === t.length) {
|
|
6238
|
+
const [e] = t;
|
|
6239
|
+
return (t)=>s$1(e, t, ()=>{});
|
|
6240
|
+
}
|
|
6241
|
+
if (2 === t.length) {
|
|
6242
|
+
const [e, n] = t;
|
|
6243
|
+
return s$1(e, n, ()=>{});
|
|
6244
|
+
}
|
|
6245
|
+
throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t.length}.`);
|
|
6246
|
+
}
|
|
6236
6247
|
function u$1(t) {
|
|
6237
6248
|
return Object.assign(t, {
|
|
6238
6249
|
optional: ()=>l$1(t),
|
|
@@ -6241,6 +6252,18 @@ function u$1(t) {
|
|
|
6241
6252
|
select: (e)=>void 0 === e ? p$1(t) : p$1(e, t)
|
|
6242
6253
|
});
|
|
6243
6254
|
}
|
|
6255
|
+
function h(t) {
|
|
6256
|
+
return Object.assign(((t)=>Object.assign(t, {
|
|
6257
|
+
*[Symbol.iterator] () {
|
|
6258
|
+
yield Object.assign(t, {
|
|
6259
|
+
[e$1]: !0
|
|
6260
|
+
});
|
|
6261
|
+
}
|
|
6262
|
+
}))(t), {
|
|
6263
|
+
optional: ()=>h(l$1(t)),
|
|
6264
|
+
select: (e)=>h(void 0 === e ? p$1(t) : p$1(e, t))
|
|
6265
|
+
});
|
|
6266
|
+
}
|
|
6244
6267
|
function l$1(e) {
|
|
6245
6268
|
return u$1({
|
|
6246
6269
|
[t$1]: ()=>({
|
|
@@ -6262,6 +6285,13 @@ function l$1(e) {
|
|
|
6262
6285
|
})
|
|
6263
6286
|
});
|
|
6264
6287
|
}
|
|
6288
|
+
const f = (t, e)=>{
|
|
6289
|
+
for (const n of t)if (!e(n)) return !1;
|
|
6290
|
+
return !0;
|
|
6291
|
+
}, g = (t, e)=>{
|
|
6292
|
+
for (const [n, r] of t.entries())if (!e(r, n)) return !1;
|
|
6293
|
+
return !0;
|
|
6294
|
+
};
|
|
6265
6295
|
function m$1(...e) {
|
|
6266
6296
|
return u$1({
|
|
6267
6297
|
[t$1]: ()=>({
|
|
@@ -6337,10 +6367,9 @@ function b$1(t) {
|
|
|
6337
6367
|
function w$1(t) {
|
|
6338
6368
|
return "bigint" == typeof t;
|
|
6339
6369
|
}
|
|
6340
|
-
u$1(d$1(function(t) {
|
|
6370
|
+
const S = u$1(d$1(function(t) {
|
|
6341
6371
|
return !0;
|
|
6342
|
-
}))
|
|
6343
|
-
const j$1 = (t)=>Object.assign(u$1(t), {
|
|
6372
|
+
})), O = S, j$1 = (t)=>Object.assign(u$1(t), {
|
|
6344
6373
|
startsWith: (e)=>{
|
|
6345
6374
|
return j$1(m$1(t, (n = e, d$1((t)=>b$1(t) && t.startsWith(n)))));
|
|
6346
6375
|
var n;
|
|
@@ -6359,9 +6388,7 @@ const j$1 = (t)=>Object.assign(u$1(t), {
|
|
|
6359
6388
|
return j$1(m$1(t, (n = e, d$1((t)=>b$1(t) && Boolean(t.match(n))))));
|
|
6360
6389
|
var n;
|
|
6361
6390
|
}
|
|
6362
|
-
})
|
|
6363
|
-
j$1(d$1(b$1));
|
|
6364
|
-
const K$1 = (t)=>Object.assign(u$1(t), {
|
|
6391
|
+
}), E = j$1(d$1(b$1)), K$1 = (t)=>Object.assign(u$1(t), {
|
|
6365
6392
|
between: (e, n)=>K$1(m$1(t, ((t, e)=>d$1((n)=>v$1(n) && t <= n && e >= n))(e, n))),
|
|
6366
6393
|
lt: (e)=>K$1(m$1(t, ((t)=>d$1((e)=>v$1(e) && e < t))(e))),
|
|
6367
6394
|
gt: (e)=>K$1(m$1(t, ((t)=>d$1((e)=>v$1(e) && e > t))(e))),
|
|
@@ -6371,9 +6398,7 @@ const K$1 = (t)=>Object.assign(u$1(t), {
|
|
|
6371
6398
|
finite: ()=>K$1(m$1(t, d$1((t)=>v$1(t) && Number.isFinite(t)))),
|
|
6372
6399
|
positive: ()=>K$1(m$1(t, d$1((t)=>v$1(t) && t > 0))),
|
|
6373
6400
|
negative: ()=>K$1(m$1(t, d$1((t)=>v$1(t) && t < 0)))
|
|
6374
|
-
})
|
|
6375
|
-
K$1(d$1(v$1));
|
|
6376
|
-
const x$1 = (t)=>Object.assign(u$1(t), {
|
|
6401
|
+
}), A = K$1(d$1(v$1)), x$1 = (t)=>Object.assign(u$1(t), {
|
|
6377
6402
|
between: (e, n)=>x$1(m$1(t, ((t, e)=>d$1((n)=>w$1(n) && t <= n && e >= n))(e, n))),
|
|
6378
6403
|
lt: (e)=>x$1(m$1(t, ((t)=>d$1((e)=>w$1(e) && e < t))(e))),
|
|
6379
6404
|
gt: (e)=>x$1(m$1(t, ((t)=>d$1((e)=>w$1(e) && e > t))(e))),
|
|
@@ -6381,17 +6406,148 @@ const x$1 = (t)=>Object.assign(u$1(t), {
|
|
|
6381
6406
|
gte: (e)=>x$1(m$1(t, ((t)=>d$1((e)=>w$1(e) && e >= t))(e))),
|
|
6382
6407
|
positive: ()=>x$1(m$1(t, d$1((t)=>w$1(t) && t > 0))),
|
|
6383
6408
|
negative: ()=>x$1(m$1(t, d$1((t)=>w$1(t) && t < 0)))
|
|
6384
|
-
})
|
|
6385
|
-
x$1(d$1(w$1));
|
|
6386
|
-
u$1(d$1(function(t) {
|
|
6409
|
+
}), P = x$1(d$1(w$1)), T = u$1(d$1(function(t) {
|
|
6387
6410
|
return "boolean" == typeof t;
|
|
6388
|
-
}))
|
|
6389
|
-
u$1(d$1(function(t) {
|
|
6411
|
+
})), k = u$1(d$1(function(t) {
|
|
6390
6412
|
return "symbol" == typeof t;
|
|
6391
|
-
}))
|
|
6392
|
-
u$1(d$1(function(t) {
|
|
6413
|
+
})), B = u$1(d$1(function(t) {
|
|
6393
6414
|
return null == t;
|
|
6394
6415
|
}));
|
|
6416
|
+
var _ = {
|
|
6417
|
+
__proto__: null,
|
|
6418
|
+
matcher: t$1,
|
|
6419
|
+
optional: l$1,
|
|
6420
|
+
array: function(...e) {
|
|
6421
|
+
return h({
|
|
6422
|
+
[t$1]: ()=>({
|
|
6423
|
+
match: (t)=>{
|
|
6424
|
+
if (!Array.isArray(t)) return {
|
|
6425
|
+
matched: !1
|
|
6426
|
+
};
|
|
6427
|
+
if (0 === e.length) return {
|
|
6428
|
+
matched: !0
|
|
6429
|
+
};
|
|
6430
|
+
const n = e[0];
|
|
6431
|
+
let r = {};
|
|
6432
|
+
if (0 === t.length) return o$1(n).forEach((t)=>{
|
|
6433
|
+
r[t] = [];
|
|
6434
|
+
}), {
|
|
6435
|
+
matched: !0,
|
|
6436
|
+
selections: r
|
|
6437
|
+
};
|
|
6438
|
+
const i = (t, e)=>{
|
|
6439
|
+
r[t] = (r[t] || []).concat([
|
|
6440
|
+
e
|
|
6441
|
+
]);
|
|
6442
|
+
};
|
|
6443
|
+
return {
|
|
6444
|
+
matched: t.every((t)=>s$1(n, t, i)),
|
|
6445
|
+
selections: r
|
|
6446
|
+
};
|
|
6447
|
+
},
|
|
6448
|
+
getSelectionKeys: ()=>0 === e.length ? [] : o$1(e[0])
|
|
6449
|
+
})
|
|
6450
|
+
});
|
|
6451
|
+
},
|
|
6452
|
+
set: function(...e) {
|
|
6453
|
+
return u$1({
|
|
6454
|
+
[t$1]: ()=>({
|
|
6455
|
+
match: (t)=>{
|
|
6456
|
+
if (!(t instanceof Set)) return {
|
|
6457
|
+
matched: !1
|
|
6458
|
+
};
|
|
6459
|
+
let n = {};
|
|
6460
|
+
if (0 === t.size) return {
|
|
6461
|
+
matched: !0,
|
|
6462
|
+
selections: n
|
|
6463
|
+
};
|
|
6464
|
+
if (0 === e.length) return {
|
|
6465
|
+
matched: !0
|
|
6466
|
+
};
|
|
6467
|
+
const r = (t, e)=>{
|
|
6468
|
+
n[t] = (n[t] || []).concat([
|
|
6469
|
+
e
|
|
6470
|
+
]);
|
|
6471
|
+
}, i = e[0];
|
|
6472
|
+
return {
|
|
6473
|
+
matched: f(t, (t)=>s$1(i, t, r)),
|
|
6474
|
+
selections: n
|
|
6475
|
+
};
|
|
6476
|
+
},
|
|
6477
|
+
getSelectionKeys: ()=>0 === e.length ? [] : o$1(e[0])
|
|
6478
|
+
})
|
|
6479
|
+
});
|
|
6480
|
+
},
|
|
6481
|
+
map: function(...e) {
|
|
6482
|
+
return u$1({
|
|
6483
|
+
[t$1]: ()=>({
|
|
6484
|
+
match: (t)=>{
|
|
6485
|
+
if (!(t instanceof Map)) return {
|
|
6486
|
+
matched: !1
|
|
6487
|
+
};
|
|
6488
|
+
let n = {};
|
|
6489
|
+
if (0 === t.size) return {
|
|
6490
|
+
matched: !0,
|
|
6491
|
+
selections: n
|
|
6492
|
+
};
|
|
6493
|
+
const r = (t, e)=>{
|
|
6494
|
+
n[t] = (n[t] || []).concat([
|
|
6495
|
+
e
|
|
6496
|
+
]);
|
|
6497
|
+
};
|
|
6498
|
+
if (0 === e.length) return {
|
|
6499
|
+
matched: !0
|
|
6500
|
+
};
|
|
6501
|
+
var i;
|
|
6502
|
+
if (1 === e.length) throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${null == (i = e[0]) ? void 0 : i.toString()}`);
|
|
6503
|
+
const [o, c] = e;
|
|
6504
|
+
return {
|
|
6505
|
+
matched: g(t, (t, e)=>{
|
|
6506
|
+
const n = s$1(o, e, r), i = s$1(c, t, r);
|
|
6507
|
+
return n && i;
|
|
6508
|
+
}),
|
|
6509
|
+
selections: n
|
|
6510
|
+
};
|
|
6511
|
+
},
|
|
6512
|
+
getSelectionKeys: ()=>0 === e.length ? [] : [
|
|
6513
|
+
...o$1(e[0]),
|
|
6514
|
+
...o$1(e[1])
|
|
6515
|
+
]
|
|
6516
|
+
})
|
|
6517
|
+
});
|
|
6518
|
+
},
|
|
6519
|
+
intersection: m$1,
|
|
6520
|
+
union: y$1,
|
|
6521
|
+
not: function(e) {
|
|
6522
|
+
return u$1({
|
|
6523
|
+
[t$1]: ()=>({
|
|
6524
|
+
match: (t)=>({
|
|
6525
|
+
matched: !s$1(e, t, ()=>{})
|
|
6526
|
+
}),
|
|
6527
|
+
getSelectionKeys: ()=>[],
|
|
6528
|
+
matcherType: "not"
|
|
6529
|
+
})
|
|
6530
|
+
});
|
|
6531
|
+
},
|
|
6532
|
+
when: d$1,
|
|
6533
|
+
select: p$1,
|
|
6534
|
+
any: S,
|
|
6535
|
+
_: O,
|
|
6536
|
+
string: E,
|
|
6537
|
+
number: A,
|
|
6538
|
+
bigint: P,
|
|
6539
|
+
boolean: T,
|
|
6540
|
+
symbol: k,
|
|
6541
|
+
nullish: B,
|
|
6542
|
+
instanceOf: function(t) {
|
|
6543
|
+
return u$1(d$1(function(t) {
|
|
6544
|
+
return (e)=>e instanceof t;
|
|
6545
|
+
}(t)));
|
|
6546
|
+
},
|
|
6547
|
+
shape: function(t) {
|
|
6548
|
+
return u$1(d$1(a$1(t)));
|
|
6549
|
+
}
|
|
6550
|
+
};
|
|
6395
6551
|
const NodeType = types.AST_NODE_TYPES;
|
|
6396
6552
|
const is = utils.ASTUtils.isNodeOfType;
|
|
6397
6553
|
const isOneOf = utils.ASTUtils.isNodeOfTypes;
|
|
@@ -6580,6 +6736,54 @@ Construction.None();
|
|
|
6580
6736
|
}
|
|
6581
6737
|
return returnStatements;
|
|
6582
6738
|
}
|
|
6739
|
+
/**
|
|
6740
|
+
* Checks if the given node is a function expression or arrow function expression of a object method.
|
|
6741
|
+
* @param node The node to check.
|
|
6742
|
+
* @returns `true` if the node is a function expression or arrow function expression of a object method, `false` otherwise.
|
|
6743
|
+
*/ a$1({
|
|
6744
|
+
type: _.union([
|
|
6745
|
+
NodeType.FunctionExpression,
|
|
6746
|
+
NodeType.ArrowFunctionExpression
|
|
6747
|
+
]),
|
|
6748
|
+
parent: {
|
|
6749
|
+
type: NodeType.Property,
|
|
6750
|
+
parent: {
|
|
6751
|
+
type: NodeType.ObjectExpression
|
|
6752
|
+
}
|
|
6753
|
+
}
|
|
6754
|
+
});
|
|
6755
|
+
/**
|
|
6756
|
+
* Checks if the given node is a function expression or arrow function expression of a class method.
|
|
6757
|
+
* @param node The node to check.
|
|
6758
|
+
* @returns `true` if the node is a function expression or arrow function expression of a class method, `false` otherwise.
|
|
6759
|
+
*/ a$1({
|
|
6760
|
+
type: _.union([
|
|
6761
|
+
NodeType.FunctionExpression,
|
|
6762
|
+
NodeType.ArrowFunctionExpression
|
|
6763
|
+
]),
|
|
6764
|
+
parent: {
|
|
6765
|
+
type: NodeType.MethodDefinition,
|
|
6766
|
+
parent: {
|
|
6767
|
+
type: NodeType.ClassBody
|
|
6768
|
+
}
|
|
6769
|
+
}
|
|
6770
|
+
});
|
|
6771
|
+
/**
|
|
6772
|
+
* Checks if the given node is a function expression or arrow function expression of a class property.
|
|
6773
|
+
* @param node The node to check.
|
|
6774
|
+
* @returns `true` if the node is a function expression or arrow function expression of a class property, `false` otherwise.
|
|
6775
|
+
*/ a$1({
|
|
6776
|
+
type: _.union([
|
|
6777
|
+
NodeType.FunctionExpression,
|
|
6778
|
+
NodeType.ArrowFunctionExpression
|
|
6779
|
+
]),
|
|
6780
|
+
parent: {
|
|
6781
|
+
type: NodeType.Property,
|
|
6782
|
+
parent: {
|
|
6783
|
+
type: NodeType.ClassBody
|
|
6784
|
+
}
|
|
6785
|
+
}
|
|
6786
|
+
});
|
|
6583
6787
|
function isStringLiteral(node) {
|
|
6584
6788
|
return node?.type === NodeType.Literal && isString$1(node.value);
|
|
6585
6789
|
}
|
|
@@ -7087,11 +7291,11 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7087
7291
|
|
|
7088
7292
|
/* eslint-disable perfectionist/sort-objects */ const JSXValueCheckHint = {
|
|
7089
7293
|
None: 0n,
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7294
|
+
SkipNull: 1n << 0n,
|
|
7295
|
+
SkipCreateElement: 1n << 1n,
|
|
7296
|
+
StrictArray: 1n << 2n,
|
|
7297
|
+
StrictLogical: 1n << 3n,
|
|
7298
|
+
StrictConditional: 1n << 4n
|
|
7095
7299
|
};
|
|
7096
7300
|
/* eslint-enable perfectionist/sort-objects */ /**
|
|
7097
7301
|
* Check if a node is a JSX value
|
|
@@ -7114,7 +7318,7 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7114
7318
|
}, effectFunction_esm.constTrue).with({
|
|
7115
7319
|
type: NodeType.Literal
|
|
7116
7320
|
}, (node)=>{
|
|
7117
|
-
if (!("value" in node) || hint & JSXValueCheckHint.
|
|
7321
|
+
if (!("value" in node) || hint & JSXValueCheckHint.SkipNull) {
|
|
7118
7322
|
return false;
|
|
7119
7323
|
}
|
|
7120
7324
|
return node.value === null;
|
|
@@ -7124,7 +7328,7 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7124
7328
|
if (!("elements" in node)) {
|
|
7125
7329
|
return false;
|
|
7126
7330
|
}
|
|
7127
|
-
if (hint & JSXValueCheckHint.
|
|
7331
|
+
if (hint & JSXValueCheckHint.StrictArray) {
|
|
7128
7332
|
return node.elements.every((n)=>isJSXValue(n, context, hint));
|
|
7129
7333
|
}
|
|
7130
7334
|
return node.elements.some((n)=>isJSXValue(n, context, hint));
|
|
@@ -7168,7 +7372,7 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7168
7372
|
}).with({
|
|
7169
7373
|
type: NodeType.CallExpression
|
|
7170
7374
|
}, (node)=>{
|
|
7171
|
-
if (hint & JSXValueCheckHint.
|
|
7375
|
+
if (hint & JSXValueCheckHint.SkipCreateElement) {
|
|
7172
7376
|
return false;
|
|
7173
7377
|
}
|
|
7174
7378
|
return isCreateElementCall(node, context);
|
package/dist/index.d.mts
CHANGED
|
@@ -232,11 +232,11 @@ declare function isPaddingSpaces(node: TSESTree.Node): boolean;
|
|
|
232
232
|
|
|
233
233
|
declare const JSXValueCheckHint: {
|
|
234
234
|
readonly None: 0n;
|
|
235
|
-
readonly
|
|
236
|
-
readonly
|
|
235
|
+
readonly SkipNull: bigint;
|
|
236
|
+
readonly SkipCreateElement: bigint;
|
|
237
|
+
readonly StrictArray: bigint;
|
|
237
238
|
readonly StrictLogical: bigint;
|
|
238
239
|
readonly StrictConditional: bigint;
|
|
239
|
-
readonly StrictArrayExpression: bigint;
|
|
240
240
|
};
|
|
241
241
|
/**
|
|
242
242
|
* Check if a node is a JSX value
|
package/dist/index.d.ts
CHANGED
|
@@ -232,11 +232,11 @@ declare function isPaddingSpaces(node: TSESTree.Node): boolean;
|
|
|
232
232
|
|
|
233
233
|
declare const JSXValueCheckHint: {
|
|
234
234
|
readonly None: 0n;
|
|
235
|
-
readonly
|
|
236
|
-
readonly
|
|
235
|
+
readonly SkipNull: bigint;
|
|
236
|
+
readonly SkipCreateElement: bigint;
|
|
237
|
+
readonly StrictArray: bigint;
|
|
237
238
|
readonly StrictLogical: bigint;
|
|
238
239
|
readonly StrictConditional: bigint;
|
|
239
|
-
readonly StrictArrayExpression: bigint;
|
|
240
240
|
};
|
|
241
241
|
/**
|
|
242
242
|
* Check if a node is a JSX value
|
package/dist/index.js
CHANGED
|
@@ -6233,6 +6233,17 @@ const t$1 = Symbol.for("@ts-pattern/matcher"), e$1 = Symbol.for("@ts-pattern/isV
|
|
|
6233
6233
|
var n, s, a;
|
|
6234
6234
|
return r$1(e) ? i$1(e) ? null != (n = null == (s = (a = e[t$1]()).getSelectionKeys) ? void 0 : s.call(a)) ? n : [] : Array.isArray(e) ? c$1(e, o$1) : c$1(Object.values(e), o$1) : [];
|
|
6235
6235
|
}, c$1 = (t, e)=>t.reduce((t, n)=>t.concat(e(n)), []);
|
|
6236
|
+
function a$1(...t) {
|
|
6237
|
+
if (1 === t.length) {
|
|
6238
|
+
const [e] = t;
|
|
6239
|
+
return (t)=>s$1(e, t, ()=>{});
|
|
6240
|
+
}
|
|
6241
|
+
if (2 === t.length) {
|
|
6242
|
+
const [e, n] = t;
|
|
6243
|
+
return s$1(e, n, ()=>{});
|
|
6244
|
+
}
|
|
6245
|
+
throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t.length}.`);
|
|
6246
|
+
}
|
|
6236
6247
|
function u$1(t) {
|
|
6237
6248
|
return Object.assign(t, {
|
|
6238
6249
|
optional: ()=>l$1(t),
|
|
@@ -6241,6 +6252,18 @@ function u$1(t) {
|
|
|
6241
6252
|
select: (e)=>void 0 === e ? p$1(t) : p$1(e, t)
|
|
6242
6253
|
});
|
|
6243
6254
|
}
|
|
6255
|
+
function h(t) {
|
|
6256
|
+
return Object.assign(((t)=>Object.assign(t, {
|
|
6257
|
+
*[Symbol.iterator] () {
|
|
6258
|
+
yield Object.assign(t, {
|
|
6259
|
+
[e$1]: !0
|
|
6260
|
+
});
|
|
6261
|
+
}
|
|
6262
|
+
}))(t), {
|
|
6263
|
+
optional: ()=>h(l$1(t)),
|
|
6264
|
+
select: (e)=>h(void 0 === e ? p$1(t) : p$1(e, t))
|
|
6265
|
+
});
|
|
6266
|
+
}
|
|
6244
6267
|
function l$1(e) {
|
|
6245
6268
|
return u$1({
|
|
6246
6269
|
[t$1]: ()=>({
|
|
@@ -6262,6 +6285,13 @@ function l$1(e) {
|
|
|
6262
6285
|
})
|
|
6263
6286
|
});
|
|
6264
6287
|
}
|
|
6288
|
+
const f = (t, e)=>{
|
|
6289
|
+
for (const n of t)if (!e(n)) return !1;
|
|
6290
|
+
return !0;
|
|
6291
|
+
}, g = (t, e)=>{
|
|
6292
|
+
for (const [n, r] of t.entries())if (!e(r, n)) return !1;
|
|
6293
|
+
return !0;
|
|
6294
|
+
};
|
|
6265
6295
|
function m$1(...e) {
|
|
6266
6296
|
return u$1({
|
|
6267
6297
|
[t$1]: ()=>({
|
|
@@ -6337,10 +6367,9 @@ function b$1(t) {
|
|
|
6337
6367
|
function w$1(t) {
|
|
6338
6368
|
return "bigint" == typeof t;
|
|
6339
6369
|
}
|
|
6340
|
-
u$1(d$1(function(t) {
|
|
6370
|
+
const S = u$1(d$1(function(t) {
|
|
6341
6371
|
return !0;
|
|
6342
|
-
}))
|
|
6343
|
-
const j$1 = (t)=>Object.assign(u$1(t), {
|
|
6372
|
+
})), O = S, j$1 = (t)=>Object.assign(u$1(t), {
|
|
6344
6373
|
startsWith: (e)=>{
|
|
6345
6374
|
return j$1(m$1(t, (n = e, d$1((t)=>b$1(t) && t.startsWith(n)))));
|
|
6346
6375
|
var n;
|
|
@@ -6359,9 +6388,7 @@ const j$1 = (t)=>Object.assign(u$1(t), {
|
|
|
6359
6388
|
return j$1(m$1(t, (n = e, d$1((t)=>b$1(t) && Boolean(t.match(n))))));
|
|
6360
6389
|
var n;
|
|
6361
6390
|
}
|
|
6362
|
-
})
|
|
6363
|
-
j$1(d$1(b$1));
|
|
6364
|
-
const K$1 = (t)=>Object.assign(u$1(t), {
|
|
6391
|
+
}), E = j$1(d$1(b$1)), K$1 = (t)=>Object.assign(u$1(t), {
|
|
6365
6392
|
between: (e, n)=>K$1(m$1(t, ((t, e)=>d$1((n)=>v$1(n) && t <= n && e >= n))(e, n))),
|
|
6366
6393
|
lt: (e)=>K$1(m$1(t, ((t)=>d$1((e)=>v$1(e) && e < t))(e))),
|
|
6367
6394
|
gt: (e)=>K$1(m$1(t, ((t)=>d$1((e)=>v$1(e) && e > t))(e))),
|
|
@@ -6371,9 +6398,7 @@ const K$1 = (t)=>Object.assign(u$1(t), {
|
|
|
6371
6398
|
finite: ()=>K$1(m$1(t, d$1((t)=>v$1(t) && Number.isFinite(t)))),
|
|
6372
6399
|
positive: ()=>K$1(m$1(t, d$1((t)=>v$1(t) && t > 0))),
|
|
6373
6400
|
negative: ()=>K$1(m$1(t, d$1((t)=>v$1(t) && t < 0)))
|
|
6374
|
-
})
|
|
6375
|
-
K$1(d$1(v$1));
|
|
6376
|
-
const x$1 = (t)=>Object.assign(u$1(t), {
|
|
6401
|
+
}), A = K$1(d$1(v$1)), x$1 = (t)=>Object.assign(u$1(t), {
|
|
6377
6402
|
between: (e, n)=>x$1(m$1(t, ((t, e)=>d$1((n)=>w$1(n) && t <= n && e >= n))(e, n))),
|
|
6378
6403
|
lt: (e)=>x$1(m$1(t, ((t)=>d$1((e)=>w$1(e) && e < t))(e))),
|
|
6379
6404
|
gt: (e)=>x$1(m$1(t, ((t)=>d$1((e)=>w$1(e) && e > t))(e))),
|
|
@@ -6381,17 +6406,148 @@ const x$1 = (t)=>Object.assign(u$1(t), {
|
|
|
6381
6406
|
gte: (e)=>x$1(m$1(t, ((t)=>d$1((e)=>w$1(e) && e >= t))(e))),
|
|
6382
6407
|
positive: ()=>x$1(m$1(t, d$1((t)=>w$1(t) && t > 0))),
|
|
6383
6408
|
negative: ()=>x$1(m$1(t, d$1((t)=>w$1(t) && t < 0)))
|
|
6384
|
-
})
|
|
6385
|
-
x$1(d$1(w$1));
|
|
6386
|
-
u$1(d$1(function(t) {
|
|
6409
|
+
}), P = x$1(d$1(w$1)), T = u$1(d$1(function(t) {
|
|
6387
6410
|
return "boolean" == typeof t;
|
|
6388
|
-
}))
|
|
6389
|
-
u$1(d$1(function(t) {
|
|
6411
|
+
})), k = u$1(d$1(function(t) {
|
|
6390
6412
|
return "symbol" == typeof t;
|
|
6391
|
-
}))
|
|
6392
|
-
u$1(d$1(function(t) {
|
|
6413
|
+
})), B = u$1(d$1(function(t) {
|
|
6393
6414
|
return null == t;
|
|
6394
6415
|
}));
|
|
6416
|
+
var _ = {
|
|
6417
|
+
__proto__: null,
|
|
6418
|
+
matcher: t$1,
|
|
6419
|
+
optional: l$1,
|
|
6420
|
+
array: function(...e) {
|
|
6421
|
+
return h({
|
|
6422
|
+
[t$1]: ()=>({
|
|
6423
|
+
match: (t)=>{
|
|
6424
|
+
if (!Array.isArray(t)) return {
|
|
6425
|
+
matched: !1
|
|
6426
|
+
};
|
|
6427
|
+
if (0 === e.length) return {
|
|
6428
|
+
matched: !0
|
|
6429
|
+
};
|
|
6430
|
+
const n = e[0];
|
|
6431
|
+
let r = {};
|
|
6432
|
+
if (0 === t.length) return o$1(n).forEach((t)=>{
|
|
6433
|
+
r[t] = [];
|
|
6434
|
+
}), {
|
|
6435
|
+
matched: !0,
|
|
6436
|
+
selections: r
|
|
6437
|
+
};
|
|
6438
|
+
const i = (t, e)=>{
|
|
6439
|
+
r[t] = (r[t] || []).concat([
|
|
6440
|
+
e
|
|
6441
|
+
]);
|
|
6442
|
+
};
|
|
6443
|
+
return {
|
|
6444
|
+
matched: t.every((t)=>s$1(n, t, i)),
|
|
6445
|
+
selections: r
|
|
6446
|
+
};
|
|
6447
|
+
},
|
|
6448
|
+
getSelectionKeys: ()=>0 === e.length ? [] : o$1(e[0])
|
|
6449
|
+
})
|
|
6450
|
+
});
|
|
6451
|
+
},
|
|
6452
|
+
set: function(...e) {
|
|
6453
|
+
return u$1({
|
|
6454
|
+
[t$1]: ()=>({
|
|
6455
|
+
match: (t)=>{
|
|
6456
|
+
if (!(t instanceof Set)) return {
|
|
6457
|
+
matched: !1
|
|
6458
|
+
};
|
|
6459
|
+
let n = {};
|
|
6460
|
+
if (0 === t.size) return {
|
|
6461
|
+
matched: !0,
|
|
6462
|
+
selections: n
|
|
6463
|
+
};
|
|
6464
|
+
if (0 === e.length) return {
|
|
6465
|
+
matched: !0
|
|
6466
|
+
};
|
|
6467
|
+
const r = (t, e)=>{
|
|
6468
|
+
n[t] = (n[t] || []).concat([
|
|
6469
|
+
e
|
|
6470
|
+
]);
|
|
6471
|
+
}, i = e[0];
|
|
6472
|
+
return {
|
|
6473
|
+
matched: f(t, (t)=>s$1(i, t, r)),
|
|
6474
|
+
selections: n
|
|
6475
|
+
};
|
|
6476
|
+
},
|
|
6477
|
+
getSelectionKeys: ()=>0 === e.length ? [] : o$1(e[0])
|
|
6478
|
+
})
|
|
6479
|
+
});
|
|
6480
|
+
},
|
|
6481
|
+
map: function(...e) {
|
|
6482
|
+
return u$1({
|
|
6483
|
+
[t$1]: ()=>({
|
|
6484
|
+
match: (t)=>{
|
|
6485
|
+
if (!(t instanceof Map)) return {
|
|
6486
|
+
matched: !1
|
|
6487
|
+
};
|
|
6488
|
+
let n = {};
|
|
6489
|
+
if (0 === t.size) return {
|
|
6490
|
+
matched: !0,
|
|
6491
|
+
selections: n
|
|
6492
|
+
};
|
|
6493
|
+
const r = (t, e)=>{
|
|
6494
|
+
n[t] = (n[t] || []).concat([
|
|
6495
|
+
e
|
|
6496
|
+
]);
|
|
6497
|
+
};
|
|
6498
|
+
if (0 === e.length) return {
|
|
6499
|
+
matched: !0
|
|
6500
|
+
};
|
|
6501
|
+
var i;
|
|
6502
|
+
if (1 === e.length) throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${null == (i = e[0]) ? void 0 : i.toString()}`);
|
|
6503
|
+
const [o, c] = e;
|
|
6504
|
+
return {
|
|
6505
|
+
matched: g(t, (t, e)=>{
|
|
6506
|
+
const n = s$1(o, e, r), i = s$1(c, t, r);
|
|
6507
|
+
return n && i;
|
|
6508
|
+
}),
|
|
6509
|
+
selections: n
|
|
6510
|
+
};
|
|
6511
|
+
},
|
|
6512
|
+
getSelectionKeys: ()=>0 === e.length ? [] : [
|
|
6513
|
+
...o$1(e[0]),
|
|
6514
|
+
...o$1(e[1])
|
|
6515
|
+
]
|
|
6516
|
+
})
|
|
6517
|
+
});
|
|
6518
|
+
},
|
|
6519
|
+
intersection: m$1,
|
|
6520
|
+
union: y$1,
|
|
6521
|
+
not: function(e) {
|
|
6522
|
+
return u$1({
|
|
6523
|
+
[t$1]: ()=>({
|
|
6524
|
+
match: (t)=>({
|
|
6525
|
+
matched: !s$1(e, t, ()=>{})
|
|
6526
|
+
}),
|
|
6527
|
+
getSelectionKeys: ()=>[],
|
|
6528
|
+
matcherType: "not"
|
|
6529
|
+
})
|
|
6530
|
+
});
|
|
6531
|
+
},
|
|
6532
|
+
when: d$1,
|
|
6533
|
+
select: p$1,
|
|
6534
|
+
any: S,
|
|
6535
|
+
_: O,
|
|
6536
|
+
string: E,
|
|
6537
|
+
number: A,
|
|
6538
|
+
bigint: P,
|
|
6539
|
+
boolean: T,
|
|
6540
|
+
symbol: k,
|
|
6541
|
+
nullish: B,
|
|
6542
|
+
instanceOf: function(t) {
|
|
6543
|
+
return u$1(d$1(function(t) {
|
|
6544
|
+
return (e)=>e instanceof t;
|
|
6545
|
+
}(t)));
|
|
6546
|
+
},
|
|
6547
|
+
shape: function(t) {
|
|
6548
|
+
return u$1(d$1(a$1(t)));
|
|
6549
|
+
}
|
|
6550
|
+
};
|
|
6395
6551
|
const NodeType = types.AST_NODE_TYPES;
|
|
6396
6552
|
const is = utils.ASTUtils.isNodeOfType;
|
|
6397
6553
|
const isOneOf = utils.ASTUtils.isNodeOfTypes;
|
|
@@ -6580,6 +6736,54 @@ Construction.None();
|
|
|
6580
6736
|
}
|
|
6581
6737
|
return returnStatements;
|
|
6582
6738
|
}
|
|
6739
|
+
/**
|
|
6740
|
+
* Checks if the given node is a function expression or arrow function expression of a object method.
|
|
6741
|
+
* @param node The node to check.
|
|
6742
|
+
* @returns `true` if the node is a function expression or arrow function expression of a object method, `false` otherwise.
|
|
6743
|
+
*/ a$1({
|
|
6744
|
+
type: _.union([
|
|
6745
|
+
NodeType.FunctionExpression,
|
|
6746
|
+
NodeType.ArrowFunctionExpression
|
|
6747
|
+
]),
|
|
6748
|
+
parent: {
|
|
6749
|
+
type: NodeType.Property,
|
|
6750
|
+
parent: {
|
|
6751
|
+
type: NodeType.ObjectExpression
|
|
6752
|
+
}
|
|
6753
|
+
}
|
|
6754
|
+
});
|
|
6755
|
+
/**
|
|
6756
|
+
* Checks if the given node is a function expression or arrow function expression of a class method.
|
|
6757
|
+
* @param node The node to check.
|
|
6758
|
+
* @returns `true` if the node is a function expression or arrow function expression of a class method, `false` otherwise.
|
|
6759
|
+
*/ a$1({
|
|
6760
|
+
type: _.union([
|
|
6761
|
+
NodeType.FunctionExpression,
|
|
6762
|
+
NodeType.ArrowFunctionExpression
|
|
6763
|
+
]),
|
|
6764
|
+
parent: {
|
|
6765
|
+
type: NodeType.MethodDefinition,
|
|
6766
|
+
parent: {
|
|
6767
|
+
type: NodeType.ClassBody
|
|
6768
|
+
}
|
|
6769
|
+
}
|
|
6770
|
+
});
|
|
6771
|
+
/**
|
|
6772
|
+
* Checks if the given node is a function expression or arrow function expression of a class property.
|
|
6773
|
+
* @param node The node to check.
|
|
6774
|
+
* @returns `true` if the node is a function expression or arrow function expression of a class property, `false` otherwise.
|
|
6775
|
+
*/ a$1({
|
|
6776
|
+
type: _.union([
|
|
6777
|
+
NodeType.FunctionExpression,
|
|
6778
|
+
NodeType.ArrowFunctionExpression
|
|
6779
|
+
]),
|
|
6780
|
+
parent: {
|
|
6781
|
+
type: NodeType.Property,
|
|
6782
|
+
parent: {
|
|
6783
|
+
type: NodeType.ClassBody
|
|
6784
|
+
}
|
|
6785
|
+
}
|
|
6786
|
+
});
|
|
6583
6787
|
function isStringLiteral(node) {
|
|
6584
6788
|
return node?.type === NodeType.Literal && isString$1(node.value);
|
|
6585
6789
|
}
|
|
@@ -7087,11 +7291,11 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7087
7291
|
|
|
7088
7292
|
/* eslint-disable perfectionist/sort-objects */ const JSXValueCheckHint = {
|
|
7089
7293
|
None: 0n,
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7294
|
+
SkipNull: 1n << 0n,
|
|
7295
|
+
SkipCreateElement: 1n << 1n,
|
|
7296
|
+
StrictArray: 1n << 2n,
|
|
7297
|
+
StrictLogical: 1n << 3n,
|
|
7298
|
+
StrictConditional: 1n << 4n
|
|
7095
7299
|
};
|
|
7096
7300
|
/* eslint-enable perfectionist/sort-objects */ /**
|
|
7097
7301
|
* Check if a node is a JSX value
|
|
@@ -7114,7 +7318,7 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7114
7318
|
}, effectFunction_esm.constTrue).with({
|
|
7115
7319
|
type: NodeType.Literal
|
|
7116
7320
|
}, (node)=>{
|
|
7117
|
-
if (!("value" in node) || hint & JSXValueCheckHint.
|
|
7321
|
+
if (!("value" in node) || hint & JSXValueCheckHint.SkipNull) {
|
|
7118
7322
|
return false;
|
|
7119
7323
|
}
|
|
7120
7324
|
return node.value === null;
|
|
@@ -7124,7 +7328,7 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7124
7328
|
if (!("elements" in node)) {
|
|
7125
7329
|
return false;
|
|
7126
7330
|
}
|
|
7127
|
-
if (hint & JSXValueCheckHint.
|
|
7331
|
+
if (hint & JSXValueCheckHint.StrictArray) {
|
|
7128
7332
|
return node.elements.every((n)=>isJSXValue(n, context, hint));
|
|
7129
7333
|
}
|
|
7130
7334
|
return node.elements.some((n)=>isJSXValue(n, context, hint));
|
|
@@ -7168,7 +7372,7 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7168
7372
|
}).with({
|
|
7169
7373
|
type: NodeType.CallExpression
|
|
7170
7374
|
}, (node)=>{
|
|
7171
|
-
if (hint & JSXValueCheckHint.
|
|
7375
|
+
if (hint & JSXValueCheckHint.SkipCreateElement) {
|
|
7172
7376
|
return false;
|
|
7173
7377
|
}
|
|
7174
7378
|
return isCreateElementCall(node, context);
|
package/dist/index.mjs
CHANGED
|
@@ -6231,6 +6231,17 @@ const t$1 = Symbol.for("@ts-pattern/matcher"), e$1 = Symbol.for("@ts-pattern/isV
|
|
|
6231
6231
|
var n, s, a;
|
|
6232
6232
|
return r$1(e) ? i$1(e) ? null != (n = null == (s = (a = e[t$1]()).getSelectionKeys) ? void 0 : s.call(a)) ? n : [] : Array.isArray(e) ? c$1(e, o$1) : c$1(Object.values(e), o$1) : [];
|
|
6233
6233
|
}, c$1 = (t, e)=>t.reduce((t, n)=>t.concat(e(n)), []);
|
|
6234
|
+
function a$1(...t) {
|
|
6235
|
+
if (1 === t.length) {
|
|
6236
|
+
const [e] = t;
|
|
6237
|
+
return (t)=>s$1(e, t, ()=>{});
|
|
6238
|
+
}
|
|
6239
|
+
if (2 === t.length) {
|
|
6240
|
+
const [e, n] = t;
|
|
6241
|
+
return s$1(e, n, ()=>{});
|
|
6242
|
+
}
|
|
6243
|
+
throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t.length}.`);
|
|
6244
|
+
}
|
|
6234
6245
|
function u$1(t) {
|
|
6235
6246
|
return Object.assign(t, {
|
|
6236
6247
|
optional: ()=>l$1(t),
|
|
@@ -6239,6 +6250,18 @@ function u$1(t) {
|
|
|
6239
6250
|
select: (e)=>void 0 === e ? p$1(t) : p$1(e, t)
|
|
6240
6251
|
});
|
|
6241
6252
|
}
|
|
6253
|
+
function h(t) {
|
|
6254
|
+
return Object.assign(((t)=>Object.assign(t, {
|
|
6255
|
+
*[Symbol.iterator] () {
|
|
6256
|
+
yield Object.assign(t, {
|
|
6257
|
+
[e$1]: !0
|
|
6258
|
+
});
|
|
6259
|
+
}
|
|
6260
|
+
}))(t), {
|
|
6261
|
+
optional: ()=>h(l$1(t)),
|
|
6262
|
+
select: (e)=>h(void 0 === e ? p$1(t) : p$1(e, t))
|
|
6263
|
+
});
|
|
6264
|
+
}
|
|
6242
6265
|
function l$1(e) {
|
|
6243
6266
|
return u$1({
|
|
6244
6267
|
[t$1]: ()=>({
|
|
@@ -6260,6 +6283,13 @@ function l$1(e) {
|
|
|
6260
6283
|
})
|
|
6261
6284
|
});
|
|
6262
6285
|
}
|
|
6286
|
+
const f = (t, e)=>{
|
|
6287
|
+
for (const n of t)if (!e(n)) return !1;
|
|
6288
|
+
return !0;
|
|
6289
|
+
}, g = (t, e)=>{
|
|
6290
|
+
for (const [n, r] of t.entries())if (!e(r, n)) return !1;
|
|
6291
|
+
return !0;
|
|
6292
|
+
};
|
|
6263
6293
|
function m$1(...e) {
|
|
6264
6294
|
return u$1({
|
|
6265
6295
|
[t$1]: ()=>({
|
|
@@ -6335,10 +6365,9 @@ function b$1(t) {
|
|
|
6335
6365
|
function w$1(t) {
|
|
6336
6366
|
return "bigint" == typeof t;
|
|
6337
6367
|
}
|
|
6338
|
-
u$1(d$1(function(t) {
|
|
6368
|
+
const S = u$1(d$1(function(t) {
|
|
6339
6369
|
return !0;
|
|
6340
|
-
}))
|
|
6341
|
-
const j$1 = (t)=>Object.assign(u$1(t), {
|
|
6370
|
+
})), O = S, j$1 = (t)=>Object.assign(u$1(t), {
|
|
6342
6371
|
startsWith: (e)=>{
|
|
6343
6372
|
return j$1(m$1(t, (n = e, d$1((t)=>b$1(t) && t.startsWith(n)))));
|
|
6344
6373
|
var n;
|
|
@@ -6357,9 +6386,7 @@ const j$1 = (t)=>Object.assign(u$1(t), {
|
|
|
6357
6386
|
return j$1(m$1(t, (n = e, d$1((t)=>b$1(t) && Boolean(t.match(n))))));
|
|
6358
6387
|
var n;
|
|
6359
6388
|
}
|
|
6360
|
-
})
|
|
6361
|
-
j$1(d$1(b$1));
|
|
6362
|
-
const K$1 = (t)=>Object.assign(u$1(t), {
|
|
6389
|
+
}), E = j$1(d$1(b$1)), K$1 = (t)=>Object.assign(u$1(t), {
|
|
6363
6390
|
between: (e, n)=>K$1(m$1(t, ((t, e)=>d$1((n)=>v$1(n) && t <= n && e >= n))(e, n))),
|
|
6364
6391
|
lt: (e)=>K$1(m$1(t, ((t)=>d$1((e)=>v$1(e) && e < t))(e))),
|
|
6365
6392
|
gt: (e)=>K$1(m$1(t, ((t)=>d$1((e)=>v$1(e) && e > t))(e))),
|
|
@@ -6369,9 +6396,7 @@ const K$1 = (t)=>Object.assign(u$1(t), {
|
|
|
6369
6396
|
finite: ()=>K$1(m$1(t, d$1((t)=>v$1(t) && Number.isFinite(t)))),
|
|
6370
6397
|
positive: ()=>K$1(m$1(t, d$1((t)=>v$1(t) && t > 0))),
|
|
6371
6398
|
negative: ()=>K$1(m$1(t, d$1((t)=>v$1(t) && t < 0)))
|
|
6372
|
-
})
|
|
6373
|
-
K$1(d$1(v$1));
|
|
6374
|
-
const x$1 = (t)=>Object.assign(u$1(t), {
|
|
6399
|
+
}), A = K$1(d$1(v$1)), x$1 = (t)=>Object.assign(u$1(t), {
|
|
6375
6400
|
between: (e, n)=>x$1(m$1(t, ((t, e)=>d$1((n)=>w$1(n) && t <= n && e >= n))(e, n))),
|
|
6376
6401
|
lt: (e)=>x$1(m$1(t, ((t)=>d$1((e)=>w$1(e) && e < t))(e))),
|
|
6377
6402
|
gt: (e)=>x$1(m$1(t, ((t)=>d$1((e)=>w$1(e) && e > t))(e))),
|
|
@@ -6379,17 +6404,148 @@ const x$1 = (t)=>Object.assign(u$1(t), {
|
|
|
6379
6404
|
gte: (e)=>x$1(m$1(t, ((t)=>d$1((e)=>w$1(e) && e >= t))(e))),
|
|
6380
6405
|
positive: ()=>x$1(m$1(t, d$1((t)=>w$1(t) && t > 0))),
|
|
6381
6406
|
negative: ()=>x$1(m$1(t, d$1((t)=>w$1(t) && t < 0)))
|
|
6382
|
-
})
|
|
6383
|
-
x$1(d$1(w$1));
|
|
6384
|
-
u$1(d$1(function(t) {
|
|
6407
|
+
}), P = x$1(d$1(w$1)), T = u$1(d$1(function(t) {
|
|
6385
6408
|
return "boolean" == typeof t;
|
|
6386
|
-
}))
|
|
6387
|
-
u$1(d$1(function(t) {
|
|
6409
|
+
})), k = u$1(d$1(function(t) {
|
|
6388
6410
|
return "symbol" == typeof t;
|
|
6389
|
-
}))
|
|
6390
|
-
u$1(d$1(function(t) {
|
|
6411
|
+
})), B = u$1(d$1(function(t) {
|
|
6391
6412
|
return null == t;
|
|
6392
6413
|
}));
|
|
6414
|
+
var _ = {
|
|
6415
|
+
__proto__: null,
|
|
6416
|
+
matcher: t$1,
|
|
6417
|
+
optional: l$1,
|
|
6418
|
+
array: function(...e) {
|
|
6419
|
+
return h({
|
|
6420
|
+
[t$1]: ()=>({
|
|
6421
|
+
match: (t)=>{
|
|
6422
|
+
if (!Array.isArray(t)) return {
|
|
6423
|
+
matched: !1
|
|
6424
|
+
};
|
|
6425
|
+
if (0 === e.length) return {
|
|
6426
|
+
matched: !0
|
|
6427
|
+
};
|
|
6428
|
+
const n = e[0];
|
|
6429
|
+
let r = {};
|
|
6430
|
+
if (0 === t.length) return o$1(n).forEach((t)=>{
|
|
6431
|
+
r[t] = [];
|
|
6432
|
+
}), {
|
|
6433
|
+
matched: !0,
|
|
6434
|
+
selections: r
|
|
6435
|
+
};
|
|
6436
|
+
const i = (t, e)=>{
|
|
6437
|
+
r[t] = (r[t] || []).concat([
|
|
6438
|
+
e
|
|
6439
|
+
]);
|
|
6440
|
+
};
|
|
6441
|
+
return {
|
|
6442
|
+
matched: t.every((t)=>s$1(n, t, i)),
|
|
6443
|
+
selections: r
|
|
6444
|
+
};
|
|
6445
|
+
},
|
|
6446
|
+
getSelectionKeys: ()=>0 === e.length ? [] : o$1(e[0])
|
|
6447
|
+
})
|
|
6448
|
+
});
|
|
6449
|
+
},
|
|
6450
|
+
set: function(...e) {
|
|
6451
|
+
return u$1({
|
|
6452
|
+
[t$1]: ()=>({
|
|
6453
|
+
match: (t)=>{
|
|
6454
|
+
if (!(t instanceof Set)) return {
|
|
6455
|
+
matched: !1
|
|
6456
|
+
};
|
|
6457
|
+
let n = {};
|
|
6458
|
+
if (0 === t.size) return {
|
|
6459
|
+
matched: !0,
|
|
6460
|
+
selections: n
|
|
6461
|
+
};
|
|
6462
|
+
if (0 === e.length) return {
|
|
6463
|
+
matched: !0
|
|
6464
|
+
};
|
|
6465
|
+
const r = (t, e)=>{
|
|
6466
|
+
n[t] = (n[t] || []).concat([
|
|
6467
|
+
e
|
|
6468
|
+
]);
|
|
6469
|
+
}, i = e[0];
|
|
6470
|
+
return {
|
|
6471
|
+
matched: f(t, (t)=>s$1(i, t, r)),
|
|
6472
|
+
selections: n
|
|
6473
|
+
};
|
|
6474
|
+
},
|
|
6475
|
+
getSelectionKeys: ()=>0 === e.length ? [] : o$1(e[0])
|
|
6476
|
+
})
|
|
6477
|
+
});
|
|
6478
|
+
},
|
|
6479
|
+
map: function(...e) {
|
|
6480
|
+
return u$1({
|
|
6481
|
+
[t$1]: ()=>({
|
|
6482
|
+
match: (t)=>{
|
|
6483
|
+
if (!(t instanceof Map)) return {
|
|
6484
|
+
matched: !1
|
|
6485
|
+
};
|
|
6486
|
+
let n = {};
|
|
6487
|
+
if (0 === t.size) return {
|
|
6488
|
+
matched: !0,
|
|
6489
|
+
selections: n
|
|
6490
|
+
};
|
|
6491
|
+
const r = (t, e)=>{
|
|
6492
|
+
n[t] = (n[t] || []).concat([
|
|
6493
|
+
e
|
|
6494
|
+
]);
|
|
6495
|
+
};
|
|
6496
|
+
if (0 === e.length) return {
|
|
6497
|
+
matched: !0
|
|
6498
|
+
};
|
|
6499
|
+
var i;
|
|
6500
|
+
if (1 === e.length) throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${null == (i = e[0]) ? void 0 : i.toString()}`);
|
|
6501
|
+
const [o, c] = e;
|
|
6502
|
+
return {
|
|
6503
|
+
matched: g(t, (t, e)=>{
|
|
6504
|
+
const n = s$1(o, e, r), i = s$1(c, t, r);
|
|
6505
|
+
return n && i;
|
|
6506
|
+
}),
|
|
6507
|
+
selections: n
|
|
6508
|
+
};
|
|
6509
|
+
},
|
|
6510
|
+
getSelectionKeys: ()=>0 === e.length ? [] : [
|
|
6511
|
+
...o$1(e[0]),
|
|
6512
|
+
...o$1(e[1])
|
|
6513
|
+
]
|
|
6514
|
+
})
|
|
6515
|
+
});
|
|
6516
|
+
},
|
|
6517
|
+
intersection: m$1,
|
|
6518
|
+
union: y$1,
|
|
6519
|
+
not: function(e) {
|
|
6520
|
+
return u$1({
|
|
6521
|
+
[t$1]: ()=>({
|
|
6522
|
+
match: (t)=>({
|
|
6523
|
+
matched: !s$1(e, t, ()=>{})
|
|
6524
|
+
}),
|
|
6525
|
+
getSelectionKeys: ()=>[],
|
|
6526
|
+
matcherType: "not"
|
|
6527
|
+
})
|
|
6528
|
+
});
|
|
6529
|
+
},
|
|
6530
|
+
when: d$1,
|
|
6531
|
+
select: p$1,
|
|
6532
|
+
any: S,
|
|
6533
|
+
_: O,
|
|
6534
|
+
string: E,
|
|
6535
|
+
number: A,
|
|
6536
|
+
bigint: P,
|
|
6537
|
+
boolean: T,
|
|
6538
|
+
symbol: k,
|
|
6539
|
+
nullish: B,
|
|
6540
|
+
instanceOf: function(t) {
|
|
6541
|
+
return u$1(d$1(function(t) {
|
|
6542
|
+
return (e)=>e instanceof t;
|
|
6543
|
+
}(t)));
|
|
6544
|
+
},
|
|
6545
|
+
shape: function(t) {
|
|
6546
|
+
return u$1(d$1(a$1(t)));
|
|
6547
|
+
}
|
|
6548
|
+
};
|
|
6393
6549
|
const NodeType = AST_NODE_TYPES;
|
|
6394
6550
|
const is = ASTUtils.isNodeOfType;
|
|
6395
6551
|
const isOneOf = ASTUtils.isNodeOfTypes;
|
|
@@ -6578,6 +6734,54 @@ Construction.None();
|
|
|
6578
6734
|
}
|
|
6579
6735
|
return returnStatements;
|
|
6580
6736
|
}
|
|
6737
|
+
/**
|
|
6738
|
+
* Checks if the given node is a function expression or arrow function expression of a object method.
|
|
6739
|
+
* @param node The node to check.
|
|
6740
|
+
* @returns `true` if the node is a function expression or arrow function expression of a object method, `false` otherwise.
|
|
6741
|
+
*/ a$1({
|
|
6742
|
+
type: _.union([
|
|
6743
|
+
NodeType.FunctionExpression,
|
|
6744
|
+
NodeType.ArrowFunctionExpression
|
|
6745
|
+
]),
|
|
6746
|
+
parent: {
|
|
6747
|
+
type: NodeType.Property,
|
|
6748
|
+
parent: {
|
|
6749
|
+
type: NodeType.ObjectExpression
|
|
6750
|
+
}
|
|
6751
|
+
}
|
|
6752
|
+
});
|
|
6753
|
+
/**
|
|
6754
|
+
* Checks if the given node is a function expression or arrow function expression of a class method.
|
|
6755
|
+
* @param node The node to check.
|
|
6756
|
+
* @returns `true` if the node is a function expression or arrow function expression of a class method, `false` otherwise.
|
|
6757
|
+
*/ a$1({
|
|
6758
|
+
type: _.union([
|
|
6759
|
+
NodeType.FunctionExpression,
|
|
6760
|
+
NodeType.ArrowFunctionExpression
|
|
6761
|
+
]),
|
|
6762
|
+
parent: {
|
|
6763
|
+
type: NodeType.MethodDefinition,
|
|
6764
|
+
parent: {
|
|
6765
|
+
type: NodeType.ClassBody
|
|
6766
|
+
}
|
|
6767
|
+
}
|
|
6768
|
+
});
|
|
6769
|
+
/**
|
|
6770
|
+
* Checks if the given node is a function expression or arrow function expression of a class property.
|
|
6771
|
+
* @param node The node to check.
|
|
6772
|
+
* @returns `true` if the node is a function expression or arrow function expression of a class property, `false` otherwise.
|
|
6773
|
+
*/ a$1({
|
|
6774
|
+
type: _.union([
|
|
6775
|
+
NodeType.FunctionExpression,
|
|
6776
|
+
NodeType.ArrowFunctionExpression
|
|
6777
|
+
]),
|
|
6778
|
+
parent: {
|
|
6779
|
+
type: NodeType.Property,
|
|
6780
|
+
parent: {
|
|
6781
|
+
type: NodeType.ClassBody
|
|
6782
|
+
}
|
|
6783
|
+
}
|
|
6784
|
+
});
|
|
6581
6785
|
function isStringLiteral(node) {
|
|
6582
6786
|
return node?.type === NodeType.Literal && isString$1(node.value);
|
|
6583
6787
|
}
|
|
@@ -7085,11 +7289,11 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7085
7289
|
|
|
7086
7290
|
/* eslint-disable perfectionist/sort-objects */ const JSXValueCheckHint = {
|
|
7087
7291
|
None: 0n,
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7292
|
+
SkipNull: 1n << 0n,
|
|
7293
|
+
SkipCreateElement: 1n << 1n,
|
|
7294
|
+
StrictArray: 1n << 2n,
|
|
7295
|
+
StrictLogical: 1n << 3n,
|
|
7296
|
+
StrictConditional: 1n << 4n
|
|
7093
7297
|
};
|
|
7094
7298
|
/* eslint-enable perfectionist/sort-objects */ /**
|
|
7095
7299
|
* Check if a node is a JSX value
|
|
@@ -7112,7 +7316,7 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7112
7316
|
}, effectFunction_esm.constTrue).with({
|
|
7113
7317
|
type: NodeType.Literal
|
|
7114
7318
|
}, (node)=>{
|
|
7115
|
-
if (!("value" in node) || hint & JSXValueCheckHint.
|
|
7319
|
+
if (!("value" in node) || hint & JSXValueCheckHint.SkipNull) {
|
|
7116
7320
|
return false;
|
|
7117
7321
|
}
|
|
7118
7322
|
return node.value === null;
|
|
@@ -7122,7 +7326,7 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7122
7326
|
if (!("elements" in node)) {
|
|
7123
7327
|
return false;
|
|
7124
7328
|
}
|
|
7125
|
-
if (hint & JSXValueCheckHint.
|
|
7329
|
+
if (hint & JSXValueCheckHint.StrictArray) {
|
|
7126
7330
|
return node.elements.every((n)=>isJSXValue(n, context, hint));
|
|
7127
7331
|
}
|
|
7128
7332
|
return node.elements.some((n)=>isJSXValue(n, context, hint));
|
|
@@ -7166,7 +7370,7 @@ function isFragmentWithSingleExpression(node) {
|
|
|
7166
7370
|
}).with({
|
|
7167
7371
|
type: NodeType.CallExpression
|
|
7168
7372
|
}, (node)=>{
|
|
7169
|
-
if (hint & JSXValueCheckHint.
|
|
7373
|
+
if (hint & JSXValueCheckHint.SkipCreateElement) {
|
|
7170
7374
|
return false;
|
|
7171
7375
|
}
|
|
7172
7376
|
return isCreateElementCall(node, context);
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/jsx",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "AST Utility Module for Static Analysis of JSX",
|
|
5
|
-
"homepage": "https://github.com/
|
|
5
|
+
"homepage": "https://github.com/eslint-react/eslint-react",
|
|
6
6
|
"bugs": {
|
|
7
|
-
"url": "https://github.com/
|
|
7
|
+
"url": "https://github.com/eslint-react/eslint-react/issues"
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/
|
|
11
|
+
"url": "https://github.com/eslint-react/eslint-react.git",
|
|
12
12
|
"directory": "packages/jsx"
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"./package.json"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@typescript-eslint/scope-manager": "6.
|
|
38
|
-
"@typescript-eslint/types": "6.
|
|
39
|
-
"@typescript-eslint/utils": "6.
|
|
37
|
+
"@typescript-eslint/scope-manager": "6.10.0",
|
|
38
|
+
"@typescript-eslint/types": "6.10.0",
|
|
39
|
+
"@typescript-eslint/utils": "6.10.0",
|
|
40
40
|
"micro-memoize": "4.1.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@eslint-react/
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
43
|
+
"@eslint-react/types": "0.7.1",
|
|
44
|
+
"@eslint-react/tools": "0.7.1",
|
|
45
|
+
"@eslint-react/ast": "0.7.1"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "rollup -c rollup.config.ts --configPlugin swc3 && cp dist/index.d.ts dist/index.d.mts",
|