@pobammer-ts/eslint-cease-nonsense-rules 1.7.1 → 1.9.0
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 +227 -0
- package/dist/build-metadata.json +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2660 -400
- package/dist/index.js.map +29 -17
- package/dist/oxfmt-sync.d.ts +2 -1
- package/dist/oxfmt-sync.d.ts.map +1 -1
- package/dist/oxfmt-worker.d.ts +1 -0
- package/dist/oxfmt-worker.d.ts.map +1 -1
- package/dist/oxfmt-worker.js +17 -172730
- package/dist/oxfmt-worker.js.map +4 -21
- package/dist/recognizers/code-recognizer.d.ts +0 -18
- package/dist/recognizers/code-recognizer.d.ts.map +1 -1
- package/dist/resolver.linux-x64-gnu-hcjn12y1.node +0 -0
- package/dist/resolver.linux-x64-musl-gnkc267h.node +0 -0
- package/dist/rules/ban-instances.d.ts.map +1 -1
- package/dist/rules/ban-react-fc.d.ts.map +1 -1
- package/dist/rules/enforce-ianitor-check-type.d.ts.map +1 -1
- package/dist/rules/no-god-components.d.ts.map +1 -1
- package/dist/rules/no-identity-map.d.ts.map +1 -1
- package/dist/rules/prefer-class-properties.d.ts +6 -0
- package/dist/rules/prefer-class-properties.d.ts.map +1 -0
- package/dist/rules/prefer-early-return.d.ts +8 -0
- package/dist/rules/prefer-early-return.d.ts.map +1 -0
- package/dist/rules/prefer-module-scope-constants.d.ts +5 -0
- package/dist/rules/prefer-module-scope-constants.d.ts.map +1 -0
- package/dist/rules/prefer-pascal-case-enums.d.ts +5 -0
- package/dist/rules/prefer-pascal-case-enums.d.ts.map +1 -0
- package/dist/rules/prefer-singular-enums.d.ts +5 -0
- package/dist/rules/prefer-singular-enums.d.ts.map +1 -0
- package/dist/rules/prefer-udim2-shorthand.d.ts.map +1 -1
- package/dist/rules/react-hooks-strict-return.d.ts +5 -0
- package/dist/rules/react-hooks-strict-return.d.ts.map +1 -0
- package/dist/rules/require-paired-calls.d.ts +0 -1
- package/dist/rules/require-paired-calls.d.ts.map +1 -1
- package/dist/rules/strict-component-boundaries.d.ts +9 -0
- package/dist/rules/strict-component-boundaries.d.ts.map +1 -0
- package/dist/rules/use-exhaustive-dependencies.d.ts +1 -42
- package/dist/rules/use-exhaustive-dependencies.d.ts.map +1 -1
- package/dist/rules/use-hook-at-top-level.d.ts.map +1 -1
- package/dist/utilities/casing-utilities.d.ts +2 -0
- package/dist/utilities/casing-utilities.d.ts.map +1 -0
- package/dist/utilities/format-utilities.d.ts +2 -3
- package/dist/utilities/format-utilities.d.ts.map +1 -1
- package/dist/utilities/resolve-import.d.ts +16 -0
- package/dist/utilities/resolve-import.d.ts.map +1 -0
- package/package.json +15 -2
- package/dist/types/oxfmt.d.ts +0 -88
- package/dist/types/oxfmt.d.ts.map +0 -1
- package/dist/utilities/error-utilities.d.ts +0 -25
- package/dist/utilities/error-utilities.d.ts.map +0 -1
- package/dist/utilities/typebox-utilities.d.ts +0 -4
- package/dist/utilities/typebox-utilities.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -28,6 +28,730 @@ var __export = (target, all) => {
|
|
|
28
28
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
29
29
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
30
30
|
|
|
31
|
+
// node_modules/fast-diff/diff.js
|
|
32
|
+
var require_diff = __commonJS((exports, module3) => {
|
|
33
|
+
var DIFF_DELETE = -1;
|
|
34
|
+
var DIFF_INSERT = 1;
|
|
35
|
+
var DIFF_EQUAL = 0;
|
|
36
|
+
function diff_main(text1, text2, cursor_pos, cleanup, _fix_unicode) {
|
|
37
|
+
if (text1 === text2) {
|
|
38
|
+
if (text1) {
|
|
39
|
+
return [[DIFF_EQUAL, text1]];
|
|
40
|
+
}
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
if (cursor_pos != null) {
|
|
44
|
+
var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);
|
|
45
|
+
if (editdiff) {
|
|
46
|
+
return editdiff;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
var commonlength = diff_commonPrefix(text1, text2);
|
|
50
|
+
var commonprefix = text1.substring(0, commonlength);
|
|
51
|
+
text1 = text1.substring(commonlength);
|
|
52
|
+
text2 = text2.substring(commonlength);
|
|
53
|
+
commonlength = diff_commonSuffix(text1, text2);
|
|
54
|
+
var commonsuffix = text1.substring(text1.length - commonlength);
|
|
55
|
+
text1 = text1.substring(0, text1.length - commonlength);
|
|
56
|
+
text2 = text2.substring(0, text2.length - commonlength);
|
|
57
|
+
var diffs = diff_compute_(text1, text2);
|
|
58
|
+
if (commonprefix) {
|
|
59
|
+
diffs.unshift([DIFF_EQUAL, commonprefix]);
|
|
60
|
+
}
|
|
61
|
+
if (commonsuffix) {
|
|
62
|
+
diffs.push([DIFF_EQUAL, commonsuffix]);
|
|
63
|
+
}
|
|
64
|
+
diff_cleanupMerge(diffs, _fix_unicode);
|
|
65
|
+
if (cleanup) {
|
|
66
|
+
diff_cleanupSemantic(diffs);
|
|
67
|
+
}
|
|
68
|
+
return diffs;
|
|
69
|
+
}
|
|
70
|
+
function diff_compute_(text1, text2) {
|
|
71
|
+
var diffs;
|
|
72
|
+
if (!text1) {
|
|
73
|
+
return [[DIFF_INSERT, text2]];
|
|
74
|
+
}
|
|
75
|
+
if (!text2) {
|
|
76
|
+
return [[DIFF_DELETE, text1]];
|
|
77
|
+
}
|
|
78
|
+
var longtext = text1.length > text2.length ? text1 : text2;
|
|
79
|
+
var shorttext = text1.length > text2.length ? text2 : text1;
|
|
80
|
+
var i = longtext.indexOf(shorttext);
|
|
81
|
+
if (i !== -1) {
|
|
82
|
+
diffs = [
|
|
83
|
+
[DIFF_INSERT, longtext.substring(0, i)],
|
|
84
|
+
[DIFF_EQUAL, shorttext],
|
|
85
|
+
[DIFF_INSERT, longtext.substring(i + shorttext.length)]
|
|
86
|
+
];
|
|
87
|
+
if (text1.length > text2.length) {
|
|
88
|
+
diffs[0][0] = diffs[2][0] = DIFF_DELETE;
|
|
89
|
+
}
|
|
90
|
+
return diffs;
|
|
91
|
+
}
|
|
92
|
+
if (shorttext.length === 1) {
|
|
93
|
+
return [
|
|
94
|
+
[DIFF_DELETE, text1],
|
|
95
|
+
[DIFF_INSERT, text2]
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
var hm = diff_halfMatch_(text1, text2);
|
|
99
|
+
if (hm) {
|
|
100
|
+
var text1_a = hm[0];
|
|
101
|
+
var text1_b = hm[1];
|
|
102
|
+
var text2_a = hm[2];
|
|
103
|
+
var text2_b = hm[3];
|
|
104
|
+
var mid_common = hm[4];
|
|
105
|
+
var diffs_a = diff_main(text1_a, text2_a);
|
|
106
|
+
var diffs_b = diff_main(text1_b, text2_b);
|
|
107
|
+
return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
|
|
108
|
+
}
|
|
109
|
+
return diff_bisect_(text1, text2);
|
|
110
|
+
}
|
|
111
|
+
function diff_bisect_(text1, text2) {
|
|
112
|
+
var text1_length = text1.length;
|
|
113
|
+
var text2_length = text2.length;
|
|
114
|
+
var max_d = Math.ceil((text1_length + text2_length) / 2);
|
|
115
|
+
var v_offset = max_d;
|
|
116
|
+
var v_length = 2 * max_d;
|
|
117
|
+
var v1 = new Array(v_length);
|
|
118
|
+
var v2 = new Array(v_length);
|
|
119
|
+
for (var x3 = 0;x3 < v_length; x3++) {
|
|
120
|
+
v1[x3] = -1;
|
|
121
|
+
v2[x3] = -1;
|
|
122
|
+
}
|
|
123
|
+
v1[v_offset + 1] = 0;
|
|
124
|
+
v2[v_offset + 1] = 0;
|
|
125
|
+
var delta2 = text1_length - text2_length;
|
|
126
|
+
var front = delta2 % 2 !== 0;
|
|
127
|
+
var k1start = 0;
|
|
128
|
+
var k1end = 0;
|
|
129
|
+
var k2start = 0;
|
|
130
|
+
var k2end = 0;
|
|
131
|
+
for (var d2 = 0;d2 < max_d; d2++) {
|
|
132
|
+
for (var k1 = -d2 + k1start;k1 <= d2 - k1end; k1 += 2) {
|
|
133
|
+
var k1_offset = v_offset + k1;
|
|
134
|
+
var x1;
|
|
135
|
+
if (k1 === -d2 || k1 !== d2 && v1[k1_offset - 1] < v1[k1_offset + 1]) {
|
|
136
|
+
x1 = v1[k1_offset + 1];
|
|
137
|
+
} else {
|
|
138
|
+
x1 = v1[k1_offset - 1] + 1;
|
|
139
|
+
}
|
|
140
|
+
var y1 = x1 - k1;
|
|
141
|
+
while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) === text2.charAt(y1)) {
|
|
142
|
+
x1++;
|
|
143
|
+
y1++;
|
|
144
|
+
}
|
|
145
|
+
v1[k1_offset] = x1;
|
|
146
|
+
if (x1 > text1_length) {
|
|
147
|
+
k1end += 2;
|
|
148
|
+
} else if (y1 > text2_length) {
|
|
149
|
+
k1start += 2;
|
|
150
|
+
} else if (front) {
|
|
151
|
+
var k2_offset = v_offset + delta2 - k1;
|
|
152
|
+
if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {
|
|
153
|
+
var x22 = text1_length - v2[k2_offset];
|
|
154
|
+
if (x1 >= x22) {
|
|
155
|
+
return diff_bisectSplit_(text1, text2, x1, y1);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
for (var k2 = -d2 + k2start;k2 <= d2 - k2end; k2 += 2) {
|
|
161
|
+
var k2_offset = v_offset + k2;
|
|
162
|
+
var x22;
|
|
163
|
+
if (k2 === -d2 || k2 !== d2 && v2[k2_offset - 1] < v2[k2_offset + 1]) {
|
|
164
|
+
x22 = v2[k2_offset + 1];
|
|
165
|
+
} else {
|
|
166
|
+
x22 = v2[k2_offset - 1] + 1;
|
|
167
|
+
}
|
|
168
|
+
var y2 = x22 - k2;
|
|
169
|
+
while (x22 < text1_length && y2 < text2_length && text1.charAt(text1_length - x22 - 1) === text2.charAt(text2_length - y2 - 1)) {
|
|
170
|
+
x22++;
|
|
171
|
+
y2++;
|
|
172
|
+
}
|
|
173
|
+
v2[k2_offset] = x22;
|
|
174
|
+
if (x22 > text1_length) {
|
|
175
|
+
k2end += 2;
|
|
176
|
+
} else if (y2 > text2_length) {
|
|
177
|
+
k2start += 2;
|
|
178
|
+
} else if (!front) {
|
|
179
|
+
var k1_offset = v_offset + delta2 - k2;
|
|
180
|
+
if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) {
|
|
181
|
+
var x1 = v1[k1_offset];
|
|
182
|
+
var y1 = v_offset + x1 - k1_offset;
|
|
183
|
+
x22 = text1_length - x22;
|
|
184
|
+
if (x1 >= x22) {
|
|
185
|
+
return diff_bisectSplit_(text1, text2, x1, y1);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return [
|
|
192
|
+
[DIFF_DELETE, text1],
|
|
193
|
+
[DIFF_INSERT, text2]
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
function diff_bisectSplit_(text1, text2, x3, y) {
|
|
197
|
+
var text1a = text1.substring(0, x3);
|
|
198
|
+
var text2a = text2.substring(0, y);
|
|
199
|
+
var text1b = text1.substring(x3);
|
|
200
|
+
var text2b = text2.substring(y);
|
|
201
|
+
var diffs = diff_main(text1a, text2a);
|
|
202
|
+
var diffsb = diff_main(text1b, text2b);
|
|
203
|
+
return diffs.concat(diffsb);
|
|
204
|
+
}
|
|
205
|
+
function diff_commonPrefix(text1, text2) {
|
|
206
|
+
if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {
|
|
207
|
+
return 0;
|
|
208
|
+
}
|
|
209
|
+
var pointermin = 0;
|
|
210
|
+
var pointermax = Math.min(text1.length, text2.length);
|
|
211
|
+
var pointermid = pointermax;
|
|
212
|
+
var pointerstart = 0;
|
|
213
|
+
while (pointermin < pointermid) {
|
|
214
|
+
if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) {
|
|
215
|
+
pointermin = pointermid;
|
|
216
|
+
pointerstart = pointermin;
|
|
217
|
+
} else {
|
|
218
|
+
pointermax = pointermid;
|
|
219
|
+
}
|
|
220
|
+
pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
|
|
221
|
+
}
|
|
222
|
+
if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) {
|
|
223
|
+
pointermid--;
|
|
224
|
+
}
|
|
225
|
+
return pointermid;
|
|
226
|
+
}
|
|
227
|
+
function diff_commonOverlap_(text1, text2) {
|
|
228
|
+
var text1_length = text1.length;
|
|
229
|
+
var text2_length = text2.length;
|
|
230
|
+
if (text1_length == 0 || text2_length == 0) {
|
|
231
|
+
return 0;
|
|
232
|
+
}
|
|
233
|
+
if (text1_length > text2_length) {
|
|
234
|
+
text1 = text1.substring(text1_length - text2_length);
|
|
235
|
+
} else if (text1_length < text2_length) {
|
|
236
|
+
text2 = text2.substring(0, text1_length);
|
|
237
|
+
}
|
|
238
|
+
var text_length = Math.min(text1_length, text2_length);
|
|
239
|
+
if (text1 == text2) {
|
|
240
|
+
return text_length;
|
|
241
|
+
}
|
|
242
|
+
var best = 0;
|
|
243
|
+
var length = 1;
|
|
244
|
+
while (true) {
|
|
245
|
+
var pattern4 = text1.substring(text_length - length);
|
|
246
|
+
var found = text2.indexOf(pattern4);
|
|
247
|
+
if (found == -1) {
|
|
248
|
+
return best;
|
|
249
|
+
}
|
|
250
|
+
length += found;
|
|
251
|
+
if (found == 0 || text1.substring(text_length - length) == text2.substring(0, length)) {
|
|
252
|
+
best = length;
|
|
253
|
+
length++;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function diff_commonSuffix(text1, text2) {
|
|
258
|
+
if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) {
|
|
259
|
+
return 0;
|
|
260
|
+
}
|
|
261
|
+
var pointermin = 0;
|
|
262
|
+
var pointermax = Math.min(text1.length, text2.length);
|
|
263
|
+
var pointermid = pointermax;
|
|
264
|
+
var pointerend = 0;
|
|
265
|
+
while (pointermin < pointermid) {
|
|
266
|
+
if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) {
|
|
267
|
+
pointermin = pointermid;
|
|
268
|
+
pointerend = pointermin;
|
|
269
|
+
} else {
|
|
270
|
+
pointermax = pointermid;
|
|
271
|
+
}
|
|
272
|
+
pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
|
|
273
|
+
}
|
|
274
|
+
if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) {
|
|
275
|
+
pointermid--;
|
|
276
|
+
}
|
|
277
|
+
return pointermid;
|
|
278
|
+
}
|
|
279
|
+
function diff_halfMatch_(text1, text2) {
|
|
280
|
+
var longtext = text1.length > text2.length ? text1 : text2;
|
|
281
|
+
var shorttext = text1.length > text2.length ? text2 : text1;
|
|
282
|
+
if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
function diff_halfMatchI_(longtext2, shorttext2, i) {
|
|
286
|
+
var seed = longtext2.substring(i, i + Math.floor(longtext2.length / 4));
|
|
287
|
+
var j = -1;
|
|
288
|
+
var best_common = "";
|
|
289
|
+
var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
|
|
290
|
+
while ((j = shorttext2.indexOf(seed, j + 1)) !== -1) {
|
|
291
|
+
var prefixLength = diff_commonPrefix(longtext2.substring(i), shorttext2.substring(j));
|
|
292
|
+
var suffixLength = diff_commonSuffix(longtext2.substring(0, i), shorttext2.substring(0, j));
|
|
293
|
+
if (best_common.length < suffixLength + prefixLength) {
|
|
294
|
+
best_common = shorttext2.substring(j - suffixLength, j) + shorttext2.substring(j, j + prefixLength);
|
|
295
|
+
best_longtext_a = longtext2.substring(0, i - suffixLength);
|
|
296
|
+
best_longtext_b = longtext2.substring(i + prefixLength);
|
|
297
|
+
best_shorttext_a = shorttext2.substring(0, j - suffixLength);
|
|
298
|
+
best_shorttext_b = shorttext2.substring(j + prefixLength);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (best_common.length * 2 >= longtext2.length) {
|
|
302
|
+
return [
|
|
303
|
+
best_longtext_a,
|
|
304
|
+
best_longtext_b,
|
|
305
|
+
best_shorttext_a,
|
|
306
|
+
best_shorttext_b,
|
|
307
|
+
best_common
|
|
308
|
+
];
|
|
309
|
+
} else {
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4));
|
|
314
|
+
var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2));
|
|
315
|
+
var hm;
|
|
316
|
+
if (!hm1 && !hm2) {
|
|
317
|
+
return null;
|
|
318
|
+
} else if (!hm2) {
|
|
319
|
+
hm = hm1;
|
|
320
|
+
} else if (!hm1) {
|
|
321
|
+
hm = hm2;
|
|
322
|
+
} else {
|
|
323
|
+
hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
|
|
324
|
+
}
|
|
325
|
+
var text1_a, text1_b, text2_a, text2_b;
|
|
326
|
+
if (text1.length > text2.length) {
|
|
327
|
+
text1_a = hm[0];
|
|
328
|
+
text1_b = hm[1];
|
|
329
|
+
text2_a = hm[2];
|
|
330
|
+
text2_b = hm[3];
|
|
331
|
+
} else {
|
|
332
|
+
text2_a = hm[0];
|
|
333
|
+
text2_b = hm[1];
|
|
334
|
+
text1_a = hm[2];
|
|
335
|
+
text1_b = hm[3];
|
|
336
|
+
}
|
|
337
|
+
var mid_common = hm[4];
|
|
338
|
+
return [text1_a, text1_b, text2_a, text2_b, mid_common];
|
|
339
|
+
}
|
|
340
|
+
function diff_cleanupSemantic(diffs) {
|
|
341
|
+
var changes = false;
|
|
342
|
+
var equalities = [];
|
|
343
|
+
var equalitiesLength = 0;
|
|
344
|
+
var lastequality = null;
|
|
345
|
+
var pointer4 = 0;
|
|
346
|
+
var length_insertions1 = 0;
|
|
347
|
+
var length_deletions1 = 0;
|
|
348
|
+
var length_insertions2 = 0;
|
|
349
|
+
var length_deletions2 = 0;
|
|
350
|
+
while (pointer4 < diffs.length) {
|
|
351
|
+
if (diffs[pointer4][0] == DIFF_EQUAL) {
|
|
352
|
+
equalities[equalitiesLength++] = pointer4;
|
|
353
|
+
length_insertions1 = length_insertions2;
|
|
354
|
+
length_deletions1 = length_deletions2;
|
|
355
|
+
length_insertions2 = 0;
|
|
356
|
+
length_deletions2 = 0;
|
|
357
|
+
lastequality = diffs[pointer4][1];
|
|
358
|
+
} else {
|
|
359
|
+
if (diffs[pointer4][0] == DIFF_INSERT) {
|
|
360
|
+
length_insertions2 += diffs[pointer4][1].length;
|
|
361
|
+
} else {
|
|
362
|
+
length_deletions2 += diffs[pointer4][1].length;
|
|
363
|
+
}
|
|
364
|
+
if (lastequality && lastequality.length <= Math.max(length_insertions1, length_deletions1) && lastequality.length <= Math.max(length_insertions2, length_deletions2)) {
|
|
365
|
+
diffs.splice(equalities[equalitiesLength - 1], 0, [
|
|
366
|
+
DIFF_DELETE,
|
|
367
|
+
lastequality
|
|
368
|
+
]);
|
|
369
|
+
diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
|
|
370
|
+
equalitiesLength--;
|
|
371
|
+
equalitiesLength--;
|
|
372
|
+
pointer4 = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
|
|
373
|
+
length_insertions1 = 0;
|
|
374
|
+
length_deletions1 = 0;
|
|
375
|
+
length_insertions2 = 0;
|
|
376
|
+
length_deletions2 = 0;
|
|
377
|
+
lastequality = null;
|
|
378
|
+
changes = true;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
pointer4++;
|
|
382
|
+
}
|
|
383
|
+
if (changes) {
|
|
384
|
+
diff_cleanupMerge(diffs);
|
|
385
|
+
}
|
|
386
|
+
diff_cleanupSemanticLossless(diffs);
|
|
387
|
+
pointer4 = 1;
|
|
388
|
+
while (pointer4 < diffs.length) {
|
|
389
|
+
if (diffs[pointer4 - 1][0] == DIFF_DELETE && diffs[pointer4][0] == DIFF_INSERT) {
|
|
390
|
+
var deletion = diffs[pointer4 - 1][1];
|
|
391
|
+
var insertion = diffs[pointer4][1];
|
|
392
|
+
var overlap_length1 = diff_commonOverlap_(deletion, insertion);
|
|
393
|
+
var overlap_length2 = diff_commonOverlap_(insertion, deletion);
|
|
394
|
+
if (overlap_length1 >= overlap_length2) {
|
|
395
|
+
if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) {
|
|
396
|
+
diffs.splice(pointer4, 0, [
|
|
397
|
+
DIFF_EQUAL,
|
|
398
|
+
insertion.substring(0, overlap_length1)
|
|
399
|
+
]);
|
|
400
|
+
diffs[pointer4 - 1][1] = deletion.substring(0, deletion.length - overlap_length1);
|
|
401
|
+
diffs[pointer4 + 1][1] = insertion.substring(overlap_length1);
|
|
402
|
+
pointer4++;
|
|
403
|
+
}
|
|
404
|
+
} else {
|
|
405
|
+
if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) {
|
|
406
|
+
diffs.splice(pointer4, 0, [
|
|
407
|
+
DIFF_EQUAL,
|
|
408
|
+
deletion.substring(0, overlap_length2)
|
|
409
|
+
]);
|
|
410
|
+
diffs[pointer4 - 1][0] = DIFF_INSERT;
|
|
411
|
+
diffs[pointer4 - 1][1] = insertion.substring(0, insertion.length - overlap_length2);
|
|
412
|
+
diffs[pointer4 + 1][0] = DIFF_DELETE;
|
|
413
|
+
diffs[pointer4 + 1][1] = deletion.substring(overlap_length2);
|
|
414
|
+
pointer4++;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
pointer4++;
|
|
418
|
+
}
|
|
419
|
+
pointer4++;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
var nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;
|
|
423
|
+
var whitespaceRegex_ = /\s/;
|
|
424
|
+
var linebreakRegex_ = /[\r\n]/;
|
|
425
|
+
var blanklineEndRegex_ = /\n\r?\n$/;
|
|
426
|
+
var blanklineStartRegex_ = /^\r?\n\r?\n/;
|
|
427
|
+
function diff_cleanupSemanticLossless(diffs) {
|
|
428
|
+
function diff_cleanupSemanticScore_(one, two) {
|
|
429
|
+
if (!one || !two) {
|
|
430
|
+
return 6;
|
|
431
|
+
}
|
|
432
|
+
var char1 = one.charAt(one.length - 1);
|
|
433
|
+
var char2 = two.charAt(0);
|
|
434
|
+
var nonAlphaNumeric1 = char1.match(nonAlphaNumericRegex_);
|
|
435
|
+
var nonAlphaNumeric2 = char2.match(nonAlphaNumericRegex_);
|
|
436
|
+
var whitespace1 = nonAlphaNumeric1 && char1.match(whitespaceRegex_);
|
|
437
|
+
var whitespace2 = nonAlphaNumeric2 && char2.match(whitespaceRegex_);
|
|
438
|
+
var lineBreak1 = whitespace1 && char1.match(linebreakRegex_);
|
|
439
|
+
var lineBreak2 = whitespace2 && char2.match(linebreakRegex_);
|
|
440
|
+
var blankLine1 = lineBreak1 && one.match(blanklineEndRegex_);
|
|
441
|
+
var blankLine2 = lineBreak2 && two.match(blanklineStartRegex_);
|
|
442
|
+
if (blankLine1 || blankLine2) {
|
|
443
|
+
return 5;
|
|
444
|
+
} else if (lineBreak1 || lineBreak2) {
|
|
445
|
+
return 4;
|
|
446
|
+
} else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
|
|
447
|
+
return 3;
|
|
448
|
+
} else if (whitespace1 || whitespace2) {
|
|
449
|
+
return 2;
|
|
450
|
+
} else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
|
|
451
|
+
return 1;
|
|
452
|
+
}
|
|
453
|
+
return 0;
|
|
454
|
+
}
|
|
455
|
+
var pointer4 = 1;
|
|
456
|
+
while (pointer4 < diffs.length - 1) {
|
|
457
|
+
if (diffs[pointer4 - 1][0] == DIFF_EQUAL && diffs[pointer4 + 1][0] == DIFF_EQUAL) {
|
|
458
|
+
var equality1 = diffs[pointer4 - 1][1];
|
|
459
|
+
var edit2 = diffs[pointer4][1];
|
|
460
|
+
var equality2 = diffs[pointer4 + 1][1];
|
|
461
|
+
var commonOffset = diff_commonSuffix(equality1, edit2);
|
|
462
|
+
if (commonOffset) {
|
|
463
|
+
var commonString = edit2.substring(edit2.length - commonOffset);
|
|
464
|
+
equality1 = equality1.substring(0, equality1.length - commonOffset);
|
|
465
|
+
edit2 = commonString + edit2.substring(0, edit2.length - commonOffset);
|
|
466
|
+
equality2 = commonString + equality2;
|
|
467
|
+
}
|
|
468
|
+
var bestEquality1 = equality1;
|
|
469
|
+
var bestEdit = edit2;
|
|
470
|
+
var bestEquality2 = equality2;
|
|
471
|
+
var bestScore = diff_cleanupSemanticScore_(equality1, edit2) + diff_cleanupSemanticScore_(edit2, equality2);
|
|
472
|
+
while (edit2.charAt(0) === equality2.charAt(0)) {
|
|
473
|
+
equality1 += edit2.charAt(0);
|
|
474
|
+
edit2 = edit2.substring(1) + equality2.charAt(0);
|
|
475
|
+
equality2 = equality2.substring(1);
|
|
476
|
+
var score = diff_cleanupSemanticScore_(equality1, edit2) + diff_cleanupSemanticScore_(edit2, equality2);
|
|
477
|
+
if (score >= bestScore) {
|
|
478
|
+
bestScore = score;
|
|
479
|
+
bestEquality1 = equality1;
|
|
480
|
+
bestEdit = edit2;
|
|
481
|
+
bestEquality2 = equality2;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
if (diffs[pointer4 - 1][1] != bestEquality1) {
|
|
485
|
+
if (bestEquality1) {
|
|
486
|
+
diffs[pointer4 - 1][1] = bestEquality1;
|
|
487
|
+
} else {
|
|
488
|
+
diffs.splice(pointer4 - 1, 1);
|
|
489
|
+
pointer4--;
|
|
490
|
+
}
|
|
491
|
+
diffs[pointer4][1] = bestEdit;
|
|
492
|
+
if (bestEquality2) {
|
|
493
|
+
diffs[pointer4 + 1][1] = bestEquality2;
|
|
494
|
+
} else {
|
|
495
|
+
diffs.splice(pointer4 + 1, 1);
|
|
496
|
+
pointer4--;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
pointer4++;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
function diff_cleanupMerge(diffs, fix_unicode) {
|
|
504
|
+
diffs.push([DIFF_EQUAL, ""]);
|
|
505
|
+
var pointer4 = 0;
|
|
506
|
+
var count_delete = 0;
|
|
507
|
+
var count_insert = 0;
|
|
508
|
+
var text_delete = "";
|
|
509
|
+
var text_insert = "";
|
|
510
|
+
var commonlength;
|
|
511
|
+
while (pointer4 < diffs.length) {
|
|
512
|
+
if (pointer4 < diffs.length - 1 && !diffs[pointer4][1]) {
|
|
513
|
+
diffs.splice(pointer4, 1);
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
switch (diffs[pointer4][0]) {
|
|
517
|
+
case DIFF_INSERT:
|
|
518
|
+
count_insert++;
|
|
519
|
+
text_insert += diffs[pointer4][1];
|
|
520
|
+
pointer4++;
|
|
521
|
+
break;
|
|
522
|
+
case DIFF_DELETE:
|
|
523
|
+
count_delete++;
|
|
524
|
+
text_delete += diffs[pointer4][1];
|
|
525
|
+
pointer4++;
|
|
526
|
+
break;
|
|
527
|
+
case DIFF_EQUAL:
|
|
528
|
+
var previous_equality = pointer4 - count_insert - count_delete - 1;
|
|
529
|
+
if (fix_unicode) {
|
|
530
|
+
if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) {
|
|
531
|
+
var stray = diffs[previous_equality][1].slice(-1);
|
|
532
|
+
diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1);
|
|
533
|
+
text_delete = stray + text_delete;
|
|
534
|
+
text_insert = stray + text_insert;
|
|
535
|
+
if (!diffs[previous_equality][1]) {
|
|
536
|
+
diffs.splice(previous_equality, 1);
|
|
537
|
+
pointer4--;
|
|
538
|
+
var k2 = previous_equality - 1;
|
|
539
|
+
if (diffs[k2] && diffs[k2][0] === DIFF_INSERT) {
|
|
540
|
+
count_insert++;
|
|
541
|
+
text_insert = diffs[k2][1] + text_insert;
|
|
542
|
+
k2--;
|
|
543
|
+
}
|
|
544
|
+
if (diffs[k2] && diffs[k2][0] === DIFF_DELETE) {
|
|
545
|
+
count_delete++;
|
|
546
|
+
text_delete = diffs[k2][1] + text_delete;
|
|
547
|
+
k2--;
|
|
548
|
+
}
|
|
549
|
+
previous_equality = k2;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if (starts_with_pair_end(diffs[pointer4][1])) {
|
|
553
|
+
var stray = diffs[pointer4][1].charAt(0);
|
|
554
|
+
diffs[pointer4][1] = diffs[pointer4][1].slice(1);
|
|
555
|
+
text_delete += stray;
|
|
556
|
+
text_insert += stray;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (pointer4 < diffs.length - 1 && !diffs[pointer4][1]) {
|
|
560
|
+
diffs.splice(pointer4, 1);
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
if (text_delete.length > 0 || text_insert.length > 0) {
|
|
564
|
+
if (text_delete.length > 0 && text_insert.length > 0) {
|
|
565
|
+
commonlength = diff_commonPrefix(text_insert, text_delete);
|
|
566
|
+
if (commonlength !== 0) {
|
|
567
|
+
if (previous_equality >= 0) {
|
|
568
|
+
diffs[previous_equality][1] += text_insert.substring(0, commonlength);
|
|
569
|
+
} else {
|
|
570
|
+
diffs.splice(0, 0, [
|
|
571
|
+
DIFF_EQUAL,
|
|
572
|
+
text_insert.substring(0, commonlength)
|
|
573
|
+
]);
|
|
574
|
+
pointer4++;
|
|
575
|
+
}
|
|
576
|
+
text_insert = text_insert.substring(commonlength);
|
|
577
|
+
text_delete = text_delete.substring(commonlength);
|
|
578
|
+
}
|
|
579
|
+
commonlength = diff_commonSuffix(text_insert, text_delete);
|
|
580
|
+
if (commonlength !== 0) {
|
|
581
|
+
diffs[pointer4][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer4][1];
|
|
582
|
+
text_insert = text_insert.substring(0, text_insert.length - commonlength);
|
|
583
|
+
text_delete = text_delete.substring(0, text_delete.length - commonlength);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
var n = count_insert + count_delete;
|
|
587
|
+
if (text_delete.length === 0 && text_insert.length === 0) {
|
|
588
|
+
diffs.splice(pointer4 - n, n);
|
|
589
|
+
pointer4 = pointer4 - n;
|
|
590
|
+
} else if (text_delete.length === 0) {
|
|
591
|
+
diffs.splice(pointer4 - n, n, [DIFF_INSERT, text_insert]);
|
|
592
|
+
pointer4 = pointer4 - n + 1;
|
|
593
|
+
} else if (text_insert.length === 0) {
|
|
594
|
+
diffs.splice(pointer4 - n, n, [DIFF_DELETE, text_delete]);
|
|
595
|
+
pointer4 = pointer4 - n + 1;
|
|
596
|
+
} else {
|
|
597
|
+
diffs.splice(pointer4 - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]);
|
|
598
|
+
pointer4 = pointer4 - n + 2;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
if (pointer4 !== 0 && diffs[pointer4 - 1][0] === DIFF_EQUAL) {
|
|
602
|
+
diffs[pointer4 - 1][1] += diffs[pointer4][1];
|
|
603
|
+
diffs.splice(pointer4, 1);
|
|
604
|
+
} else {
|
|
605
|
+
pointer4++;
|
|
606
|
+
}
|
|
607
|
+
count_insert = 0;
|
|
608
|
+
count_delete = 0;
|
|
609
|
+
text_delete = "";
|
|
610
|
+
text_insert = "";
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
if (diffs[diffs.length - 1][1] === "") {
|
|
615
|
+
diffs.pop();
|
|
616
|
+
}
|
|
617
|
+
var changes = false;
|
|
618
|
+
pointer4 = 1;
|
|
619
|
+
while (pointer4 < diffs.length - 1) {
|
|
620
|
+
if (diffs[pointer4 - 1][0] === DIFF_EQUAL && diffs[pointer4 + 1][0] === DIFF_EQUAL) {
|
|
621
|
+
if (diffs[pointer4][1].substring(diffs[pointer4][1].length - diffs[pointer4 - 1][1].length) === diffs[pointer4 - 1][1]) {
|
|
622
|
+
diffs[pointer4][1] = diffs[pointer4 - 1][1] + diffs[pointer4][1].substring(0, diffs[pointer4][1].length - diffs[pointer4 - 1][1].length);
|
|
623
|
+
diffs[pointer4 + 1][1] = diffs[pointer4 - 1][1] + diffs[pointer4 + 1][1];
|
|
624
|
+
diffs.splice(pointer4 - 1, 1);
|
|
625
|
+
changes = true;
|
|
626
|
+
} else if (diffs[pointer4][1].substring(0, diffs[pointer4 + 1][1].length) == diffs[pointer4 + 1][1]) {
|
|
627
|
+
diffs[pointer4 - 1][1] += diffs[pointer4 + 1][1];
|
|
628
|
+
diffs[pointer4][1] = diffs[pointer4][1].substring(diffs[pointer4 + 1][1].length) + diffs[pointer4 + 1][1];
|
|
629
|
+
diffs.splice(pointer4 + 1, 1);
|
|
630
|
+
changes = true;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
pointer4++;
|
|
634
|
+
}
|
|
635
|
+
if (changes) {
|
|
636
|
+
diff_cleanupMerge(diffs, fix_unicode);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
function is_surrogate_pair_start(charCode) {
|
|
640
|
+
return charCode >= 55296 && charCode <= 56319;
|
|
641
|
+
}
|
|
642
|
+
function is_surrogate_pair_end(charCode) {
|
|
643
|
+
return charCode >= 56320 && charCode <= 57343;
|
|
644
|
+
}
|
|
645
|
+
function starts_with_pair_end(str) {
|
|
646
|
+
return is_surrogate_pair_end(str.charCodeAt(0));
|
|
647
|
+
}
|
|
648
|
+
function ends_with_pair_start(str) {
|
|
649
|
+
return is_surrogate_pair_start(str.charCodeAt(str.length - 1));
|
|
650
|
+
}
|
|
651
|
+
function remove_empty_tuples(tuples) {
|
|
652
|
+
var ret = [];
|
|
653
|
+
for (var i = 0;i < tuples.length; i++) {
|
|
654
|
+
if (tuples[i][1].length > 0) {
|
|
655
|
+
ret.push(tuples[i]);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
return ret;
|
|
659
|
+
}
|
|
660
|
+
function make_edit_splice(before, oldMiddle, newMiddle, after) {
|
|
661
|
+
if (ends_with_pair_start(before) || starts_with_pair_end(after)) {
|
|
662
|
+
return null;
|
|
663
|
+
}
|
|
664
|
+
return remove_empty_tuples([
|
|
665
|
+
[DIFF_EQUAL, before],
|
|
666
|
+
[DIFF_DELETE, oldMiddle],
|
|
667
|
+
[DIFF_INSERT, newMiddle],
|
|
668
|
+
[DIFF_EQUAL, after]
|
|
669
|
+
]);
|
|
670
|
+
}
|
|
671
|
+
function find_cursor_edit_diff(oldText, newText, cursor_pos) {
|
|
672
|
+
var oldRange = typeof cursor_pos === "number" ? { index: cursor_pos, length: 0 } : cursor_pos.oldRange;
|
|
673
|
+
var newRange = typeof cursor_pos === "number" ? null : cursor_pos.newRange;
|
|
674
|
+
var oldLength = oldText.length;
|
|
675
|
+
var newLength = newText.length;
|
|
676
|
+
if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) {
|
|
677
|
+
var oldCursor = oldRange.index;
|
|
678
|
+
var oldBefore = oldText.slice(0, oldCursor);
|
|
679
|
+
var oldAfter = oldText.slice(oldCursor);
|
|
680
|
+
var maybeNewCursor = newRange ? newRange.index : null;
|
|
681
|
+
editBefore: {
|
|
682
|
+
var newCursor = oldCursor + newLength - oldLength;
|
|
683
|
+
if (maybeNewCursor !== null && maybeNewCursor !== newCursor) {
|
|
684
|
+
break editBefore;
|
|
685
|
+
}
|
|
686
|
+
if (newCursor < 0 || newCursor > newLength) {
|
|
687
|
+
break editBefore;
|
|
688
|
+
}
|
|
689
|
+
var newBefore = newText.slice(0, newCursor);
|
|
690
|
+
var newAfter = newText.slice(newCursor);
|
|
691
|
+
if (newAfter !== oldAfter) {
|
|
692
|
+
break editBefore;
|
|
693
|
+
}
|
|
694
|
+
var prefixLength = Math.min(oldCursor, newCursor);
|
|
695
|
+
var oldPrefix = oldBefore.slice(0, prefixLength);
|
|
696
|
+
var newPrefix = newBefore.slice(0, prefixLength);
|
|
697
|
+
if (oldPrefix !== newPrefix) {
|
|
698
|
+
break editBefore;
|
|
699
|
+
}
|
|
700
|
+
var oldMiddle = oldBefore.slice(prefixLength);
|
|
701
|
+
var newMiddle = newBefore.slice(prefixLength);
|
|
702
|
+
return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter);
|
|
703
|
+
}
|
|
704
|
+
editAfter: {
|
|
705
|
+
if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) {
|
|
706
|
+
break editAfter;
|
|
707
|
+
}
|
|
708
|
+
var cursor = oldCursor;
|
|
709
|
+
var newBefore = newText.slice(0, cursor);
|
|
710
|
+
var newAfter = newText.slice(cursor);
|
|
711
|
+
if (newBefore !== oldBefore) {
|
|
712
|
+
break editAfter;
|
|
713
|
+
}
|
|
714
|
+
var suffixLength = Math.min(oldLength - cursor, newLength - cursor);
|
|
715
|
+
var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength);
|
|
716
|
+
var newSuffix = newAfter.slice(newAfter.length - suffixLength);
|
|
717
|
+
if (oldSuffix !== newSuffix) {
|
|
718
|
+
break editAfter;
|
|
719
|
+
}
|
|
720
|
+
var oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength);
|
|
721
|
+
var newMiddle = newAfter.slice(0, newAfter.length - suffixLength);
|
|
722
|
+
return make_edit_splice(oldBefore, oldMiddle, newMiddle, oldSuffix);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
if (oldRange.length > 0 && newRange && newRange.length === 0) {
|
|
726
|
+
replaceRange: {
|
|
727
|
+
var oldPrefix = oldText.slice(0, oldRange.index);
|
|
728
|
+
var oldSuffix = oldText.slice(oldRange.index + oldRange.length);
|
|
729
|
+
var prefixLength = oldPrefix.length;
|
|
730
|
+
var suffixLength = oldSuffix.length;
|
|
731
|
+
if (newLength < prefixLength + suffixLength) {
|
|
732
|
+
break replaceRange;
|
|
733
|
+
}
|
|
734
|
+
var newPrefix = newText.slice(0, prefixLength);
|
|
735
|
+
var newSuffix = newText.slice(newLength - suffixLength);
|
|
736
|
+
if (oldPrefix !== newPrefix || oldSuffix !== newSuffix) {
|
|
737
|
+
break replaceRange;
|
|
738
|
+
}
|
|
739
|
+
var oldMiddle = oldText.slice(prefixLength, oldLength - suffixLength);
|
|
740
|
+
var newMiddle = newText.slice(prefixLength, newLength - suffixLength);
|
|
741
|
+
return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldSuffix);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
function diff2(text1, text2, cursor_pos, cleanup) {
|
|
747
|
+
return diff_main(text1, text2, cursor_pos, cleanup, true);
|
|
748
|
+
}
|
|
749
|
+
diff2.INSERT = DIFF_INSERT;
|
|
750
|
+
diff2.DELETE = DIFF_DELETE;
|
|
751
|
+
diff2.EQUAL = DIFF_EQUAL;
|
|
752
|
+
module3.exports = diff2;
|
|
753
|
+
});
|
|
754
|
+
|
|
31
755
|
// node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs
|
|
32
756
|
var require_eslint_visitor_keys = __commonJS((exports) => {
|
|
33
757
|
var KEYS = {
|
|
@@ -7478,124 +8202,919 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
7478
8202
|
__exportStar(require_variable(), exports);
|
|
7479
8203
|
});
|
|
7480
8204
|
|
|
7481
|
-
//
|
|
7482
|
-
|
|
8205
|
+
// node_modules/@oxc-resolver/binding-linux-x64-musl/resolver.linux-x64-musl.node
|
|
8206
|
+
var require_resolver_linux_x64_musl = __commonJS((exports, module3) => {
|
|
8207
|
+
module3.exports = __require("./resolver.linux-x64-musl-gnkc267h.node");
|
|
8208
|
+
});
|
|
7483
8209
|
|
|
7484
|
-
// node_modules/
|
|
7485
|
-
var
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
8210
|
+
// node_modules/@oxc-resolver/binding-linux-x64-musl/package.json
|
|
8211
|
+
var require_package = __commonJS((exports, module3) => {
|
|
8212
|
+
module3.exports = {
|
|
8213
|
+
name: "@oxc-resolver/binding-linux-x64-musl",
|
|
8214
|
+
version: "11.16.0",
|
|
8215
|
+
cpu: [
|
|
8216
|
+
"x64"
|
|
8217
|
+
],
|
|
8218
|
+
main: "resolver.linux-x64-musl.node",
|
|
8219
|
+
files: [
|
|
8220
|
+
"resolver.linux-x64-musl.node"
|
|
8221
|
+
],
|
|
8222
|
+
description: "Oxc Resolver Node API",
|
|
8223
|
+
homepage: "https://oxc.rs",
|
|
8224
|
+
license: "MIT",
|
|
8225
|
+
repository: {
|
|
8226
|
+
type: "git",
|
|
8227
|
+
url: "git+https://github.com/oxc-project/oxc-resolver.git"
|
|
8228
|
+
},
|
|
8229
|
+
publishConfig: {
|
|
8230
|
+
registry: "https://registry.npmjs.org/",
|
|
8231
|
+
access: "public"
|
|
8232
|
+
},
|
|
8233
|
+
os: [
|
|
8234
|
+
"linux"
|
|
8235
|
+
],
|
|
8236
|
+
libc: [
|
|
8237
|
+
"musl"
|
|
8238
|
+
]
|
|
8239
|
+
};
|
|
7493
8240
|
});
|
|
7494
8241
|
|
|
7495
|
-
// node_modules/
|
|
7496
|
-
var
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
clone: 0,
|
|
7500
|
-
discard: 0,
|
|
7501
|
-
update: 0
|
|
7502
|
-
};
|
|
8242
|
+
// node_modules/@oxc-resolver/binding-linux-x64-gnu/resolver.linux-x64-gnu.node
|
|
8243
|
+
var require_resolver_linux_x64_gnu = __commonJS((exports, module3) => {
|
|
8244
|
+
module3.exports = __require("./resolver.linux-x64-gnu-hcjn12y1.node");
|
|
8245
|
+
});
|
|
7503
8246
|
|
|
7504
|
-
// node_modules/
|
|
7505
|
-
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
IsIterator: () => IsIterator2,
|
|
7535
|
-
IsInteger: () => IsInteger2,
|
|
7536
|
-
IsGreaterThan: () => IsGreaterThan2,
|
|
7537
|
-
IsGreaterEqualThan: () => IsGreaterEqualThan2,
|
|
7538
|
-
IsFunction: () => IsFunction2,
|
|
7539
|
-
IsEqual: () => IsEqual2,
|
|
7540
|
-
IsDeepEqual: () => IsDeepEqual2,
|
|
7541
|
-
IsConstructor: () => IsConstructor2,
|
|
7542
|
-
IsBoolean: () => IsBoolean2,
|
|
7543
|
-
IsBigInt: () => IsBigInt2,
|
|
7544
|
-
IsAsyncIterator: () => IsAsyncIterator2,
|
|
7545
|
-
IsArray: () => IsArray2,
|
|
7546
|
-
If: () => If,
|
|
7547
|
-
HasPropertyKey: () => HasPropertyKey2,
|
|
7548
|
-
Every: () => Every2,
|
|
7549
|
-
Entries: () => Entries2,
|
|
7550
|
-
Constant: () => Constant,
|
|
7551
|
-
ConstDeclaration: () => ConstDeclaration,
|
|
7552
|
-
Call: () => Call,
|
|
7553
|
-
ArrowFunction: () => ArrowFunction,
|
|
7554
|
-
ArrayLiteral: () => ArrayLiteral,
|
|
7555
|
-
And: () => And
|
|
8247
|
+
// node_modules/@oxc-resolver/binding-linux-x64-gnu/package.json
|
|
8248
|
+
var require_package2 = __commonJS((exports, module3) => {
|
|
8249
|
+
module3.exports = {
|
|
8250
|
+
name: "@oxc-resolver/binding-linux-x64-gnu",
|
|
8251
|
+
version: "11.16.0",
|
|
8252
|
+
cpu: [
|
|
8253
|
+
"x64"
|
|
8254
|
+
],
|
|
8255
|
+
main: "resolver.linux-x64-gnu.node",
|
|
8256
|
+
files: [
|
|
8257
|
+
"resolver.linux-x64-gnu.node"
|
|
8258
|
+
],
|
|
8259
|
+
description: "Oxc Resolver Node API",
|
|
8260
|
+
homepage: "https://oxc.rs",
|
|
8261
|
+
license: "MIT",
|
|
8262
|
+
repository: {
|
|
8263
|
+
type: "git",
|
|
8264
|
+
url: "git+https://github.com/oxc-project/oxc-resolver.git"
|
|
8265
|
+
},
|
|
8266
|
+
publishConfig: {
|
|
8267
|
+
registry: "https://registry.npmjs.org/",
|
|
8268
|
+
access: "public"
|
|
8269
|
+
},
|
|
8270
|
+
os: [
|
|
8271
|
+
"linux"
|
|
8272
|
+
],
|
|
8273
|
+
libc: [
|
|
8274
|
+
"glibc"
|
|
8275
|
+
]
|
|
8276
|
+
};
|
|
7556
8277
|
});
|
|
7557
8278
|
|
|
7558
|
-
// node_modules/
|
|
7559
|
-
var
|
|
7560
|
-
__export(
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
IsGreaterThan: () => IsGreaterThan,
|
|
7579
|
-
IsGreaterEqualThan: () => IsGreaterEqualThan,
|
|
7580
|
-
IsFunction: () => IsFunction,
|
|
7581
|
-
IsEqual: () => IsEqual,
|
|
7582
|
-
IsDeepEqual: () => IsDeepEqual,
|
|
7583
|
-
IsConstructor: () => IsConstructor,
|
|
7584
|
-
IsClassInstance: () => IsClassInstance,
|
|
7585
|
-
IsBoolean: () => IsBoolean,
|
|
7586
|
-
IsBigInt: () => IsBigInt,
|
|
7587
|
-
IsAsyncIterator: () => IsAsyncIterator,
|
|
7588
|
-
IsArray: () => IsArray,
|
|
7589
|
-
HasPropertyKey: () => HasPropertyKey,
|
|
7590
|
-
EveryAll: () => EveryAll,
|
|
7591
|
-
Every: () => Every,
|
|
7592
|
-
EntriesRegExp: () => EntriesRegExp,
|
|
7593
|
-
Entries: () => Entries
|
|
8279
|
+
// node_modules/oxc-resolver/package.json
|
|
8280
|
+
var exports_package = {};
|
|
8281
|
+
__export(exports_package, {
|
|
8282
|
+
version: () => version,
|
|
8283
|
+
scripts: () => scripts,
|
|
8284
|
+
repository: () => repository,
|
|
8285
|
+
publishConfig: () => publishConfig,
|
|
8286
|
+
packageManager: () => packageManager,
|
|
8287
|
+
optionalDependencies: () => optionalDependencies,
|
|
8288
|
+
napi: () => napi,
|
|
8289
|
+
name: () => name,
|
|
8290
|
+
main: () => main,
|
|
8291
|
+
license: () => license,
|
|
8292
|
+
homepage: () => homepage,
|
|
8293
|
+
funding: () => funding,
|
|
8294
|
+
files: () => files,
|
|
8295
|
+
devDependencies: () => devDependencies,
|
|
8296
|
+
description: () => description,
|
|
8297
|
+
default: () => package_default,
|
|
8298
|
+
browser: () => browser
|
|
7594
8299
|
});
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
8300
|
+
var name = "oxc-resolver", version = "11.16.0", description = "Oxc Resolver Node API", homepage = "https://oxc.rs", repository, funding, license = "MIT", main = "index.js", browser = "browser.js", files, scripts, devDependencies, napi, packageManager = "pnpm@10.25.0", publishConfig, optionalDependencies, package_default;
|
|
8301
|
+
var init_package = __esm(() => {
|
|
8302
|
+
repository = {
|
|
8303
|
+
type: "git",
|
|
8304
|
+
url: "git+https://github.com/oxc-project/oxc-resolver.git"
|
|
8305
|
+
};
|
|
8306
|
+
funding = {
|
|
8307
|
+
url: "https://github.com/sponsors/Boshen"
|
|
8308
|
+
};
|
|
8309
|
+
files = [
|
|
8310
|
+
"browser.js",
|
|
8311
|
+
"index.d.ts",
|
|
8312
|
+
"index.js",
|
|
8313
|
+
"webcontainer-fallback.js"
|
|
8314
|
+
];
|
|
8315
|
+
scripts = {
|
|
8316
|
+
test: "vitest run -r ./napi",
|
|
8317
|
+
"build:debug": "napi build --platform --manifest-path napi/Cargo.toml",
|
|
8318
|
+
build: "pnpm run build:debug --features allocator --release",
|
|
8319
|
+
"postbuild:debug": "node napi/patch.mjs",
|
|
8320
|
+
fmt: "oxfmt"
|
|
8321
|
+
};
|
|
8322
|
+
devDependencies = {
|
|
8323
|
+
"@napi-rs/cli": "^3.3.1",
|
|
8324
|
+
"@napi-rs/wasm-runtime": "^1.0.7",
|
|
8325
|
+
"@types/node": "^25.0.0",
|
|
8326
|
+
emnapi: "^1.6.0",
|
|
8327
|
+
oxfmt: "^0.18.0",
|
|
8328
|
+
typescript: "^5.9.3",
|
|
8329
|
+
vitest: "^4.0.0"
|
|
8330
|
+
};
|
|
8331
|
+
napi = {
|
|
8332
|
+
binaryName: "resolver",
|
|
8333
|
+
packageName: "@oxc-resolver/binding",
|
|
8334
|
+
targets: [
|
|
8335
|
+
"aarch64-apple-darwin",
|
|
8336
|
+
"aarch64-linux-android",
|
|
8337
|
+
"aarch64-pc-windows-msvc",
|
|
8338
|
+
"aarch64-unknown-linux-gnu",
|
|
8339
|
+
"aarch64-unknown-linux-musl",
|
|
8340
|
+
"aarch64-unknown-linux-ohos",
|
|
8341
|
+
"armv7-linux-androideabi",
|
|
8342
|
+
"armv7-unknown-linux-gnueabihf",
|
|
8343
|
+
"armv7-unknown-linux-musleabihf",
|
|
8344
|
+
"i686-pc-windows-msvc",
|
|
8345
|
+
"powerpc64le-unknown-linux-gnu",
|
|
8346
|
+
"riscv64gc-unknown-linux-gnu",
|
|
8347
|
+
"riscv64gc-unknown-linux-musl",
|
|
8348
|
+
"s390x-unknown-linux-gnu",
|
|
8349
|
+
"wasm32-wasip1-threads",
|
|
8350
|
+
"x86_64-apple-darwin",
|
|
8351
|
+
"x86_64-pc-windows-msvc",
|
|
8352
|
+
"x86_64-unknown-freebsd",
|
|
8353
|
+
"x86_64-unknown-linux-gnu",
|
|
8354
|
+
"x86_64-unknown-linux-musl"
|
|
8355
|
+
],
|
|
8356
|
+
wasm: {
|
|
8357
|
+
browser: {
|
|
8358
|
+
fs: true
|
|
8359
|
+
}
|
|
8360
|
+
}
|
|
8361
|
+
};
|
|
8362
|
+
publishConfig = {
|
|
8363
|
+
access: "public",
|
|
8364
|
+
registry: "https://registry.npmjs.org/"
|
|
8365
|
+
};
|
|
8366
|
+
optionalDependencies = {
|
|
8367
|
+
"@oxc-resolver/binding-darwin-arm64": "11.16.0",
|
|
8368
|
+
"@oxc-resolver/binding-android-arm64": "11.16.0",
|
|
8369
|
+
"@oxc-resolver/binding-win32-arm64-msvc": "11.16.0",
|
|
8370
|
+
"@oxc-resolver/binding-linux-arm64-gnu": "11.16.0",
|
|
8371
|
+
"@oxc-resolver/binding-linux-arm64-musl": "11.16.0",
|
|
8372
|
+
"@oxc-resolver/binding-openharmony-arm64": "11.16.0",
|
|
8373
|
+
"@oxc-resolver/binding-android-arm-eabi": "11.16.0",
|
|
8374
|
+
"@oxc-resolver/binding-linux-arm-gnueabihf": "11.16.0",
|
|
8375
|
+
"@oxc-resolver/binding-linux-arm-musleabihf": "11.16.0",
|
|
8376
|
+
"@oxc-resolver/binding-win32-ia32-msvc": "11.16.0",
|
|
8377
|
+
"@oxc-resolver/binding-linux-ppc64-gnu": "11.16.0",
|
|
8378
|
+
"@oxc-resolver/binding-linux-riscv64-gnu": "11.16.0",
|
|
8379
|
+
"@oxc-resolver/binding-linux-riscv64-musl": "11.16.0",
|
|
8380
|
+
"@oxc-resolver/binding-linux-s390x-gnu": "11.16.0",
|
|
8381
|
+
"@oxc-resolver/binding-wasm32-wasi": "11.16.0",
|
|
8382
|
+
"@oxc-resolver/binding-darwin-x64": "11.16.0",
|
|
8383
|
+
"@oxc-resolver/binding-win32-x64-msvc": "11.16.0",
|
|
8384
|
+
"@oxc-resolver/binding-freebsd-x64": "11.16.0",
|
|
8385
|
+
"@oxc-resolver/binding-linux-x64-gnu": "11.16.0",
|
|
8386
|
+
"@oxc-resolver/binding-linux-x64-musl": "11.16.0"
|
|
8387
|
+
};
|
|
8388
|
+
package_default = {
|
|
8389
|
+
name,
|
|
8390
|
+
version,
|
|
8391
|
+
description,
|
|
8392
|
+
homepage,
|
|
8393
|
+
repository,
|
|
8394
|
+
funding,
|
|
8395
|
+
license,
|
|
8396
|
+
main,
|
|
8397
|
+
browser,
|
|
8398
|
+
files,
|
|
8399
|
+
scripts,
|
|
8400
|
+
devDependencies,
|
|
8401
|
+
napi,
|
|
8402
|
+
packageManager,
|
|
8403
|
+
publishConfig,
|
|
8404
|
+
optionalDependencies
|
|
8405
|
+
};
|
|
8406
|
+
});
|
|
8407
|
+
|
|
8408
|
+
// node_modules/oxc-resolver/webcontainer-fallback.js
|
|
8409
|
+
var require_webcontainer_fallback = __commonJS((exports, module3) => {
|
|
8410
|
+
var fs = __require("node:fs");
|
|
8411
|
+
var childProcess = __require("node:child_process");
|
|
8412
|
+
var pkg = JSON.parse(fs.readFileSync(__require.resolve("/home/runner/work/eslint-cease-nonsense-rules/eslint-cease-nonsense-rules/node_modules/oxc-resolver/package.json"), "utf-8"));
|
|
8413
|
+
var version2 = pkg.version;
|
|
8414
|
+
var baseDir = `/tmp/oxc-resolver-${version2}`;
|
|
8415
|
+
var bindingEntry = `${baseDir}/node_modules/@oxc-resolver/binding-wasm32-wasi/resolver.wasi.cjs`;
|
|
8416
|
+
if (!fs.existsSync(bindingEntry)) {
|
|
8417
|
+
fs.rmSync(baseDir, { recursive: true, force: true });
|
|
8418
|
+
fs.mkdirSync(baseDir, { recursive: true });
|
|
8419
|
+
const bindingPkg = `@oxc-resolver/binding-wasm32-wasi@${version2}`;
|
|
8420
|
+
console.log(`[oxc-resolver] Downloading ${bindingPkg} on WebContainer...`);
|
|
8421
|
+
childProcess.execFileSync("pnpm", ["i", bindingPkg], {
|
|
8422
|
+
cwd: baseDir,
|
|
8423
|
+
stdio: "inherit"
|
|
8424
|
+
});
|
|
8425
|
+
}
|
|
8426
|
+
module3.exports = __require(bindingEntry);
|
|
8427
|
+
});
|
|
8428
|
+
|
|
8429
|
+
// node_modules/oxc-resolver/index.js
|
|
8430
|
+
var require_oxc_resolver = __commonJS((exports, module3) => {
|
|
8431
|
+
var { readFileSync: readFileSync3 } = __require("node:fs");
|
|
8432
|
+
var nativeBinding2 = null;
|
|
8433
|
+
var loadErrors2 = [];
|
|
8434
|
+
var isMusl2 = () => {
|
|
8435
|
+
let musl = false;
|
|
8436
|
+
if (process.platform === "linux") {
|
|
8437
|
+
musl = isMuslFromFilesystem2();
|
|
8438
|
+
if (musl === null) {
|
|
8439
|
+
musl = isMuslFromReport2();
|
|
8440
|
+
}
|
|
8441
|
+
if (musl === null) {
|
|
8442
|
+
musl = isMuslFromChildProcess2();
|
|
8443
|
+
}
|
|
8444
|
+
}
|
|
8445
|
+
return musl;
|
|
8446
|
+
};
|
|
8447
|
+
var isFileMusl2 = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
8448
|
+
var isMuslFromFilesystem2 = () => {
|
|
8449
|
+
try {
|
|
8450
|
+
return readFileSync3("/usr/bin/ldd", "utf-8").includes("musl");
|
|
8451
|
+
} catch {
|
|
8452
|
+
return null;
|
|
8453
|
+
}
|
|
8454
|
+
};
|
|
8455
|
+
var isMuslFromReport2 = () => {
|
|
8456
|
+
let report = null;
|
|
8457
|
+
if (typeof process.report?.getReport === "function") {
|
|
8458
|
+
process.report.excludeNetwork = true;
|
|
8459
|
+
report = process.report.getReport();
|
|
8460
|
+
}
|
|
8461
|
+
if (!report) {
|
|
8462
|
+
return null;
|
|
8463
|
+
}
|
|
8464
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
8465
|
+
return false;
|
|
8466
|
+
}
|
|
8467
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
8468
|
+
if (report.sharedObjects.some(isFileMusl2)) {
|
|
8469
|
+
return true;
|
|
8470
|
+
}
|
|
8471
|
+
}
|
|
8472
|
+
return false;
|
|
8473
|
+
};
|
|
8474
|
+
var isMuslFromChildProcess2 = () => {
|
|
8475
|
+
try {
|
|
8476
|
+
return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
|
|
8477
|
+
} catch (e) {
|
|
8478
|
+
return false;
|
|
8479
|
+
}
|
|
8480
|
+
};
|
|
8481
|
+
function requireNative2() {
|
|
8482
|
+
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
8483
|
+
try {
|
|
8484
|
+
return __require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
8485
|
+
} catch (err) {
|
|
8486
|
+
loadErrors2.push(err);
|
|
8487
|
+
}
|
|
8488
|
+
} else if (process.platform === "android") {
|
|
8489
|
+
if (process.arch === "arm64") {
|
|
8490
|
+
try {
|
|
8491
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.android-arm64.node");})();
|
|
8492
|
+
} catch (e) {
|
|
8493
|
+
loadErrors2.push(e);
|
|
8494
|
+
}
|
|
8495
|
+
try {
|
|
8496
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-android-arm64");})();
|
|
8497
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-android-arm64/package.json");})().version;
|
|
8498
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8499
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8500
|
+
}
|
|
8501
|
+
return binding;
|
|
8502
|
+
} catch (e) {
|
|
8503
|
+
loadErrors2.push(e);
|
|
8504
|
+
}
|
|
8505
|
+
} else if (process.arch === "arm") {
|
|
8506
|
+
try {
|
|
8507
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.android-arm-eabi.node");})();
|
|
8508
|
+
} catch (e) {
|
|
8509
|
+
loadErrors2.push(e);
|
|
8510
|
+
}
|
|
8511
|
+
try {
|
|
8512
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-android-arm-eabi");})();
|
|
8513
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-android-arm-eabi/package.json");})().version;
|
|
8514
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8515
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8516
|
+
}
|
|
8517
|
+
return binding;
|
|
8518
|
+
} catch (e) {
|
|
8519
|
+
loadErrors2.push(e);
|
|
8520
|
+
}
|
|
8521
|
+
} else {
|
|
8522
|
+
loadErrors2.push(new Error(`Unsupported architecture on Android ${process.arch}`));
|
|
8523
|
+
}
|
|
8524
|
+
} else if (process.platform === "win32") {
|
|
8525
|
+
if (process.arch === "x64") {
|
|
8526
|
+
if (process.config?.variables?.shlib_suffix === "dll.a" || process.config?.variables?.node_target_type === "shared_library") {
|
|
8527
|
+
try {
|
|
8528
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.win32-x64-gnu.node");})();
|
|
8529
|
+
} catch (e) {
|
|
8530
|
+
loadErrors2.push(e);
|
|
8531
|
+
}
|
|
8532
|
+
try {
|
|
8533
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-x64-gnu");})();
|
|
8534
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-x64-gnu/package.json");})().version;
|
|
8535
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8536
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8537
|
+
}
|
|
8538
|
+
return binding;
|
|
8539
|
+
} catch (e) {
|
|
8540
|
+
loadErrors2.push(e);
|
|
8541
|
+
}
|
|
8542
|
+
} else {
|
|
8543
|
+
try {
|
|
8544
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.win32-x64-msvc.node");})();
|
|
8545
|
+
} catch (e) {
|
|
8546
|
+
loadErrors2.push(e);
|
|
8547
|
+
}
|
|
8548
|
+
try {
|
|
8549
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-x64-msvc");})();
|
|
8550
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-x64-msvc/package.json");})().version;
|
|
8551
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8552
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8553
|
+
}
|
|
8554
|
+
return binding;
|
|
8555
|
+
} catch (e) {
|
|
8556
|
+
loadErrors2.push(e);
|
|
8557
|
+
}
|
|
8558
|
+
}
|
|
8559
|
+
} else if (process.arch === "ia32") {
|
|
8560
|
+
try {
|
|
8561
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.win32-ia32-msvc.node");})();
|
|
8562
|
+
} catch (e) {
|
|
8563
|
+
loadErrors2.push(e);
|
|
8564
|
+
}
|
|
8565
|
+
try {
|
|
8566
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-ia32-msvc");})();
|
|
8567
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-ia32-msvc/package.json");})().version;
|
|
8568
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8569
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8570
|
+
}
|
|
8571
|
+
return binding;
|
|
8572
|
+
} catch (e) {
|
|
8573
|
+
loadErrors2.push(e);
|
|
8574
|
+
}
|
|
8575
|
+
} else if (process.arch === "arm64") {
|
|
8576
|
+
try {
|
|
8577
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.win32-arm64-msvc.node");})();
|
|
8578
|
+
} catch (e) {
|
|
8579
|
+
loadErrors2.push(e);
|
|
8580
|
+
}
|
|
8581
|
+
try {
|
|
8582
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-arm64-msvc");})();
|
|
8583
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-win32-arm64-msvc/package.json");})().version;
|
|
8584
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8585
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8586
|
+
}
|
|
8587
|
+
return binding;
|
|
8588
|
+
} catch (e) {
|
|
8589
|
+
loadErrors2.push(e);
|
|
8590
|
+
}
|
|
8591
|
+
} else {
|
|
8592
|
+
loadErrors2.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
|
|
8593
|
+
}
|
|
8594
|
+
} else if (process.platform === "darwin") {
|
|
8595
|
+
try {
|
|
8596
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.darwin-universal.node");})();
|
|
8597
|
+
} catch (e) {
|
|
8598
|
+
loadErrors2.push(e);
|
|
8599
|
+
}
|
|
8600
|
+
try {
|
|
8601
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-universal");})();
|
|
8602
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-universal/package.json");})().version;
|
|
8603
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8604
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8605
|
+
}
|
|
8606
|
+
return binding;
|
|
8607
|
+
} catch (e) {
|
|
8608
|
+
loadErrors2.push(e);
|
|
8609
|
+
}
|
|
8610
|
+
if (process.arch === "x64") {
|
|
8611
|
+
try {
|
|
8612
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.darwin-x64.node");})();
|
|
8613
|
+
} catch (e) {
|
|
8614
|
+
loadErrors2.push(e);
|
|
8615
|
+
}
|
|
8616
|
+
try {
|
|
8617
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-x64");})();
|
|
8618
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-x64/package.json");})().version;
|
|
8619
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8620
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8621
|
+
}
|
|
8622
|
+
return binding;
|
|
8623
|
+
} catch (e) {
|
|
8624
|
+
loadErrors2.push(e);
|
|
8625
|
+
}
|
|
8626
|
+
} else if (process.arch === "arm64") {
|
|
8627
|
+
try {
|
|
8628
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.darwin-arm64.node");})();
|
|
8629
|
+
} catch (e) {
|
|
8630
|
+
loadErrors2.push(e);
|
|
8631
|
+
}
|
|
8632
|
+
try {
|
|
8633
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-arm64");})();
|
|
8634
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-darwin-arm64/package.json");})().version;
|
|
8635
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8636
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8637
|
+
}
|
|
8638
|
+
return binding;
|
|
8639
|
+
} catch (e) {
|
|
8640
|
+
loadErrors2.push(e);
|
|
8641
|
+
}
|
|
8642
|
+
} else {
|
|
8643
|
+
loadErrors2.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
|
|
8644
|
+
}
|
|
8645
|
+
} else if (process.platform === "freebsd") {
|
|
8646
|
+
if (process.arch === "x64") {
|
|
8647
|
+
try {
|
|
8648
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.freebsd-x64.node");})();
|
|
8649
|
+
} catch (e) {
|
|
8650
|
+
loadErrors2.push(e);
|
|
8651
|
+
}
|
|
8652
|
+
try {
|
|
8653
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-freebsd-x64");})();
|
|
8654
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-freebsd-x64/package.json");})().version;
|
|
8655
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8656
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8657
|
+
}
|
|
8658
|
+
return binding;
|
|
8659
|
+
} catch (e) {
|
|
8660
|
+
loadErrors2.push(e);
|
|
8661
|
+
}
|
|
8662
|
+
} else if (process.arch === "arm64") {
|
|
8663
|
+
try {
|
|
8664
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.freebsd-arm64.node");})();
|
|
8665
|
+
} catch (e) {
|
|
8666
|
+
loadErrors2.push(e);
|
|
8667
|
+
}
|
|
8668
|
+
try {
|
|
8669
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-freebsd-arm64");})();
|
|
8670
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-freebsd-arm64/package.json");})().version;
|
|
8671
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8672
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8673
|
+
}
|
|
8674
|
+
return binding;
|
|
8675
|
+
} catch (e) {
|
|
8676
|
+
loadErrors2.push(e);
|
|
8677
|
+
}
|
|
8678
|
+
} else {
|
|
8679
|
+
loadErrors2.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
|
|
8680
|
+
}
|
|
8681
|
+
} else if (process.platform === "linux") {
|
|
8682
|
+
if (process.arch === "x64") {
|
|
8683
|
+
if (isMusl2()) {
|
|
8684
|
+
try {
|
|
8685
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-x64-musl.node");})();
|
|
8686
|
+
} catch (e) {
|
|
8687
|
+
loadErrors2.push(e);
|
|
8688
|
+
}
|
|
8689
|
+
try {
|
|
8690
|
+
const binding = require_resolver_linux_x64_musl();
|
|
8691
|
+
const bindingPackageVersion = require_package().version;
|
|
8692
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8693
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8694
|
+
}
|
|
8695
|
+
return binding;
|
|
8696
|
+
} catch (e) {
|
|
8697
|
+
loadErrors2.push(e);
|
|
8698
|
+
}
|
|
8699
|
+
} else {
|
|
8700
|
+
try {
|
|
8701
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-x64-gnu.node");})();
|
|
8702
|
+
} catch (e) {
|
|
8703
|
+
loadErrors2.push(e);
|
|
8704
|
+
}
|
|
8705
|
+
try {
|
|
8706
|
+
const binding = require_resolver_linux_x64_gnu();
|
|
8707
|
+
const bindingPackageVersion = require_package2().version;
|
|
8708
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8709
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8710
|
+
}
|
|
8711
|
+
return binding;
|
|
8712
|
+
} catch (e) {
|
|
8713
|
+
loadErrors2.push(e);
|
|
8714
|
+
}
|
|
8715
|
+
}
|
|
8716
|
+
} else if (process.arch === "arm64") {
|
|
8717
|
+
if (isMusl2()) {
|
|
8718
|
+
try {
|
|
8719
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-arm64-musl.node");})();
|
|
8720
|
+
} catch (e) {
|
|
8721
|
+
loadErrors2.push(e);
|
|
8722
|
+
}
|
|
8723
|
+
try {
|
|
8724
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm64-musl");})();
|
|
8725
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm64-musl/package.json");})().version;
|
|
8726
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8727
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8728
|
+
}
|
|
8729
|
+
return binding;
|
|
8730
|
+
} catch (e) {
|
|
8731
|
+
loadErrors2.push(e);
|
|
8732
|
+
}
|
|
8733
|
+
} else {
|
|
8734
|
+
try {
|
|
8735
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-arm64-gnu.node");})();
|
|
8736
|
+
} catch (e) {
|
|
8737
|
+
loadErrors2.push(e);
|
|
8738
|
+
}
|
|
8739
|
+
try {
|
|
8740
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm64-gnu");})();
|
|
8741
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm64-gnu/package.json");})().version;
|
|
8742
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8743
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8744
|
+
}
|
|
8745
|
+
return binding;
|
|
8746
|
+
} catch (e) {
|
|
8747
|
+
loadErrors2.push(e);
|
|
8748
|
+
}
|
|
8749
|
+
}
|
|
8750
|
+
} else if (process.arch === "arm") {
|
|
8751
|
+
if (isMusl2()) {
|
|
8752
|
+
try {
|
|
8753
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-arm-musleabihf.node");})();
|
|
8754
|
+
} catch (e) {
|
|
8755
|
+
loadErrors2.push(e);
|
|
8756
|
+
}
|
|
8757
|
+
try {
|
|
8758
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm-musleabihf");})();
|
|
8759
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm-musleabihf/package.json");})().version;
|
|
8760
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8761
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8762
|
+
}
|
|
8763
|
+
return binding;
|
|
8764
|
+
} catch (e) {
|
|
8765
|
+
loadErrors2.push(e);
|
|
8766
|
+
}
|
|
8767
|
+
} else {
|
|
8768
|
+
try {
|
|
8769
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-arm-gnueabihf.node");})();
|
|
8770
|
+
} catch (e) {
|
|
8771
|
+
loadErrors2.push(e);
|
|
8772
|
+
}
|
|
8773
|
+
try {
|
|
8774
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm-gnueabihf");})();
|
|
8775
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-arm-gnueabihf/package.json");})().version;
|
|
8776
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8777
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8778
|
+
}
|
|
8779
|
+
return binding;
|
|
8780
|
+
} catch (e) {
|
|
8781
|
+
loadErrors2.push(e);
|
|
8782
|
+
}
|
|
8783
|
+
}
|
|
8784
|
+
} else if (process.arch === "loong64") {
|
|
8785
|
+
if (isMusl2()) {
|
|
8786
|
+
try {
|
|
8787
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-loong64-musl.node");})();
|
|
8788
|
+
} catch (e) {
|
|
8789
|
+
loadErrors2.push(e);
|
|
8790
|
+
}
|
|
8791
|
+
try {
|
|
8792
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-loong64-musl");})();
|
|
8793
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-loong64-musl/package.json");})().version;
|
|
8794
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8795
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8796
|
+
}
|
|
8797
|
+
return binding;
|
|
8798
|
+
} catch (e) {
|
|
8799
|
+
loadErrors2.push(e);
|
|
8800
|
+
}
|
|
8801
|
+
} else {
|
|
8802
|
+
try {
|
|
8803
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-loong64-gnu.node");})();
|
|
8804
|
+
} catch (e) {
|
|
8805
|
+
loadErrors2.push(e);
|
|
8806
|
+
}
|
|
8807
|
+
try {
|
|
8808
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-loong64-gnu");})();
|
|
8809
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-loong64-gnu/package.json");})().version;
|
|
8810
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8811
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8812
|
+
}
|
|
8813
|
+
return binding;
|
|
8814
|
+
} catch (e) {
|
|
8815
|
+
loadErrors2.push(e);
|
|
8816
|
+
}
|
|
8817
|
+
}
|
|
8818
|
+
} else if (process.arch === "riscv64") {
|
|
8819
|
+
if (isMusl2()) {
|
|
8820
|
+
try {
|
|
8821
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-riscv64-musl.node");})();
|
|
8822
|
+
} catch (e) {
|
|
8823
|
+
loadErrors2.push(e);
|
|
8824
|
+
}
|
|
8825
|
+
try {
|
|
8826
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-riscv64-musl");})();
|
|
8827
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-riscv64-musl/package.json");})().version;
|
|
8828
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8829
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8830
|
+
}
|
|
8831
|
+
return binding;
|
|
8832
|
+
} catch (e) {
|
|
8833
|
+
loadErrors2.push(e);
|
|
8834
|
+
}
|
|
8835
|
+
} else {
|
|
8836
|
+
try {
|
|
8837
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-riscv64-gnu.node");})();
|
|
8838
|
+
} catch (e) {
|
|
8839
|
+
loadErrors2.push(e);
|
|
8840
|
+
}
|
|
8841
|
+
try {
|
|
8842
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-riscv64-gnu");})();
|
|
8843
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-riscv64-gnu/package.json");})().version;
|
|
8844
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8845
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8846
|
+
}
|
|
8847
|
+
return binding;
|
|
8848
|
+
} catch (e) {
|
|
8849
|
+
loadErrors2.push(e);
|
|
8850
|
+
}
|
|
8851
|
+
}
|
|
8852
|
+
} else if (process.arch === "ppc64") {
|
|
8853
|
+
try {
|
|
8854
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-ppc64-gnu.node");})();
|
|
8855
|
+
} catch (e) {
|
|
8856
|
+
loadErrors2.push(e);
|
|
8857
|
+
}
|
|
8858
|
+
try {
|
|
8859
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-ppc64-gnu");})();
|
|
8860
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-ppc64-gnu/package.json");})().version;
|
|
8861
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8862
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8863
|
+
}
|
|
8864
|
+
return binding;
|
|
8865
|
+
} catch (e) {
|
|
8866
|
+
loadErrors2.push(e);
|
|
8867
|
+
}
|
|
8868
|
+
} else if (process.arch === "s390x") {
|
|
8869
|
+
try {
|
|
8870
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.linux-s390x-gnu.node");})();
|
|
8871
|
+
} catch (e) {
|
|
8872
|
+
loadErrors2.push(e);
|
|
8873
|
+
}
|
|
8874
|
+
try {
|
|
8875
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-s390x-gnu");})();
|
|
8876
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-linux-s390x-gnu/package.json");})().version;
|
|
8877
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8878
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8879
|
+
}
|
|
8880
|
+
return binding;
|
|
8881
|
+
} catch (e) {
|
|
8882
|
+
loadErrors2.push(e);
|
|
8883
|
+
}
|
|
8884
|
+
} else {
|
|
8885
|
+
loadErrors2.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
|
|
8886
|
+
}
|
|
8887
|
+
} else if (process.platform === "openharmony") {
|
|
8888
|
+
if (process.arch === "arm64") {
|
|
8889
|
+
try {
|
|
8890
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.openharmony-arm64.node");})();
|
|
8891
|
+
} catch (e) {
|
|
8892
|
+
loadErrors2.push(e);
|
|
8893
|
+
}
|
|
8894
|
+
try {
|
|
8895
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-arm64");})();
|
|
8896
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-arm64/package.json");})().version;
|
|
8897
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8898
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8899
|
+
}
|
|
8900
|
+
return binding;
|
|
8901
|
+
} catch (e) {
|
|
8902
|
+
loadErrors2.push(e);
|
|
8903
|
+
}
|
|
8904
|
+
} else if (process.arch === "x64") {
|
|
8905
|
+
try {
|
|
8906
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.openharmony-x64.node");})();
|
|
8907
|
+
} catch (e) {
|
|
8908
|
+
loadErrors2.push(e);
|
|
8909
|
+
}
|
|
8910
|
+
try {
|
|
8911
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-x64");})();
|
|
8912
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-x64/package.json");})().version;
|
|
8913
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8914
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8915
|
+
}
|
|
8916
|
+
return binding;
|
|
8917
|
+
} catch (e) {
|
|
8918
|
+
loadErrors2.push(e);
|
|
8919
|
+
}
|
|
8920
|
+
} else if (process.arch === "arm") {
|
|
8921
|
+
try {
|
|
8922
|
+
return (()=>{throw new Error("Cannot require module "+"./resolver.openharmony-arm.node");})();
|
|
8923
|
+
} catch (e) {
|
|
8924
|
+
loadErrors2.push(e);
|
|
8925
|
+
}
|
|
8926
|
+
try {
|
|
8927
|
+
const binding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-arm");})();
|
|
8928
|
+
const bindingPackageVersion = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-openharmony-arm/package.json");})().version;
|
|
8929
|
+
if (bindingPackageVersion !== "11.16.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
8930
|
+
throw new Error(`Native binding package version mismatch, expected 11.16.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
8931
|
+
}
|
|
8932
|
+
return binding;
|
|
8933
|
+
} catch (e) {
|
|
8934
|
+
loadErrors2.push(e);
|
|
8935
|
+
}
|
|
8936
|
+
} else {
|
|
8937
|
+
loadErrors2.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
|
|
8938
|
+
}
|
|
8939
|
+
} else {
|
|
8940
|
+
loadErrors2.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
|
|
8941
|
+
}
|
|
8942
|
+
}
|
|
8943
|
+
nativeBinding2 = requireNative2();
|
|
8944
|
+
if (!nativeBinding2 || process.env.NAPI_RS_FORCE_WASI) {
|
|
8945
|
+
let wasiBinding = null;
|
|
8946
|
+
let wasiBindingError = null;
|
|
8947
|
+
try {
|
|
8948
|
+
wasiBinding = (()=>{throw new Error("Cannot require module "+"./resolver.wasi.cjs");})();
|
|
8949
|
+
nativeBinding2 = wasiBinding;
|
|
8950
|
+
} catch (err) {
|
|
8951
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
8952
|
+
wasiBindingError = err;
|
|
8953
|
+
}
|
|
8954
|
+
}
|
|
8955
|
+
if (!nativeBinding2) {
|
|
8956
|
+
try {
|
|
8957
|
+
wasiBinding = (()=>{throw new Error("Cannot require module "+"@oxc-resolver/binding-wasm32-wasi");})();
|
|
8958
|
+
nativeBinding2 = wasiBinding;
|
|
8959
|
+
} catch (err) {
|
|
8960
|
+
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
8961
|
+
wasiBindingError.cause = err;
|
|
8962
|
+
loadErrors2.push(err);
|
|
8963
|
+
}
|
|
8964
|
+
}
|
|
8965
|
+
}
|
|
8966
|
+
if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
|
|
8967
|
+
const error2 = new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
|
|
8968
|
+
error2.cause = wasiBindingError;
|
|
8969
|
+
throw error2;
|
|
8970
|
+
}
|
|
8971
|
+
}
|
|
8972
|
+
if (!nativeBinding2 && globalThis.process?.versions?.["webcontainer"]) {
|
|
8973
|
+
try {
|
|
8974
|
+
nativeBinding2 = require_webcontainer_fallback();
|
|
8975
|
+
} catch (err) {
|
|
8976
|
+
loadErrors2.push(err);
|
|
8977
|
+
}
|
|
8978
|
+
}
|
|
8979
|
+
if (!nativeBinding2) {
|
|
8980
|
+
if (loadErrors2.length > 0) {
|
|
8981
|
+
throw new Error(`Cannot find native binding. ` + `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` + "Please try `npm i` again after removing both package-lock.json and node_modules directory.", {
|
|
8982
|
+
cause: loadErrors2.reduce((err, cur) => {
|
|
8983
|
+
cur.cause = err;
|
|
8984
|
+
return cur;
|
|
8985
|
+
})
|
|
8986
|
+
});
|
|
8987
|
+
}
|
|
8988
|
+
throw new Error(`Failed to load native binding`);
|
|
8989
|
+
}
|
|
8990
|
+
module3.exports = nativeBinding2;
|
|
8991
|
+
module3.exports.ResolverFactory = nativeBinding2.ResolverFactory;
|
|
8992
|
+
module3.exports.EnforceExtension = nativeBinding2.EnforceExtension;
|
|
8993
|
+
module3.exports.ModuleType = nativeBinding2.ModuleType;
|
|
8994
|
+
module3.exports.sync = nativeBinding2.sync;
|
|
8995
|
+
if (process.versions.pnp) {
|
|
8996
|
+
process.env.OXC_RESOLVER_YARN_PNP = "1";
|
|
8997
|
+
}
|
|
8998
|
+
});
|
|
8999
|
+
|
|
9000
|
+
// src/rules/ban-instances.ts
|
|
9001
|
+
import { TSESTree } from "@typescript-eslint/types";
|
|
9002
|
+
|
|
9003
|
+
// node_modules/typebox/build/system/memory/memory.mjs
|
|
9004
|
+
var exports_memory = {};
|
|
9005
|
+
__export(exports_memory, {
|
|
9006
|
+
Update: () => Update,
|
|
9007
|
+
Metrics: () => Metrics,
|
|
9008
|
+
Discard: () => Discard,
|
|
9009
|
+
Create: () => Create,
|
|
9010
|
+
Clone: () => Clone,
|
|
9011
|
+
Assign: () => Assign
|
|
9012
|
+
});
|
|
9013
|
+
|
|
9014
|
+
// node_modules/typebox/build/system/memory/metrics.mjs
|
|
9015
|
+
var Metrics = {
|
|
9016
|
+
assign: 0,
|
|
9017
|
+
create: 0,
|
|
9018
|
+
clone: 0,
|
|
9019
|
+
discard: 0,
|
|
9020
|
+
update: 0
|
|
9021
|
+
};
|
|
9022
|
+
|
|
9023
|
+
// node_modules/typebox/build/system/memory/assign.mjs
|
|
9024
|
+
function Assign(left, right) {
|
|
9025
|
+
Metrics.assign += 1;
|
|
9026
|
+
return { ...left, ...right };
|
|
9027
|
+
}
|
|
9028
|
+
// node_modules/typebox/build/guard/emit.mjs
|
|
9029
|
+
var exports_emit = {};
|
|
9030
|
+
__export(exports_emit, {
|
|
9031
|
+
Ternary: () => Ternary,
|
|
9032
|
+
StringGraphemeCount: () => StringGraphemeCount2,
|
|
9033
|
+
Statements: () => Statements,
|
|
9034
|
+
Return: () => Return,
|
|
9035
|
+
ReduceOr: () => ReduceOr,
|
|
9036
|
+
ReduceAnd: () => ReduceAnd,
|
|
9037
|
+
PrefixIncrement: () => PrefixIncrement,
|
|
9038
|
+
Or: () => Or,
|
|
9039
|
+
Not: () => Not,
|
|
9040
|
+
New: () => New,
|
|
9041
|
+
MultipleOf: () => MultipleOf,
|
|
9042
|
+
Member: () => Member,
|
|
9043
|
+
Keys: () => Keys2,
|
|
9044
|
+
IsUndefined: () => IsUndefined2,
|
|
9045
|
+
IsSymbol: () => IsSymbol2,
|
|
9046
|
+
IsString: () => IsString2,
|
|
9047
|
+
IsObjectNotArray: () => IsObjectNotArray2,
|
|
9048
|
+
IsObject: () => IsObject2,
|
|
9049
|
+
IsNumber: () => IsNumber2,
|
|
9050
|
+
IsNull: () => IsNull2,
|
|
9051
|
+
IsLessThan: () => IsLessThan2,
|
|
9052
|
+
IsLessEqualThan: () => IsLessEqualThan2,
|
|
9053
|
+
IsIterator: () => IsIterator2,
|
|
9054
|
+
IsInteger: () => IsInteger2,
|
|
9055
|
+
IsGreaterThan: () => IsGreaterThan2,
|
|
9056
|
+
IsGreaterEqualThan: () => IsGreaterEqualThan2,
|
|
9057
|
+
IsFunction: () => IsFunction2,
|
|
9058
|
+
IsEqual: () => IsEqual2,
|
|
9059
|
+
IsDeepEqual: () => IsDeepEqual2,
|
|
9060
|
+
IsConstructor: () => IsConstructor2,
|
|
9061
|
+
IsBoolean: () => IsBoolean2,
|
|
9062
|
+
IsBigInt: () => IsBigInt2,
|
|
9063
|
+
IsAsyncIterator: () => IsAsyncIterator2,
|
|
9064
|
+
IsArray: () => IsArray2,
|
|
9065
|
+
If: () => If,
|
|
9066
|
+
HasPropertyKey: () => HasPropertyKey2,
|
|
9067
|
+
Every: () => Every2,
|
|
9068
|
+
Entries: () => Entries2,
|
|
9069
|
+
Constant: () => Constant,
|
|
9070
|
+
ConstDeclaration: () => ConstDeclaration,
|
|
9071
|
+
Call: () => Call,
|
|
9072
|
+
ArrowFunction: () => ArrowFunction,
|
|
9073
|
+
ArrayLiteral: () => ArrayLiteral,
|
|
9074
|
+
And: () => And
|
|
9075
|
+
});
|
|
9076
|
+
|
|
9077
|
+
// node_modules/typebox/build/guard/guard.mjs
|
|
9078
|
+
var exports_guard = {};
|
|
9079
|
+
__export(exports_guard, {
|
|
9080
|
+
Values: () => Values,
|
|
9081
|
+
Symbols: () => Symbols,
|
|
9082
|
+
StringGraphemeCount: () => StringGraphemeCount,
|
|
9083
|
+
Keys: () => Keys,
|
|
9084
|
+
IsValueLike: () => IsValueLike,
|
|
9085
|
+
IsUndefined: () => IsUndefined,
|
|
9086
|
+
IsSymbol: () => IsSymbol,
|
|
9087
|
+
IsString: () => IsString,
|
|
9088
|
+
IsObjectNotArray: () => IsObjectNotArray,
|
|
9089
|
+
IsObject: () => IsObject,
|
|
9090
|
+
IsNumber: () => IsNumber,
|
|
9091
|
+
IsNull: () => IsNull,
|
|
9092
|
+
IsMultipleOf: () => IsMultipleOf,
|
|
9093
|
+
IsLessThan: () => IsLessThan,
|
|
9094
|
+
IsLessEqualThan: () => IsLessEqualThan,
|
|
9095
|
+
IsIterator: () => IsIterator,
|
|
9096
|
+
IsInteger: () => IsInteger,
|
|
9097
|
+
IsGreaterThan: () => IsGreaterThan,
|
|
9098
|
+
IsGreaterEqualThan: () => IsGreaterEqualThan,
|
|
9099
|
+
IsFunction: () => IsFunction,
|
|
9100
|
+
IsEqual: () => IsEqual,
|
|
9101
|
+
IsDeepEqual: () => IsDeepEqual,
|
|
9102
|
+
IsConstructor: () => IsConstructor,
|
|
9103
|
+
IsClassInstance: () => IsClassInstance,
|
|
9104
|
+
IsBoolean: () => IsBoolean,
|
|
9105
|
+
IsBigInt: () => IsBigInt,
|
|
9106
|
+
IsAsyncIterator: () => IsAsyncIterator,
|
|
9107
|
+
IsArray: () => IsArray,
|
|
9108
|
+
HasPropertyKey: () => HasPropertyKey,
|
|
9109
|
+
EveryAll: () => EveryAll,
|
|
9110
|
+
Every: () => Every,
|
|
9111
|
+
EntriesRegExp: () => EntriesRegExp,
|
|
9112
|
+
Entries: () => Entries
|
|
9113
|
+
});
|
|
9114
|
+
function IsArray(value) {
|
|
9115
|
+
return Array.isArray(value);
|
|
9116
|
+
}
|
|
9117
|
+
function IsAsyncIterator(value) {
|
|
7599
9118
|
return IsObject(value) && Symbol.asyncIterator in value;
|
|
7600
9119
|
}
|
|
7601
9120
|
function IsBigInt(value) {
|
|
@@ -15435,19 +16954,17 @@ function normalizeConfig(options3) {
|
|
|
15435
16954
|
if (!isOptionsObject.Check(options3))
|
|
15436
16955
|
return { bannedClasses: new Map };
|
|
15437
16956
|
const { bannedInstances } = options3;
|
|
16957
|
+
const bannedClasses = new Map;
|
|
15438
16958
|
if (isArrayConfig.Check(bannedInstances)) {
|
|
15439
|
-
const
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
for (const [className, message] of Object.entries(bannedInstances))
|
|
15447
|
-
map.set(className.toLowerCase(), { message, originalName: className });
|
|
15448
|
-
return { bannedClasses: map };
|
|
16959
|
+
for (const className of bannedInstances) {
|
|
16960
|
+
bannedClasses.set(className.toLowerCase(), { message: undefined, originalName: className });
|
|
16961
|
+
}
|
|
16962
|
+
} else if (isObjectConfig.Check(bannedInstances)) {
|
|
16963
|
+
for (const [className, message] of Object.entries(bannedInstances)) {
|
|
16964
|
+
bannedClasses.set(className.toLowerCase(), { message, originalName: className });
|
|
16965
|
+
}
|
|
15449
16966
|
}
|
|
15450
|
-
return { bannedClasses
|
|
16967
|
+
return { bannedClasses };
|
|
15451
16968
|
}
|
|
15452
16969
|
var docs = {
|
|
15453
16970
|
description: "Ban specified Roblox Instance classes in new Instance() calls and JSX elements.",
|
|
@@ -15554,10 +17071,11 @@ var banReactFC = {
|
|
|
15554
17071
|
return;
|
|
15555
17072
|
const { typeName } = inner;
|
|
15556
17073
|
let isBannedFc = false;
|
|
15557
|
-
if (typeName.type === TSESTree2.AST_NODE_TYPES.Identifier)
|
|
17074
|
+
if (typeName.type === TSESTree2.AST_NODE_TYPES.Identifier) {
|
|
15558
17075
|
isBannedFc = BANNED_FC_NAMES.has(typeName.name);
|
|
15559
|
-
else if (typeName.type === TSESTree2.AST_NODE_TYPES.TSQualifiedName)
|
|
17076
|
+
} else if (typeName.type === TSESTree2.AST_NODE_TYPES.TSQualifiedName) {
|
|
15560
17077
|
isBannedFc = BANNED_FC_NAMES.has(typeName.right.name);
|
|
17078
|
+
}
|
|
15561
17079
|
if (!isBannedFc || node.init?.type !== TSESTree2.AST_NODE_TYPES.ArrowFunctionExpression)
|
|
15562
17080
|
return;
|
|
15563
17081
|
context.report({
|
|
@@ -15592,22 +17110,15 @@ var DEFAULT_CONFIGURATION = {
|
|
|
15592
17110
|
performanceMode: true,
|
|
15593
17111
|
warnThreshold: 15
|
|
15594
17112
|
};
|
|
15595
|
-
var SHOULD_NOT_NOT_RETURN_TYPE = new Set([
|
|
15596
|
-
TSESTree3.AST_NODE_TYPES.FunctionDeclaration,
|
|
15597
|
-
TSESTree3.AST_NODE_TYPES.FunctionExpression
|
|
15598
|
-
]);
|
|
15599
17113
|
function hasTypeAnnotationProperty(node) {
|
|
15600
17114
|
return "typeAnnotation" in node;
|
|
15601
17115
|
}
|
|
15602
17116
|
function hasTypeAnnotation(node) {
|
|
15603
|
-
if (node.type
|
|
15604
|
-
return
|
|
15605
|
-
if (
|
|
15606
|
-
return
|
|
15607
|
-
return
|
|
15608
|
-
}
|
|
15609
|
-
function getTypeName(node) {
|
|
15610
|
-
return node.type === TSESTree3.AST_NODE_TYPES.TSInterfaceDeclaration || node.type === TSESTree3.AST_NODE_TYPES.TSTypeAliasDeclaration ? node.id.name : undefined;
|
|
17117
|
+
if (node.id.type !== TSESTree3.AST_NODE_TYPES.Identifier)
|
|
17118
|
+
return false;
|
|
17119
|
+
if (typeof node.id !== "object" || !hasTypeAnnotationProperty(node.id))
|
|
17120
|
+
return false;
|
|
17121
|
+
return Boolean(node.id.typeAnnotation);
|
|
15611
17122
|
}
|
|
15612
17123
|
function isIanitorValidator(node) {
|
|
15613
17124
|
return node.type === TSESTree3.AST_NODE_TYPES.CallExpression && node.callee?.type === TSESTree3.AST_NODE_TYPES.MemberExpression && node.callee.object?.type === TSESTree3.AST_NODE_TYPES.Identifier && node.callee.object.name === "Ianitor";
|
|
@@ -15620,9 +17131,10 @@ function extractIanitorStaticVariable(typeAnnotation) {
|
|
|
15620
17131
|
if (currentType.type !== TSESTree3.AST_NODE_TYPES.TSTypeReference)
|
|
15621
17132
|
return;
|
|
15622
17133
|
const { typeName, typeArguments } = currentType;
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
17134
|
+
if (typeName.type === TSESTree3.AST_NODE_TYPES.TSQualifiedName && typeName.left.type === TSESTree3.AST_NODE_TYPES.Identifier && typeName.left.name === "Ianitor" && typeName.right.type === TSESTree3.AST_NODE_TYPES.Identifier && typeName.right.name === "Static") {
|
|
17135
|
+
const first = typeArguments?.params[0];
|
|
17136
|
+
const name = first?.type === TSESTree3.AST_NODE_TYPES.TSTypeQuery && first.exprName.type === TSESTree3.AST_NODE_TYPES.Identifier ? first.exprName.name : undefined;
|
|
17137
|
+
return name;
|
|
15626
17138
|
}
|
|
15627
17139
|
return;
|
|
15628
17140
|
}
|
|
@@ -15728,8 +17240,9 @@ var enforceIanitorCheckType = createRule({
|
|
|
15728
17240
|
score = addScore(score, body.length * 2);
|
|
15729
17241
|
for (const member of body) {
|
|
15730
17242
|
const typeAnnotation = "typeAnnotation" in member ? member.typeAnnotation : undefined;
|
|
15731
|
-
if (typeAnnotation)
|
|
17243
|
+
if (typeAnnotation !== undefined) {
|
|
15732
17244
|
score = addScore(score, calculateStructuralComplexity(typeAnnotation.typeAnnotation, nextDepth));
|
|
17245
|
+
}
|
|
15733
17246
|
}
|
|
15734
17247
|
break;
|
|
15735
17248
|
}
|
|
@@ -15738,8 +17251,9 @@ var enforceIanitorCheckType = createRule({
|
|
|
15738
17251
|
score = 2 + members.length * 0.5;
|
|
15739
17252
|
for (const member of members) {
|
|
15740
17253
|
const typeAnnotation = "typeAnnotation" in member ? member.typeAnnotation : undefined;
|
|
15741
|
-
if (typeAnnotation)
|
|
17254
|
+
if (typeAnnotation !== undefined) {
|
|
15742
17255
|
score = addScore(score, calculateStructuralComplexity(typeAnnotation.typeAnnotation, nextDepth));
|
|
17256
|
+
}
|
|
15743
17257
|
}
|
|
15744
17258
|
break;
|
|
15745
17259
|
}
|
|
@@ -15764,9 +17278,10 @@ var enforceIanitorCheckType = createRule({
|
|
|
15764
17278
|
const { elementTypes } = node;
|
|
15765
17279
|
score = 1;
|
|
15766
17280
|
for (const element of elementTypes) {
|
|
15767
|
-
const
|
|
15768
|
-
if (
|
|
17281
|
+
const { type: type3 } = element;
|
|
17282
|
+
if (type3 !== "TSRestType" && type3 !== "TSOptionalType") {
|
|
15769
17283
|
score = addScore(score, calculateStructuralComplexity(element, nextDepth));
|
|
17284
|
+
}
|
|
15770
17285
|
}
|
|
15771
17286
|
score = addScore(score, 1.5 * elementTypes.length);
|
|
15772
17287
|
break;
|
|
@@ -15774,9 +17289,10 @@ var enforceIanitorCheckType = createRule({
|
|
|
15774
17289
|
case TSESTree3.AST_NODE_TYPES.TSTypeReference: {
|
|
15775
17290
|
score = 2;
|
|
15776
17291
|
const { typeArguments } = node;
|
|
15777
|
-
if (typeArguments) {
|
|
15778
|
-
for (const
|
|
15779
|
-
score = addScore(score, calculateStructuralComplexity(
|
|
17292
|
+
if (typeArguments !== undefined) {
|
|
17293
|
+
for (const parameter2 of typeArguments.params) {
|
|
17294
|
+
score = addScore(score, calculateStructuralComplexity(parameter2, nextDepth) + 2);
|
|
17295
|
+
}
|
|
15780
17296
|
}
|
|
15781
17297
|
break;
|
|
15782
17298
|
}
|
|
@@ -15790,22 +17306,26 @@ var enforceIanitorCheckType = createRule({
|
|
|
15790
17306
|
}
|
|
15791
17307
|
case TSESTree3.AST_NODE_TYPES.TSMappedType: {
|
|
15792
17308
|
score = 5;
|
|
15793
|
-
if (node
|
|
17309
|
+
if ("constraint" in node) {
|
|
15794
17310
|
score = addScore(score, calculateStructuralComplexity(node.constraint, nextDepth));
|
|
15795
|
-
|
|
17311
|
+
}
|
|
17312
|
+
if (node.typeAnnotation !== undefined) {
|
|
15796
17313
|
score = addScore(score, calculateStructuralComplexity(node.typeAnnotation, nextDepth));
|
|
17314
|
+
}
|
|
15797
17315
|
break;
|
|
15798
17316
|
}
|
|
15799
17317
|
case TSESTree3.AST_NODE_TYPES.TSFunctionType:
|
|
15800
17318
|
case TSESTree3.AST_NODE_TYPES.TSMethodSignature: {
|
|
15801
17319
|
score = 2;
|
|
15802
|
-
for (const
|
|
15803
|
-
const typeAnnotation = "typeAnnotation" in
|
|
15804
|
-
if (typeAnnotation)
|
|
17320
|
+
for (const parameter2 of node.params) {
|
|
17321
|
+
const typeAnnotation = "typeAnnotation" in parameter2 ? parameter2.typeAnnotation : undefined;
|
|
17322
|
+
if (typeAnnotation !== undefined) {
|
|
15805
17323
|
score = addScore(score, calculateStructuralComplexity(typeAnnotation.typeAnnotation, nextDepth));
|
|
17324
|
+
}
|
|
15806
17325
|
}
|
|
15807
|
-
if (node.returnType)
|
|
17326
|
+
if (node.returnType !== undefined) {
|
|
15808
17327
|
score = addScore(score, calculateStructuralComplexity(node.returnType.typeAnnotation, nextDepth));
|
|
17328
|
+
}
|
|
15809
17329
|
break;
|
|
15810
17330
|
}
|
|
15811
17331
|
default:
|
|
@@ -15820,8 +17340,9 @@ var enforceIanitorCheckType = createRule({
|
|
|
15820
17340
|
return {
|
|
15821
17341
|
"Program:exit"() {
|
|
15822
17342
|
for (const [node, data] of variableDeclaratorsToCheck.entries()) {
|
|
15823
|
-
if (node.id.type === TSESTree3.AST_NODE_TYPES.Identifier && ianitorStaticVariables.has(node.id.name))
|
|
17343
|
+
if (node.id.type === TSESTree3.AST_NODE_TYPES.Identifier && ianitorStaticVariables.has(node.id.name)) {
|
|
15824
17344
|
continue;
|
|
17345
|
+
}
|
|
15825
17346
|
context.report({
|
|
15826
17347
|
data: { score: data.complexity.toFixed(1) },
|
|
15827
17348
|
messageId: "missingIanitorCheckType",
|
|
@@ -15831,10 +17352,10 @@ var enforceIanitorCheckType = createRule({
|
|
|
15831
17352
|
},
|
|
15832
17353
|
TSInterfaceDeclaration(node) {
|
|
15833
17354
|
const complexity = calculateStructuralComplexity(node);
|
|
15834
|
-
const name =
|
|
17355
|
+
const { name } = node.id;
|
|
15835
17356
|
if (complexity >= config.interfacePenalty) {
|
|
15836
17357
|
context.report({
|
|
15837
|
-
data: { name
|
|
17358
|
+
data: { name },
|
|
15838
17359
|
messageId: "complexInterfaceNeedsCheck",
|
|
15839
17360
|
node
|
|
15840
17361
|
});
|
|
@@ -15842,7 +17363,7 @@ var enforceIanitorCheckType = createRule({
|
|
|
15842
17363
|
},
|
|
15843
17364
|
TSTypeAliasDeclaration(node) {
|
|
15844
17365
|
const variableName = extractIanitorStaticVariable(node.typeAnnotation);
|
|
15845
|
-
if (variableName)
|
|
17366
|
+
if (variableName !== undefined)
|
|
15846
17367
|
ianitorStaticVariables.add(variableName);
|
|
15847
17368
|
if (hasIanitorStaticType(node.typeAnnotation))
|
|
15848
17369
|
return;
|
|
@@ -16336,23 +17857,29 @@ function h(n, l) {
|
|
|
16336
17857
|
const g = K(n, l?.errors, l);
|
|
16337
17858
|
return N(n, g, l), g;
|
|
16338
17859
|
}
|
|
17860
|
+
// src/utilities/format-utilities.ts
|
|
17861
|
+
var import_fast_diff = __toESM(require_diff(), 1);
|
|
17862
|
+
|
|
16339
17863
|
// src/oxfmt-sync.ts
|
|
16340
17864
|
import { existsSync } from "node:fs";
|
|
16341
17865
|
import { fileURLToPath } from "node:url";
|
|
16342
17866
|
import { MessageChannel, receiveMessageOnPort, Worker } from "node:worker_threads";
|
|
16343
17867
|
var FORMAT_TIMEOUT = 30000;
|
|
16344
17868
|
var workerState;
|
|
16345
|
-
function
|
|
16346
|
-
const jsPath = new URL("./oxfmt-worker.js",
|
|
17869
|
+
function __testingResolveWorkerPath(baseUrl, exists) {
|
|
17870
|
+
const jsPath = new URL("./oxfmt-worker.js", baseUrl);
|
|
16347
17871
|
const jsFilePath = fileURLToPath(jsPath);
|
|
16348
|
-
if (
|
|
17872
|
+
if (exists(jsFilePath))
|
|
16349
17873
|
return jsPath;
|
|
16350
|
-
const tsPath = new URL("./oxfmt-worker.ts",
|
|
17874
|
+
const tsPath = new URL("./oxfmt-worker.ts", baseUrl);
|
|
16351
17875
|
const tsFilePath = fileURLToPath(tsPath);
|
|
16352
|
-
if (
|
|
17876
|
+
if (exists(tsFilePath))
|
|
16353
17877
|
return tsPath;
|
|
16354
17878
|
throw new Error(`Oxfmt worker not found at ${jsFilePath} or ${tsFilePath}. Did you run 'bun run build'?`);
|
|
16355
17879
|
}
|
|
17880
|
+
function resolveWorkerPath() {
|
|
17881
|
+
return __testingResolveWorkerPath(import.meta.url, existsSync);
|
|
17882
|
+
}
|
|
16356
17883
|
function getWorker() {
|
|
16357
17884
|
if (workerState !== undefined)
|
|
16358
17885
|
return workerState;
|
|
@@ -16417,22 +17944,38 @@ function loadOxfmtConfig() {
|
|
|
16417
17944
|
}
|
|
16418
17945
|
}
|
|
16419
17946
|
function getExtension(filePath) {
|
|
16420
|
-
|
|
16421
|
-
|
|
16422
|
-
|
|
16423
|
-
|
|
16424
|
-
|
|
16425
|
-
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
|
|
16429
|
-
|
|
16430
|
-
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
17947
|
+
const { length } = filePath;
|
|
17948
|
+
if (length >= 3 && filePath.codePointAt(length - 3) === 46 /* Period */) {
|
|
17949
|
+
const character1 = filePath.codePointAt(length - 2);
|
|
17950
|
+
const character2 = filePath.codePointAt(length - 1);
|
|
17951
|
+
if (character1 === 116 /* LowerT */ && character2 === 115 /* LowerS */)
|
|
17952
|
+
return ".ts";
|
|
17953
|
+
if (character1 === 106 /* LowerJ */ && character2 === 115 /* LowerS */)
|
|
17954
|
+
return ".js";
|
|
17955
|
+
}
|
|
17956
|
+
if (length >= 4 && filePath.codePointAt(length - 4) === 46 /* Period */) {
|
|
17957
|
+
const character1 = filePath.codePointAt(length - 3);
|
|
17958
|
+
const character2 = filePath.codePointAt(length - 2);
|
|
17959
|
+
const character3 = filePath.codePointAt(length - 1);
|
|
17960
|
+
if (character3 === 120 /* LowerX */) {
|
|
17961
|
+
if (character1 === 116 /* LowerT */ && character2 === 115 /* LowerS */)
|
|
17962
|
+
return ".tsx";
|
|
17963
|
+
if (character1 === 106 /* LowerJ */ && character2 === 115 /* LowerS */)
|
|
17964
|
+
return ".jsx";
|
|
17965
|
+
} else if (character3 === 115 /* LowerS */) {
|
|
17966
|
+
if (character2 === 116 /* LowerT */) {
|
|
17967
|
+
if (character1 === 109 /* LowerM */)
|
|
17968
|
+
return ".mts";
|
|
17969
|
+
if (character1 === 99 /* LowerC */)
|
|
17970
|
+
return ".cts";
|
|
17971
|
+
} else if (character2 === 106 /* LowerJ */) {
|
|
17972
|
+
if (character1 === 109 /* LowerM */)
|
|
17973
|
+
return ".mjs";
|
|
17974
|
+
if (character1 === 99 /* LowerC */)
|
|
17975
|
+
return ".cjs";
|
|
17976
|
+
}
|
|
17977
|
+
}
|
|
17978
|
+
}
|
|
16436
17979
|
return;
|
|
16437
17980
|
}
|
|
16438
17981
|
function formatWithOxfmtSync(source, filePath) {
|
|
@@ -16445,14 +17988,51 @@ function formatWithOxfmtSync(source, filePath) {
|
|
|
16445
17988
|
function generateDifferences(original, formatted) {
|
|
16446
17989
|
if (original === formatted)
|
|
16447
17990
|
return [];
|
|
16448
|
-
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
17991
|
+
const diffs = import_fast_diff.default(original, formatted);
|
|
17992
|
+
const differences = new Array;
|
|
17993
|
+
let size = 0;
|
|
17994
|
+
let offset = 0;
|
|
17995
|
+
let index2 = 0;
|
|
17996
|
+
while (index2 < diffs.length) {
|
|
17997
|
+
const diff2 = diffs[index2];
|
|
17998
|
+
if (diff2 === undefined)
|
|
17999
|
+
break;
|
|
18000
|
+
const [type3, text] = diff2;
|
|
18001
|
+
if (type3 === 0) {
|
|
18002
|
+
offset += text.length;
|
|
18003
|
+
index2 += 1;
|
|
18004
|
+
} else if (type3 === -1) {
|
|
18005
|
+
let adjustedOffset = offset;
|
|
18006
|
+
const previous = diffs[index2 - 1];
|
|
18007
|
+
if (previous !== undefined && previous[0] === 0) {
|
|
18008
|
+
const [, prevText] = previous;
|
|
18009
|
+
let shiftCount = 0;
|
|
18010
|
+
while (shiftCount < prevText.length && shiftCount < text.length && prevText[prevText.length - 1 - shiftCount] === text[shiftCount]) {
|
|
18011
|
+
shiftCount += 1;
|
|
18012
|
+
}
|
|
18013
|
+
adjustedOffset -= shiftCount;
|
|
18014
|
+
}
|
|
18015
|
+
const next = diffs[index2 + 1];
|
|
18016
|
+
if (next !== undefined && next[0] === 1) {
|
|
18017
|
+
const [, nextText] = next;
|
|
18018
|
+
differences[size++] = {
|
|
18019
|
+
deleteText: text,
|
|
18020
|
+
insertText: nextText,
|
|
18021
|
+
offset: adjustedOffset,
|
|
18022
|
+
operation: "REPLACE"
|
|
18023
|
+
};
|
|
18024
|
+
index2 += 2;
|
|
18025
|
+
} else {
|
|
18026
|
+
differences[size++] = { deleteText: text, offset: adjustedOffset, operation: "DELETE" };
|
|
18027
|
+
index2 += 1;
|
|
18028
|
+
}
|
|
18029
|
+
offset += text.length;
|
|
18030
|
+
} else {
|
|
18031
|
+
differences[size++] = { insertText: text, offset, operation: "INSERT" };
|
|
18032
|
+
index2 += 1;
|
|
16454
18033
|
}
|
|
16455
|
-
|
|
18034
|
+
}
|
|
18035
|
+
return differences;
|
|
16456
18036
|
}
|
|
16457
18037
|
var MAX_LENGTH = 60;
|
|
16458
18038
|
var SYMBOLS = {
|
|
@@ -18112,15 +19692,11 @@ function tryParse(value, filename) {
|
|
|
18112
19692
|
function containsCode(value, filename) {
|
|
18113
19693
|
if (!couldBeJsCode(value))
|
|
18114
19694
|
return false;
|
|
18115
|
-
|
|
18116
|
-
|
|
18117
|
-
if (!result)
|
|
18118
|
-
return false;
|
|
18119
|
-
const statements = toParsedStatements(result.program.body);
|
|
18120
|
-
return !isExclusion(statements, value);
|
|
18121
|
-
} catch {
|
|
19695
|
+
const result = tryParse(value, filename);
|
|
19696
|
+
if (!result)
|
|
18122
19697
|
return false;
|
|
18123
|
-
|
|
19698
|
+
const statements = toParsedStatements(result.program.body);
|
|
19699
|
+
return !isExclusion(statements, value);
|
|
18124
19700
|
}
|
|
18125
19701
|
var noCommentedCode = {
|
|
18126
19702
|
create(context) {
|
|
@@ -18181,24 +19757,17 @@ var FUNCTION_BOUNDARIES = new Set([
|
|
|
18181
19757
|
TSESTree5.AST_NODE_TYPES.FunctionExpression,
|
|
18182
19758
|
TSESTree5.AST_NODE_TYPES.ArrowFunctionExpression
|
|
18183
19759
|
]);
|
|
18184
|
-
var RUNTIME_TS_WRAPPERS = new Set([
|
|
18185
|
-
"ParenthesizedExpression",
|
|
18186
|
-
"TSAsExpression",
|
|
18187
|
-
"TSSatisfiesExpression",
|
|
18188
|
-
"TSTypeAssertion",
|
|
18189
|
-
"TSNonNullExpression",
|
|
18190
|
-
"TSInstantiationExpression",
|
|
18191
|
-
"ChainExpression"
|
|
18192
|
-
]);
|
|
18193
19760
|
function isComponentName(name) {
|
|
18194
19761
|
return COMPONENT_NAME_PATTERN.test(name);
|
|
18195
19762
|
}
|
|
18196
19763
|
function isReactComponentHOC(callExpr) {
|
|
18197
19764
|
const { callee } = callExpr;
|
|
18198
|
-
if (callee.type === TSESTree5.AST_NODE_TYPES.Identifier)
|
|
19765
|
+
if (callee.type === TSESTree5.AST_NODE_TYPES.Identifier) {
|
|
18199
19766
|
return callee.name === "forwardRef" || callee.name === "memo";
|
|
18200
|
-
|
|
19767
|
+
}
|
|
19768
|
+
if (callee.type === TSESTree5.AST_NODE_TYPES.MemberExpression && callee.object.type === TSESTree5.AST_NODE_TYPES.Identifier && callee.object.name === "React" && callee.property.type === TSESTree5.AST_NODE_TYPES.Identifier) {
|
|
18201
19769
|
return callee.property.name === "forwardRef" || callee.property.name === "memo";
|
|
19770
|
+
}
|
|
18202
19771
|
return false;
|
|
18203
19772
|
}
|
|
18204
19773
|
function getComponentNameFromFunction(node) {
|
|
@@ -18231,13 +19800,14 @@ function getComponentNameFromCallParent(callExpr) {
|
|
|
18231
19800
|
if (parent.type === TSESTree5.AST_NODE_TYPES.AssignmentExpression && parent.left.type === TSESTree5.AST_NODE_TYPES.Identifier && isComponentName(parent.left.name)) {
|
|
18232
19801
|
return parent.left.name;
|
|
18233
19802
|
}
|
|
19803
|
+
let nameFromExportDefault;
|
|
18234
19804
|
if (parent.type === TSESTree5.AST_NODE_TYPES.ExportDefaultDeclaration && callExpr.arguments.length > 0) {
|
|
18235
19805
|
const [firstArg] = callExpr.arguments;
|
|
18236
19806
|
if (firstArg && firstArg.type === TSESTree5.AST_NODE_TYPES.FunctionExpression && firstArg.id && isComponentName(firstArg.id.name)) {
|
|
18237
|
-
|
|
19807
|
+
nameFromExportDefault = firstArg.id.name;
|
|
18238
19808
|
}
|
|
18239
19809
|
}
|
|
18240
|
-
return;
|
|
19810
|
+
return nameFromExportDefault;
|
|
18241
19811
|
}
|
|
18242
19812
|
function getHookName(callExpression) {
|
|
18243
19813
|
const { callee } = callExpression;
|
|
@@ -18270,11 +19840,7 @@ function isTypeOnlyNullLiteral(node) {
|
|
|
18270
19840
|
const { parent } = node;
|
|
18271
19841
|
if (parent === null || parent === undefined)
|
|
18272
19842
|
return false;
|
|
18273
|
-
|
|
18274
|
-
return true;
|
|
18275
|
-
if (parent.type === TSESTree5.AST_NODE_TYPES.TSLiteralType)
|
|
18276
|
-
return true;
|
|
18277
|
-
return false;
|
|
19843
|
+
return parent.type === TSESTree5.AST_NODE_TYPES.TSLiteralType;
|
|
18278
19844
|
}
|
|
18279
19845
|
function analyzeComponentBody(functionNode, sourceCode, stateHooks) {
|
|
18280
19846
|
let maxJsxDepth = 0;
|
|
@@ -18300,14 +19866,10 @@ function analyzeComponentBody(functionNode, sourceCode, stateHooks) {
|
|
|
18300
19866
|
nullLiterals.push(literalNode);
|
|
18301
19867
|
}
|
|
18302
19868
|
function getVisitorKeysForNodeType(nodeType) {
|
|
18303
|
-
const visitorKeysUnknown = sourceCode.visitorKeys;
|
|
18304
|
-
if (visitorKeysUnknown === null || visitorKeysUnknown === undefined || typeof visitorKeysUnknown !== "object")
|
|
18305
|
-
return [];
|
|
18306
|
-
const visitorKeysRecord = visitorKeysUnknown;
|
|
18307
|
-
const keysUnknown = visitorKeysRecord[nodeType];
|
|
18308
|
-
if (!Array.isArray(keysUnknown))
|
|
18309
|
-
return [];
|
|
18310
19869
|
const keys3 = new Array;
|
|
19870
|
+
const keysUnknown = sourceCode.visitorKeys[nodeType];
|
|
19871
|
+
if (!Array.isArray(keysUnknown))
|
|
19872
|
+
return keys3;
|
|
18311
19873
|
for (const key of keysUnknown)
|
|
18312
19874
|
if (typeof key === "string")
|
|
18313
19875
|
keys3.push(key);
|
|
@@ -18319,9 +19881,10 @@ function analyzeComponentBody(functionNode, sourceCode, stateHooks) {
|
|
|
18319
19881
|
const value = currentRecord[key];
|
|
18320
19882
|
if (Array.isArray(value)) {
|
|
18321
19883
|
for (const item of value) {
|
|
18322
|
-
if (typeof item
|
|
19884
|
+
if (typeof item !== "object" || item === null)
|
|
19885
|
+
continue;
|
|
19886
|
+
if ("type" in item)
|
|
18323
19887
|
visit(item, nextDepth);
|
|
18324
|
-
}
|
|
18325
19888
|
}
|
|
18326
19889
|
continue;
|
|
18327
19890
|
}
|
|
@@ -18548,41 +20111,35 @@ function isBlockReturningIdentity(body, paramName) {
|
|
|
18548
20111
|
return statement.argument.name === paramName;
|
|
18549
20112
|
}
|
|
18550
20113
|
function isIdentityCallback(callback) {
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
|
|
18554
|
-
|
|
18555
|
-
|
|
18556
|
-
|
|
18557
|
-
|
|
18558
|
-
|
|
18559
|
-
|
|
18560
|
-
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
if (callback.body.type === AST_NODE_TYPES2.BlockStatement) {
|
|
18564
|
-
return isBlockReturningIdentity(callback.body, paramName);
|
|
20114
|
+
let isIdentity = false;
|
|
20115
|
+
if (callback.type === AST_NODE_TYPES2.ArrowFunctionExpression && callback.params.length === 1) {
|
|
20116
|
+
const [parameter2] = callback.params;
|
|
20117
|
+
if (parameter2 !== undefined) {
|
|
20118
|
+
const name = getParameterName(parameter2);
|
|
20119
|
+
if (name !== undefined) {
|
|
20120
|
+
const { body } = callback;
|
|
20121
|
+
if (body.type === AST_NODE_TYPES2.Identifier)
|
|
20122
|
+
isIdentity = body.name === name;
|
|
20123
|
+
if (body.type === AST_NODE_TYPES2.BlockStatement)
|
|
20124
|
+
isIdentity = isBlockReturningIdentity(body, name);
|
|
20125
|
+
}
|
|
18565
20126
|
}
|
|
18566
|
-
return false;
|
|
18567
20127
|
}
|
|
18568
|
-
if (callback.type === AST_NODE_TYPES2.FunctionExpression) {
|
|
18569
|
-
|
|
18570
|
-
|
|
18571
|
-
|
|
18572
|
-
|
|
18573
|
-
|
|
18574
|
-
|
|
18575
|
-
if (paramName === undefined || paramName === "")
|
|
18576
|
-
return false;
|
|
18577
|
-
return isBlockReturningIdentity(callback.body, paramName);
|
|
20128
|
+
if (callback.type === AST_NODE_TYPES2.FunctionExpression && callback.params.length === 1) {
|
|
20129
|
+
const [parameter2] = callback.params;
|
|
20130
|
+
if (parameter2 !== undefined) {
|
|
20131
|
+
const name = getParameterName(parameter2);
|
|
20132
|
+
if (name !== undefined)
|
|
20133
|
+
isIdentity = isBlockReturningIdentity(callback.body, name);
|
|
20134
|
+
}
|
|
18578
20135
|
}
|
|
18579
|
-
return
|
|
20136
|
+
return isIdentity;
|
|
18580
20137
|
}
|
|
18581
20138
|
function findVariable(context, identifier3) {
|
|
18582
20139
|
let scope = context.sourceCode.getScope(identifier3);
|
|
18583
20140
|
while (scope) {
|
|
18584
20141
|
const variable = scope.set.get(identifier3.name);
|
|
18585
|
-
if (variable)
|
|
20142
|
+
if (variable !== undefined)
|
|
18586
20143
|
return variable;
|
|
18587
20144
|
scope = scope.upper ?? undefined;
|
|
18588
20145
|
}
|
|
@@ -18590,9 +20147,8 @@ function findVariable(context, identifier3) {
|
|
|
18590
20147
|
}
|
|
18591
20148
|
function getHookName2(node) {
|
|
18592
20149
|
const { callee } = node;
|
|
18593
|
-
if (callee.type === AST_NODE_TYPES2.Identifier)
|
|
20150
|
+
if (callee.type === AST_NODE_TYPES2.Identifier)
|
|
18594
20151
|
return callee.name;
|
|
18595
|
-
}
|
|
18596
20152
|
if (callee.type === AST_NODE_TYPES2.MemberExpression && callee.property.type === AST_NODE_TYPES2.Identifier) {
|
|
18597
20153
|
return callee.property.name;
|
|
18598
20154
|
}
|
|
@@ -18600,9 +20156,8 @@ function getHookName2(node) {
|
|
|
18600
20156
|
}
|
|
18601
20157
|
function isJoinBindingsCall(node) {
|
|
18602
20158
|
const { callee } = node;
|
|
18603
|
-
if (callee.type === AST_NODE_TYPES2.Identifier)
|
|
20159
|
+
if (callee.type === AST_NODE_TYPES2.Identifier)
|
|
18604
20160
|
return callee.name === "joinBindings";
|
|
18605
|
-
}
|
|
18606
20161
|
if (callee.type === AST_NODE_TYPES2.MemberExpression && callee.property.type === AST_NODE_TYPES2.Identifier) {
|
|
18607
20162
|
return callee.property.name === "joinBindings";
|
|
18608
20163
|
}
|
|
@@ -18616,9 +20171,7 @@ function isBindingInitialization(variable) {
|
|
|
18616
20171
|
if (!init || init.type !== AST_NODE_TYPES2.CallExpression)
|
|
18617
20172
|
continue;
|
|
18618
20173
|
const hookName = getHookName2(init);
|
|
18619
|
-
if (hookName === "useBinding")
|
|
18620
|
-
return true;
|
|
18621
|
-
if (isJoinBindingsCall(init))
|
|
20174
|
+
if (hookName === "useBinding" || isJoinBindingsCall(init))
|
|
18622
20175
|
return true;
|
|
18623
20176
|
if (init.callee.type === AST_NODE_TYPES2.MemberExpression && init.callee.property.type === AST_NODE_TYPES2.Identifier && init.callee.property.name === "map") {
|
|
18624
20177
|
return true;
|
|
@@ -18630,26 +20183,21 @@ function isLikelyBinding(context, callee, patterns2) {
|
|
|
18630
20183
|
const { object: object3 } = callee;
|
|
18631
20184
|
if (object3.type === AST_NODE_TYPES2.Identifier) {
|
|
18632
20185
|
const lowerName = object3.name.toLowerCase();
|
|
18633
|
-
for (const pattern4 of patterns2)
|
|
20186
|
+
for (const pattern4 of patterns2)
|
|
18634
20187
|
if (lowerName.includes(pattern4.toLowerCase()))
|
|
18635
20188
|
return true;
|
|
18636
|
-
}
|
|
18637
20189
|
const variable = findVariable(context, object3);
|
|
18638
|
-
if (variable && isBindingInitialization(variable))
|
|
20190
|
+
if (variable !== undefined && isBindingInitialization(variable))
|
|
18639
20191
|
return true;
|
|
18640
20192
|
}
|
|
18641
20193
|
if (object3.type === AST_NODE_TYPES2.CallExpression && object3.callee.type === AST_NODE_TYPES2.MemberExpression && object3.callee.property.type === AST_NODE_TYPES2.Identifier && object3.callee.property.name === "map") {
|
|
18642
20194
|
return true;
|
|
18643
20195
|
}
|
|
18644
|
-
|
|
18645
|
-
return true;
|
|
18646
|
-
}
|
|
18647
|
-
return false;
|
|
20196
|
+
return object3.type === AST_NODE_TYPES2.CallExpression && isJoinBindingsCall(object3);
|
|
18648
20197
|
}
|
|
18649
20198
|
var noIdentityMap = {
|
|
18650
20199
|
create(context) {
|
|
18651
|
-
const [
|
|
18652
|
-
const patterns2 = rawOptions?.bindingPatterns ?? DEFAULT_BINDING_PATTERNS;
|
|
20200
|
+
const [{ bindingPatterns = DEFAULT_BINDING_PATTERNS } = {}] = context.options;
|
|
18653
20201
|
return {
|
|
18654
20202
|
CallExpression(node) {
|
|
18655
20203
|
const { callee } = node;
|
|
@@ -18668,7 +20216,7 @@ var noIdentityMap = {
|
|
|
18668
20216
|
return;
|
|
18669
20217
|
if (!isIdentityCallback(callback))
|
|
18670
20218
|
return;
|
|
18671
|
-
const isBinding = isLikelyBinding(context, callee,
|
|
20219
|
+
const isBinding = isLikelyBinding(context, callee, bindingPatterns);
|
|
18672
20220
|
context.report({
|
|
18673
20221
|
fix(fixer) {
|
|
18674
20222
|
const objectText = context.sourceCode.getText(callee.object);
|
|
@@ -19396,31 +20944,226 @@ var noUselessUseSpring = {
|
|
|
19396
20944
|
defaultOptions: [DEFAULT_OPTION_VALUES],
|
|
19397
20945
|
meta: {
|
|
19398
20946
|
docs: {
|
|
19399
|
-
description: "Disallow useSpring hooks whose config and dependencies are entirely static"
|
|
20947
|
+
description: "Disallow useSpring hooks whose config and dependencies are entirely static"
|
|
20948
|
+
},
|
|
20949
|
+
messages: {
|
|
20950
|
+
uselessSpring: "useSpring call has only static inputs and non-updating dependencies; replace it with a constant or remove the hook."
|
|
20951
|
+
},
|
|
20952
|
+
schema: [
|
|
20953
|
+
{
|
|
20954
|
+
additionalProperties: false,
|
|
20955
|
+
properties: {
|
|
20956
|
+
springHooks: {
|
|
20957
|
+
description: "Hook identifiers that should be treated as spring hooks",
|
|
20958
|
+
items: { type: "string" },
|
|
20959
|
+
type: "array"
|
|
20960
|
+
},
|
|
20961
|
+
staticGlobalFactories: {
|
|
20962
|
+
default: [...DEFAULT_STATIC_GLOBAL_FACTORIES],
|
|
20963
|
+
description: "Global factory identifiers that are treated as static constructors",
|
|
20964
|
+
items: { type: "string" },
|
|
20965
|
+
type: "array"
|
|
20966
|
+
},
|
|
20967
|
+
treatEmptyDepsAsViolation: {
|
|
20968
|
+
default: true,
|
|
20969
|
+
description: "Treat static config with an empty dependency array as a violation",
|
|
20970
|
+
type: "boolean"
|
|
20971
|
+
}
|
|
20972
|
+
},
|
|
20973
|
+
type: "object"
|
|
20974
|
+
}
|
|
20975
|
+
],
|
|
20976
|
+
type: "suggestion"
|
|
20977
|
+
}
|
|
20978
|
+
};
|
|
20979
|
+
var no_useless_use_spring_default = noUselessUseSpring;
|
|
20980
|
+
|
|
20981
|
+
// src/rules/no-warn.ts
|
|
20982
|
+
var noWarn = {
|
|
20983
|
+
create(context) {
|
|
20984
|
+
return {
|
|
20985
|
+
'CallExpression[callee.type="Identifier"][callee.name="warn"]'(node) {
|
|
20986
|
+
context.report({
|
|
20987
|
+
messageId: "useLog",
|
|
20988
|
+
node
|
|
20989
|
+
});
|
|
20990
|
+
}
|
|
20991
|
+
};
|
|
20992
|
+
},
|
|
20993
|
+
meta: {
|
|
20994
|
+
docs: {
|
|
20995
|
+
description: "Ban warn() function calls. Use Log instead.",
|
|
20996
|
+
recommended: false
|
|
20997
|
+
},
|
|
20998
|
+
messages: {
|
|
20999
|
+
useLog: "Use Log instead of warn()"
|
|
21000
|
+
},
|
|
21001
|
+
schema: [],
|
|
21002
|
+
type: "problem"
|
|
21003
|
+
}
|
|
21004
|
+
};
|
|
21005
|
+
var no_warn_default = noWarn;
|
|
21006
|
+
|
|
21007
|
+
// src/rules/prefer-class-properties.ts
|
|
21008
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES5 } from "@typescript-eslint/utils";
|
|
21009
|
+
function isExpression(node) {
|
|
21010
|
+
return node.type !== AST_NODE_TYPES5.AssignmentPattern && node.type !== AST_NODE_TYPES5.TSEmptyBodyFunctionExpression;
|
|
21011
|
+
}
|
|
21012
|
+
function isSimpleLiteralProperty({ computed, value }) {
|
|
21013
|
+
return !computed && isExpression(value) && isSimpleLiteral(value);
|
|
21014
|
+
}
|
|
21015
|
+
function isSimpleLiteral(node) {
|
|
21016
|
+
if (!node)
|
|
21017
|
+
return false;
|
|
21018
|
+
switch (node.type) {
|
|
21019
|
+
case AST_NODE_TYPES5.Literal:
|
|
21020
|
+
return true;
|
|
21021
|
+
case AST_NODE_TYPES5.MemberExpression:
|
|
21022
|
+
return isSimpleLiteral(node.object);
|
|
21023
|
+
case AST_NODE_TYPES5.CallExpression:
|
|
21024
|
+
return node.callee.type === AST_NODE_TYPES5.MemberExpression && isSimpleLiteral(node.callee.object);
|
|
21025
|
+
case AST_NODE_TYPES5.ArrayExpression:
|
|
21026
|
+
return node.elements.every((element) => {
|
|
21027
|
+
if (element === null)
|
|
21028
|
+
return true;
|
|
21029
|
+
if (element.type === AST_NODE_TYPES5.SpreadElement)
|
|
21030
|
+
return false;
|
|
21031
|
+
return isSimpleLiteral(element);
|
|
21032
|
+
});
|
|
21033
|
+
case AST_NODE_TYPES5.ObjectExpression:
|
|
21034
|
+
return node.properties.every((property) => property.type === AST_NODE_TYPES5.SpreadElement || property.type !== AST_NODE_TYPES5.Property ? false : isSimpleLiteralProperty(property));
|
|
21035
|
+
default:
|
|
21036
|
+
return false;
|
|
21037
|
+
}
|
|
21038
|
+
}
|
|
21039
|
+
function isStaticMemberExpression(node) {
|
|
21040
|
+
let current = node;
|
|
21041
|
+
while (current.type === AST_NODE_TYPES5.MemberExpression) {
|
|
21042
|
+
if (current.computed && current.property.type !== AST_NODE_TYPES5.Literal)
|
|
21043
|
+
return false;
|
|
21044
|
+
current = current.object;
|
|
21045
|
+
}
|
|
21046
|
+
return true;
|
|
21047
|
+
}
|
|
21048
|
+
function isConstructor(node) {
|
|
21049
|
+
return node.type === AST_NODE_TYPES5.MethodDefinition && node.kind === "constructor" && node.key.type === AST_NODE_TYPES5.Identifier && node.key.name === "constructor";
|
|
21050
|
+
}
|
|
21051
|
+
var preferClassProperties = {
|
|
21052
|
+
create(context) {
|
|
21053
|
+
const option = context.options[0] ?? "always";
|
|
21054
|
+
if (option === "never") {
|
|
21055
|
+
return {
|
|
21056
|
+
PropertyDefinition(node) {
|
|
21057
|
+
if (node.static)
|
|
21058
|
+
return;
|
|
21059
|
+
context.report({
|
|
21060
|
+
messageId: "unexpectedClassProperty",
|
|
21061
|
+
node
|
|
21062
|
+
});
|
|
21063
|
+
}
|
|
21064
|
+
};
|
|
21065
|
+
}
|
|
21066
|
+
return {
|
|
21067
|
+
ClassDeclaration(node) {
|
|
21068
|
+
checkClass(node.body);
|
|
21069
|
+
},
|
|
21070
|
+
ClassExpression(node) {
|
|
21071
|
+
checkClass(node.body);
|
|
21072
|
+
}
|
|
21073
|
+
};
|
|
21074
|
+
function checkClass(body) {
|
|
21075
|
+
for (const member of body.body) {
|
|
21076
|
+
if (!isConstructor(member))
|
|
21077
|
+
continue;
|
|
21078
|
+
if (member.type !== AST_NODE_TYPES5.MethodDefinition)
|
|
21079
|
+
continue;
|
|
21080
|
+
if (!member.value || member.value.type !== AST_NODE_TYPES5.FunctionExpression)
|
|
21081
|
+
continue;
|
|
21082
|
+
for (const statement of member.value.body.body) {
|
|
21083
|
+
if (statement.type !== AST_NODE_TYPES5.ExpressionStatement)
|
|
21084
|
+
continue;
|
|
21085
|
+
const { expression } = statement;
|
|
21086
|
+
if (expression.type !== AST_NODE_TYPES5.AssignmentExpression)
|
|
21087
|
+
continue;
|
|
21088
|
+
if (expression.left.type !== AST_NODE_TYPES5.MemberExpression)
|
|
21089
|
+
continue;
|
|
21090
|
+
if (expression.left.object.type !== AST_NODE_TYPES5.ThisExpression)
|
|
21091
|
+
continue;
|
|
21092
|
+
if ((expression.left.property.type === AST_NODE_TYPES5.Identifier || expression.left.property.type === AST_NODE_TYPES5.Literal) && isSimpleLiteral(expression.right) && isStaticMemberExpression(expression.left)) {
|
|
21093
|
+
context.report({
|
|
21094
|
+
messageId: "unexpectedAssignment",
|
|
21095
|
+
node: expression
|
|
21096
|
+
});
|
|
21097
|
+
}
|
|
21098
|
+
}
|
|
21099
|
+
}
|
|
21100
|
+
}
|
|
21101
|
+
},
|
|
21102
|
+
defaultOptions: ["always"],
|
|
21103
|
+
meta: {
|
|
21104
|
+
docs: {
|
|
21105
|
+
description: "Prefer class properties to assignment of literals in constructors."
|
|
21106
|
+
},
|
|
21107
|
+
messages: {
|
|
21108
|
+
unexpectedAssignment: "Unexpected assignment of literal instance member.",
|
|
21109
|
+
unexpectedClassProperty: "Unexpected class property."
|
|
21110
|
+
},
|
|
21111
|
+
schema: [{ enum: ["always", "never"], type: "string" }],
|
|
21112
|
+
type: "suggestion"
|
|
21113
|
+
}
|
|
21114
|
+
};
|
|
21115
|
+
var prefer_class_properties_default = preferClassProperties;
|
|
21116
|
+
|
|
21117
|
+
// src/rules/prefer-early-return.ts
|
|
21118
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES6 } from "@typescript-eslint/utils";
|
|
21119
|
+
var DEFAULT_MAXIMUM_STATEMENTS = 1;
|
|
21120
|
+
function isLonelyIfStatement(statement) {
|
|
21121
|
+
return statement.alternate === null;
|
|
21122
|
+
}
|
|
21123
|
+
function isOffendingConsequent(consequent, maxStatements) {
|
|
21124
|
+
return consequent.type === AST_NODE_TYPES6.ExpressionStatement && maxStatements === 0 || consequent.type === AST_NODE_TYPES6.BlockStatement && consequent.body.length > maxStatements;
|
|
21125
|
+
}
|
|
21126
|
+
function canSimplifyConditionalBody(body, maxStatements) {
|
|
21127
|
+
if (body.body.length !== 1)
|
|
21128
|
+
return false;
|
|
21129
|
+
const [statement] = body.body;
|
|
21130
|
+
if (statement === undefined || statement.type !== AST_NODE_TYPES6.IfStatement || !isLonelyIfStatement(statement)) {
|
|
21131
|
+
return false;
|
|
21132
|
+
}
|
|
21133
|
+
return isOffendingConsequent(statement.consequent, maxStatements);
|
|
21134
|
+
}
|
|
21135
|
+
var preferEarlyReturn = {
|
|
21136
|
+
create(context) {
|
|
21137
|
+
const options3 = context.options[0] ?? {};
|
|
21138
|
+
const maxStatements = options3.maximumStatements ?? DEFAULT_MAXIMUM_STATEMENTS;
|
|
21139
|
+
function checkFunctionBody(node) {
|
|
21140
|
+
const { body } = node;
|
|
21141
|
+
if (body.type !== AST_NODE_TYPES6.BlockStatement || !canSimplifyConditionalBody(body, maxStatements))
|
|
21142
|
+
return;
|
|
21143
|
+
context.report({
|
|
21144
|
+
messageId: "preferEarlyReturn",
|
|
21145
|
+
node: body
|
|
21146
|
+
});
|
|
21147
|
+
}
|
|
21148
|
+
return {
|
|
21149
|
+
ArrowFunctionExpression: checkFunctionBody,
|
|
21150
|
+
FunctionDeclaration: checkFunctionBody,
|
|
21151
|
+
FunctionExpression: checkFunctionBody
|
|
21152
|
+
};
|
|
21153
|
+
},
|
|
21154
|
+
defaultOptions: [{}],
|
|
21155
|
+
meta: {
|
|
21156
|
+
docs: {
|
|
21157
|
+
description: "Prefer early returns over full-body conditional wrapping in function declarations."
|
|
19400
21158
|
},
|
|
19401
21159
|
messages: {
|
|
19402
|
-
|
|
21160
|
+
preferEarlyReturn: "Prefer an early return to a conditionally-wrapped function body"
|
|
19403
21161
|
},
|
|
19404
21162
|
schema: [
|
|
19405
21163
|
{
|
|
19406
21164
|
additionalProperties: false,
|
|
19407
21165
|
properties: {
|
|
19408
|
-
|
|
19409
|
-
description: "Hook identifiers that should be treated as spring hooks",
|
|
19410
|
-
items: { type: "string" },
|
|
19411
|
-
type: "array"
|
|
19412
|
-
},
|
|
19413
|
-
staticGlobalFactories: {
|
|
19414
|
-
default: [...DEFAULT_STATIC_GLOBAL_FACTORIES],
|
|
19415
|
-
description: "Global factory identifiers that are treated as static constructors",
|
|
19416
|
-
items: { type: "string" },
|
|
19417
|
-
type: "array"
|
|
19418
|
-
},
|
|
19419
|
-
treatEmptyDepsAsViolation: {
|
|
19420
|
-
default: true,
|
|
19421
|
-
description: "Treat static config with an empty dependency array as a violation",
|
|
19422
|
-
type: "boolean"
|
|
19423
|
-
}
|
|
21166
|
+
maximumStatements: { type: "integer" }
|
|
19424
21167
|
},
|
|
19425
21168
|
type: "object"
|
|
19426
21169
|
}
|
|
@@ -19428,42 +21171,162 @@ var noUselessUseSpring = {
|
|
|
19428
21171
|
type: "suggestion"
|
|
19429
21172
|
}
|
|
19430
21173
|
};
|
|
19431
|
-
var
|
|
19432
|
-
|
|
19433
|
-
// src/rules/
|
|
19434
|
-
var
|
|
21174
|
+
var prefer_early_return_default = preferEarlyReturn;
|
|
21175
|
+
|
|
21176
|
+
// src/rules/prefer-module-scope-constants.ts
|
|
21177
|
+
var import_scope_manager3 = __toESM(require_dist2(), 1);
|
|
21178
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES7 } from "@typescript-eslint/utils";
|
|
21179
|
+
var SCREAMING_SNAKE_CASE = /^[A-Z][A-Z0-9_]*$/;
|
|
21180
|
+
function isTopScope(scope) {
|
|
21181
|
+
const { type: type3 } = scope;
|
|
21182
|
+
if (type3 === import_scope_manager3.ScopeType.module || type3 === import_scope_manager3.ScopeType.global)
|
|
21183
|
+
return true;
|
|
21184
|
+
if (scope.upper?.type === import_scope_manager3.ScopeType.global) {
|
|
21185
|
+
const { block } = scope.upper;
|
|
21186
|
+
if (block.type === AST_NODE_TYPES7.Program && block.sourceType === "script")
|
|
21187
|
+
return true;
|
|
21188
|
+
}
|
|
21189
|
+
return false;
|
|
21190
|
+
}
|
|
21191
|
+
var preferModuleScopeConstants = {
|
|
19435
21192
|
create(context) {
|
|
21193
|
+
let inConstDeclaration = false;
|
|
19436
21194
|
return {
|
|
19437
|
-
|
|
21195
|
+
VariableDeclaration(node) {
|
|
21196
|
+
inConstDeclaration = node.kind === "const";
|
|
21197
|
+
},
|
|
21198
|
+
"VariableDeclaration:exit"() {
|
|
21199
|
+
inConstDeclaration = false;
|
|
21200
|
+
},
|
|
21201
|
+
VariableDeclarator(node) {
|
|
21202
|
+
const { id: id2 } = node;
|
|
21203
|
+
if (id2.type !== AST_NODE_TYPES7.Identifier || !SCREAMING_SNAKE_CASE.test(id2.name))
|
|
21204
|
+
return;
|
|
21205
|
+
if (!inConstDeclaration) {
|
|
21206
|
+
context.report({
|
|
21207
|
+
messageId: "mustUseConst",
|
|
21208
|
+
node
|
|
21209
|
+
});
|
|
21210
|
+
return;
|
|
21211
|
+
}
|
|
21212
|
+
const scope = context.sourceCode.getScope(node);
|
|
21213
|
+
if (isTopScope(scope))
|
|
21214
|
+
return;
|
|
19438
21215
|
context.report({
|
|
19439
|
-
messageId: "
|
|
21216
|
+
messageId: "mustBeModuleScope",
|
|
19440
21217
|
node
|
|
19441
21218
|
});
|
|
19442
21219
|
}
|
|
19443
21220
|
};
|
|
19444
21221
|
},
|
|
21222
|
+
defaultOptions: [],
|
|
19445
21223
|
meta: {
|
|
19446
21224
|
docs: {
|
|
19447
|
-
description: "
|
|
19448
|
-
recommended: false
|
|
21225
|
+
description: "Prefer that screaming snake case variables always be defined using `const`, and always appear at module scope."
|
|
19449
21226
|
},
|
|
19450
21227
|
messages: {
|
|
19451
|
-
|
|
21228
|
+
mustBeModuleScope: "You must place screaming snake case at module scope. If this is not meant to be a module-scoped variable, use camelcase instead.",
|
|
21229
|
+
mustUseConst: "You must use `const` when defining screaming snake case variables. If this is not a constant, use camelcase instead."
|
|
19452
21230
|
},
|
|
19453
21231
|
schema: [],
|
|
19454
|
-
type: "
|
|
21232
|
+
type: "suggestion"
|
|
19455
21233
|
}
|
|
19456
21234
|
};
|
|
19457
|
-
var
|
|
21235
|
+
var prefer_module_scope_constants_default = preferModuleScopeConstants;
|
|
21236
|
+
|
|
21237
|
+
// src/rules/prefer-pascal-case-enums.ts
|
|
21238
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES8 } from "@typescript-eslint/utils";
|
|
21239
|
+
|
|
21240
|
+
// src/utilities/casing-utilities.ts
|
|
21241
|
+
var SPLIT_LOWER_TO_UPPER = regex2("([\\p{Ll}\\d])(\\p{Lu})", "gu");
|
|
21242
|
+
var SPLIT_UPPER_TO_UPPER = regex2("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu");
|
|
21243
|
+
var SPLIT_MARKER = "\x00";
|
|
21244
|
+
var SPLIT_REPLACE_VALUE = `$1${SPLIT_MARKER}$2`;
|
|
21245
|
+
function toPascalCase(value) {
|
|
21246
|
+
const trimmed = value.trim();
|
|
21247
|
+
if (trimmed.length === 0)
|
|
21248
|
+
return "";
|
|
21249
|
+
const marked = trimmed.replace(SPLIT_LOWER_TO_UPPER, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_TO_UPPER, SPLIT_REPLACE_VALUE);
|
|
21250
|
+
let start = 0;
|
|
21251
|
+
let { length } = marked;
|
|
21252
|
+
while (marked.charCodeAt(start) === 0)
|
|
21253
|
+
start += 1;
|
|
21254
|
+
if (start === length)
|
|
21255
|
+
return "";
|
|
21256
|
+
while (marked.charCodeAt(length - 1) === 0)
|
|
21257
|
+
length -= 1;
|
|
21258
|
+
let result = "";
|
|
21259
|
+
let wordStart = start;
|
|
21260
|
+
for (let index2 = start;index2 <= length; index2 += 1) {
|
|
21261
|
+
if (index2 !== length && marked.charCodeAt(index2) !== 0)
|
|
21262
|
+
continue;
|
|
21263
|
+
if (index2 > wordStart) {
|
|
21264
|
+
const word = marked.slice(wordStart, index2);
|
|
21265
|
+
const firstByte = word.charCodeAt(0);
|
|
21266
|
+
if (result.length > 0 && firstByte >= 48 && firstByte <= 57)
|
|
21267
|
+
result += "_";
|
|
21268
|
+
result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
21269
|
+
}
|
|
21270
|
+
wordStart = index2 + 1;
|
|
21271
|
+
}
|
|
21272
|
+
return result;
|
|
21273
|
+
}
|
|
21274
|
+
|
|
21275
|
+
// src/rules/prefer-pascal-case-enums.ts
|
|
21276
|
+
var STARTS_WITH_DIGIT = regex2("^\\d");
|
|
21277
|
+
function getIdentifierName(node) {
|
|
21278
|
+
if (node.type === AST_NODE_TYPES8.Identifier)
|
|
21279
|
+
return node.name;
|
|
21280
|
+
if (node.type !== AST_NODE_TYPES8.Literal || typeof node.value !== "string")
|
|
21281
|
+
return;
|
|
21282
|
+
return STARTS_WITH_DIGIT.test(node.value) ? undefined : node.value;
|
|
21283
|
+
}
|
|
21284
|
+
var preferPascalCaseEnums = {
|
|
21285
|
+
create(context) {
|
|
21286
|
+
function report(node, identifier3) {
|
|
21287
|
+
context.report({
|
|
21288
|
+
data: { identifier: identifier3 },
|
|
21289
|
+
messageId: "notPascalCase",
|
|
21290
|
+
node
|
|
21291
|
+
});
|
|
21292
|
+
}
|
|
21293
|
+
return {
|
|
21294
|
+
TSEnumDeclaration(node) {
|
|
21295
|
+
const { name } = node.id;
|
|
21296
|
+
if (toPascalCase(name) === name)
|
|
21297
|
+
return;
|
|
21298
|
+
report(node.id, name);
|
|
21299
|
+
},
|
|
21300
|
+
TSEnumMember(node) {
|
|
21301
|
+
const name = getIdentifierName(node.id);
|
|
21302
|
+
if (name === undefined || toPascalCase(name) === name)
|
|
21303
|
+
return;
|
|
21304
|
+
report(node.id, name);
|
|
21305
|
+
}
|
|
21306
|
+
};
|
|
21307
|
+
},
|
|
21308
|
+
defaultOptions: [],
|
|
21309
|
+
meta: {
|
|
21310
|
+
docs: {
|
|
21311
|
+
description: "Enforce Pascal case when naming enums."
|
|
21312
|
+
},
|
|
21313
|
+
messages: {
|
|
21314
|
+
notPascalCase: "Enum '{{ identifier }}' should use Pascal case."
|
|
21315
|
+
},
|
|
21316
|
+
schema: [],
|
|
21317
|
+
type: "suggestion"
|
|
21318
|
+
}
|
|
21319
|
+
};
|
|
21320
|
+
var prefer_pascal_case_enums_default = preferPascalCaseEnums;
|
|
19458
21321
|
|
|
19459
21322
|
// src/rules/prefer-sequence-overloads.ts
|
|
19460
|
-
import { AST_NODE_TYPES as
|
|
21323
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES9 } from "@typescript-eslint/types";
|
|
19461
21324
|
var sequenceDescriptors = [
|
|
19462
21325
|
{ keypointName: "ColorSequenceKeypoint", sequenceName: "ColorSequence" },
|
|
19463
21326
|
{ keypointName: "NumberSequenceKeypoint", sequenceName: "NumberSequence" }
|
|
19464
21327
|
];
|
|
19465
21328
|
function isSequenceIdentifier(node) {
|
|
19466
|
-
if (node.type !==
|
|
21329
|
+
if (node.type !== AST_NODE_TYPES9.Identifier)
|
|
19467
21330
|
return false;
|
|
19468
21331
|
for (const { sequenceName } of sequenceDescriptors)
|
|
19469
21332
|
if (sequenceName === node.name)
|
|
@@ -19477,16 +21340,16 @@ function findDescriptor(sequenceName) {
|
|
|
19477
21340
|
return;
|
|
19478
21341
|
}
|
|
19479
21342
|
var isNumericLiteral = Compile(build_default.Object({
|
|
19480
|
-
type: build_default.Literal(
|
|
21343
|
+
type: build_default.Literal(AST_NODE_TYPES9.Literal),
|
|
19481
21344
|
value: build_default.Number()
|
|
19482
21345
|
}));
|
|
19483
21346
|
function isExpressionArgument(argument) {
|
|
19484
|
-
return argument !== undefined && argument.type !==
|
|
21347
|
+
return argument !== undefined && argument.type !== AST_NODE_TYPES9.SpreadElement;
|
|
19485
21348
|
}
|
|
19486
21349
|
function extractKeypoint(element, descriptor) {
|
|
19487
|
-
if (element === undefined || element.type !==
|
|
21350
|
+
if (element === undefined || element.type !== AST_NODE_TYPES9.NewExpression)
|
|
19488
21351
|
return;
|
|
19489
|
-
if (element.callee.type !==
|
|
21352
|
+
if (element.callee.type !== AST_NODE_TYPES9.Identifier || element.callee.name !== descriptor.keypointName)
|
|
19490
21353
|
return;
|
|
19491
21354
|
if (element.arguments.length !== 2)
|
|
19492
21355
|
return;
|
|
@@ -19516,7 +21379,7 @@ var preferSequenceOverloads = {
|
|
|
19516
21379
|
if (descriptor === undefined || node.arguments.length !== 1)
|
|
19517
21380
|
return;
|
|
19518
21381
|
const [argument] = node.arguments;
|
|
19519
|
-
if (argument === undefined || argument.type !==
|
|
21382
|
+
if (argument === undefined || argument.type !== AST_NODE_TYPES9.ArrayExpression || argument.elements.length !== 2)
|
|
19520
21383
|
return;
|
|
19521
21384
|
const firstElement = argument.elements[0] ?? undefined;
|
|
19522
21385
|
const secondElement = argument.elements[1] ?? undefined;
|
|
@@ -19562,6 +21425,147 @@ var preferSequenceOverloads = {
|
|
|
19562
21425
|
};
|
|
19563
21426
|
var prefer_sequence_overloads_default = preferSequenceOverloads;
|
|
19564
21427
|
|
|
21428
|
+
// src/rules/prefer-singular-enums.ts
|
|
21429
|
+
var IRREGULAR_PLURALS = new Set([
|
|
21430
|
+
"children",
|
|
21431
|
+
"dice",
|
|
21432
|
+
"feet",
|
|
21433
|
+
"geese",
|
|
21434
|
+
"men",
|
|
21435
|
+
"mice",
|
|
21436
|
+
"people",
|
|
21437
|
+
"teeth",
|
|
21438
|
+
"women",
|
|
21439
|
+
"criteria",
|
|
21440
|
+
"data",
|
|
21441
|
+
"media",
|
|
21442
|
+
"phenomena",
|
|
21443
|
+
"indices",
|
|
21444
|
+
"matrices",
|
|
21445
|
+
"vertices",
|
|
21446
|
+
"axes",
|
|
21447
|
+
"alumni",
|
|
21448
|
+
"cacti",
|
|
21449
|
+
"fungi",
|
|
21450
|
+
"octopi"
|
|
21451
|
+
]);
|
|
21452
|
+
var SINGULAR_EXCEPTIONS = new Set([
|
|
21453
|
+
"news",
|
|
21454
|
+
"status",
|
|
21455
|
+
"alias",
|
|
21456
|
+
"analysis",
|
|
21457
|
+
"basis",
|
|
21458
|
+
"thesis",
|
|
21459
|
+
"crisis",
|
|
21460
|
+
"axis",
|
|
21461
|
+
"class",
|
|
21462
|
+
"glass",
|
|
21463
|
+
"series",
|
|
21464
|
+
"species",
|
|
21465
|
+
"business"
|
|
21466
|
+
]);
|
|
21467
|
+
var PROGRAMMING_PLURALS = new Set([
|
|
21468
|
+
"args",
|
|
21469
|
+
"params",
|
|
21470
|
+
"parameters",
|
|
21471
|
+
"options",
|
|
21472
|
+
"settings",
|
|
21473
|
+
"props",
|
|
21474
|
+
"components",
|
|
21475
|
+
"hooks",
|
|
21476
|
+
"types",
|
|
21477
|
+
"enums",
|
|
21478
|
+
"services",
|
|
21479
|
+
"controllers",
|
|
21480
|
+
"models",
|
|
21481
|
+
"repositories",
|
|
21482
|
+
"dto",
|
|
21483
|
+
"dtos",
|
|
21484
|
+
"vo",
|
|
21485
|
+
"vos",
|
|
21486
|
+
"keys",
|
|
21487
|
+
"values",
|
|
21488
|
+
"entries",
|
|
21489
|
+
"items",
|
|
21490
|
+
"orders",
|
|
21491
|
+
"pages"
|
|
21492
|
+
]);
|
|
21493
|
+
var SINGULAR_ENUM_REGEX = regex2("[A-Z]+(?![a-z])|[A-Z]?[a-z]+|\\d+", "g");
|
|
21494
|
+
function tokenizeIdentifier(name) {
|
|
21495
|
+
const parts = name.split("_");
|
|
21496
|
+
const tokens = new Array;
|
|
21497
|
+
for (const part of parts) {
|
|
21498
|
+
const matches = part.match(SINGULAR_ENUM_REGEX);
|
|
21499
|
+
if (matches)
|
|
21500
|
+
tokens.push(...matches);
|
|
21501
|
+
}
|
|
21502
|
+
return tokens;
|
|
21503
|
+
}
|
|
21504
|
+
var INTEGER_REGEXP = regex2("^\\d+$");
|
|
21505
|
+
function getLastAlphaToken(name) {
|
|
21506
|
+
const tokens = tokenizeIdentifier(name);
|
|
21507
|
+
let alphaToken;
|
|
21508
|
+
for (let index2 = tokens.length - 1;index2 >= 0; index2 -= 1) {
|
|
21509
|
+
const token = tokens[index2];
|
|
21510
|
+
if (token === undefined || INTEGER_REGEXP.test(token))
|
|
21511
|
+
continue;
|
|
21512
|
+
alphaToken = { lower: token.toLowerCase(), original: token };
|
|
21513
|
+
break;
|
|
21514
|
+
}
|
|
21515
|
+
return alphaToken;
|
|
21516
|
+
}
|
|
21517
|
+
var ACRONYM_REGEXP = regex2("^[A-Z]{2,}[sS]$");
|
|
21518
|
+
function isAcronymPlural(original) {
|
|
21519
|
+
return ACRONYM_REGEXP.test(original);
|
|
21520
|
+
}
|
|
21521
|
+
var ES_VOWELS_REGEXP = regex2("((ch|sh|x|z|ss|o)es|xes|zes|ches|shes|sses|oes)$");
|
|
21522
|
+
function isPluralWord(lower, original) {
|
|
21523
|
+
if (IRREGULAR_PLURALS.has(lower) || PROGRAMMING_PLURALS.has(lower))
|
|
21524
|
+
return true;
|
|
21525
|
+
if (SINGULAR_EXCEPTIONS.has(lower))
|
|
21526
|
+
return false;
|
|
21527
|
+
if (isAcronymPlural(original) || lower.endsWith("ies") || lower.endsWith("ves") || ES_VOWELS_REGEXP.test(lower) || lower.endsWith("es")) {
|
|
21528
|
+
return true;
|
|
21529
|
+
}
|
|
21530
|
+
if (lower.endsWith("s"))
|
|
21531
|
+
return !(lower.endsWith("ss") || lower.endsWith("us") || lower.endsWith("is"));
|
|
21532
|
+
return false;
|
|
21533
|
+
}
|
|
21534
|
+
function isPlural(name) {
|
|
21535
|
+
if (ACRONYM_REGEXP.test(name))
|
|
21536
|
+
return true;
|
|
21537
|
+
const last = getLastAlphaToken(name);
|
|
21538
|
+
return last ? isPluralWord(last.lower, last.original) : false;
|
|
21539
|
+
}
|
|
21540
|
+
var preferSingularEnums = {
|
|
21541
|
+
create(context) {
|
|
21542
|
+
return {
|
|
21543
|
+
TSEnumDeclaration(node) {
|
|
21544
|
+
const { name } = node.id;
|
|
21545
|
+
if (!isPlural(name))
|
|
21546
|
+
return;
|
|
21547
|
+
context.report({
|
|
21548
|
+
data: { name },
|
|
21549
|
+
messageId: "notSingular",
|
|
21550
|
+
node
|
|
21551
|
+
});
|
|
21552
|
+
}
|
|
21553
|
+
};
|
|
21554
|
+
},
|
|
21555
|
+
defaultOptions: [],
|
|
21556
|
+
meta: {
|
|
21557
|
+
docs: {
|
|
21558
|
+
description: "Prefer singular TypeScript enums."
|
|
21559
|
+
},
|
|
21560
|
+
messages: {
|
|
21561
|
+
notSingular: "Enum '{{ name }}' should be singular."
|
|
21562
|
+
},
|
|
21563
|
+
schema: [],
|
|
21564
|
+
type: "suggestion"
|
|
21565
|
+
}
|
|
21566
|
+
};
|
|
21567
|
+
var prefer_singular_enums_default = preferSingularEnums;
|
|
21568
|
+
|
|
19565
21569
|
// src/rules/prefer-udim2-shorthand.ts
|
|
19566
21570
|
import { TSESTree as TSESTree7 } from "@typescript-eslint/utils";
|
|
19567
21571
|
function isNumber(value) {
|
|
@@ -19576,83 +21580,79 @@ function hasTypeProperty(object3) {
|
|
|
19576
21580
|
var OPERATORS2 = new Set(["+", "-", "*", "/", "%"]);
|
|
19577
21581
|
function reconstructText(node) {
|
|
19578
21582
|
const nodeType = node.type;
|
|
21583
|
+
let text;
|
|
19579
21584
|
if (nodeType === TSESTree7.AST_NODE_TYPES.Literal) {
|
|
19580
21585
|
const { value } = node;
|
|
19581
|
-
|
|
21586
|
+
text = isNumber(value) ? String(value) : undefined;
|
|
19582
21587
|
}
|
|
19583
21588
|
if (nodeType === TSESTree7.AST_NODE_TYPES.Identifier) {
|
|
19584
21589
|
const { name } = node;
|
|
19585
|
-
|
|
21590
|
+
text = typeof name === "string" ? name : undefined;
|
|
19586
21591
|
}
|
|
19587
21592
|
if (nodeType === TSESTree7.AST_NODE_TYPES.UnaryExpression) {
|
|
19588
21593
|
const { operator } = node;
|
|
19589
|
-
if (typeof operator
|
|
19590
|
-
|
|
19591
|
-
|
|
19592
|
-
|
|
19593
|
-
|
|
19594
|
-
|
|
19595
|
-
|
|
21594
|
+
if (typeof operator === "string") {
|
|
21595
|
+
const { argument } = node;
|
|
21596
|
+
if (isRecord3(argument)) {
|
|
21597
|
+
const argumentText = reconstructText(argument);
|
|
21598
|
+
if (argumentText !== undefined)
|
|
21599
|
+
text = `${operator}${argumentText}`;
|
|
21600
|
+
}
|
|
21601
|
+
}
|
|
19596
21602
|
}
|
|
19597
21603
|
if (nodeType === TSESTree7.AST_NODE_TYPES.BinaryExpression) {
|
|
19598
21604
|
const { operator } = node;
|
|
19599
|
-
if (typeof operator
|
|
19600
|
-
|
|
19601
|
-
|
|
19602
|
-
|
|
19603
|
-
|
|
19604
|
-
|
|
19605
|
-
|
|
19606
|
-
|
|
21605
|
+
if (typeof operator === "string" && OPERATORS2.has(operator)) {
|
|
21606
|
+
const { left, right } = node;
|
|
21607
|
+
if (isRecord3(left) && isRecord3(right)) {
|
|
21608
|
+
const leftText = reconstructText(left);
|
|
21609
|
+
const rightText = reconstructText(right);
|
|
21610
|
+
if (leftText !== undefined && rightText !== undefined)
|
|
21611
|
+
text = `${leftText} ${operator} ${rightText}`;
|
|
21612
|
+
}
|
|
21613
|
+
}
|
|
19607
21614
|
}
|
|
19608
|
-
return;
|
|
21615
|
+
return text;
|
|
19609
21616
|
}
|
|
19610
21617
|
function evaluateExpression(node) {
|
|
19611
21618
|
if (!isRecord3(node))
|
|
19612
21619
|
return;
|
|
19613
21620
|
const nodeType = node.type;
|
|
21621
|
+
let value;
|
|
19614
21622
|
if (nodeType === TSESTree7.AST_NODE_TYPES.Literal) {
|
|
19615
|
-
const { value } = node;
|
|
19616
|
-
|
|
21623
|
+
const { value: literalValue } = node;
|
|
21624
|
+
value = isNumber(literalValue) ? literalValue : undefined;
|
|
19617
21625
|
}
|
|
19618
21626
|
if (nodeType === TSESTree7.AST_NODE_TYPES.UnaryExpression) {
|
|
19619
21627
|
const { argument, operator } = node;
|
|
19620
|
-
if (
|
|
19621
|
-
const
|
|
19622
|
-
if (
|
|
19623
|
-
|
|
19624
|
-
if (operator === "
|
|
19625
|
-
|
|
19626
|
-
if (operator === "+")
|
|
19627
|
-
return value;
|
|
21628
|
+
if (isRecord3(argument)) {
|
|
21629
|
+
const argumentValue = evaluateExpression(argument);
|
|
21630
|
+
if (operator === "-" && argumentValue !== undefined)
|
|
21631
|
+
value = -argumentValue;
|
|
21632
|
+
if (operator === "+" && argumentValue !== undefined)
|
|
21633
|
+
value = argumentValue;
|
|
19628
21634
|
}
|
|
19629
|
-
return;
|
|
19630
21635
|
}
|
|
19631
21636
|
if (nodeType === TSESTree7.AST_NODE_TYPES.BinaryExpression) {
|
|
19632
21637
|
const { right, left, operator } = node;
|
|
19633
|
-
if (
|
|
21638
|
+
if (isRecord3(left) && isRecord3(right) && typeof operator === "string" && OPERATORS2.has(operator)) {
|
|
19634
21639
|
const leftValue = evaluateExpression(left);
|
|
19635
21640
|
const rightValue = evaluateExpression(right);
|
|
19636
|
-
if (leftValue
|
|
19637
|
-
|
|
19638
|
-
|
|
19639
|
-
|
|
19640
|
-
|
|
19641
|
-
|
|
19642
|
-
|
|
19643
|
-
|
|
19644
|
-
|
|
19645
|
-
|
|
19646
|
-
|
|
19647
|
-
case "%":
|
|
19648
|
-
return rightValue === 0 ? undefined : leftValue % rightValue;
|
|
19649
|
-
default:
|
|
19650
|
-
return;
|
|
21641
|
+
if (leftValue !== undefined && rightValue !== undefined) {
|
|
21642
|
+
if (operator === "+")
|
|
21643
|
+
value = leftValue + rightValue;
|
|
21644
|
+
if (operator === "-")
|
|
21645
|
+
value = leftValue - rightValue;
|
|
21646
|
+
if (operator === "*")
|
|
21647
|
+
value = leftValue * rightValue;
|
|
21648
|
+
if (operator === "/")
|
|
21649
|
+
value = rightValue === 0 ? undefined : leftValue / rightValue;
|
|
21650
|
+
if (operator === "%")
|
|
21651
|
+
value = rightValue === 0 ? undefined : leftValue % rightValue;
|
|
19651
21652
|
}
|
|
19652
21653
|
}
|
|
19653
|
-
return;
|
|
19654
21654
|
}
|
|
19655
|
-
return;
|
|
21655
|
+
return value;
|
|
19656
21656
|
}
|
|
19657
21657
|
function collectArguments(_context2, parameters3) {
|
|
19658
21658
|
if (parameters3.length !== 4)
|
|
@@ -19724,6 +21724,145 @@ var preferUDim2Shorthand = {
|
|
|
19724
21724
|
};
|
|
19725
21725
|
var prefer_udim2_shorthand_default = preferUDim2Shorthand;
|
|
19726
21726
|
|
|
21727
|
+
// src/rules/react-hooks-strict-return.ts
|
|
21728
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES10 } from "@typescript-eslint/utils";
|
|
21729
|
+
var MAX_RETURN_ELEMENTS = 2;
|
|
21730
|
+
var HOOK_PATTERN = /^use[A-Z0-9].*$/;
|
|
21731
|
+
function isHookNode(node) {
|
|
21732
|
+
let name;
|
|
21733
|
+
if (node.type === AST_NODE_TYPES10.VariableDeclarator && node.id.type === AST_NODE_TYPES10.Identifier) {
|
|
21734
|
+
({ name } = node.id);
|
|
21735
|
+
} else if (node.type === AST_NODE_TYPES10.FunctionDeclaration && node.id)
|
|
21736
|
+
({ name } = node.id);
|
|
21737
|
+
else if (node.type === AST_NODE_TYPES10.FunctionExpression && node.id)
|
|
21738
|
+
({ name } = node.id);
|
|
21739
|
+
return name !== undefined && HOOK_PATTERN.test(name);
|
|
21740
|
+
}
|
|
21741
|
+
function getVariableByName(scope, name) {
|
|
21742
|
+
let current = scope;
|
|
21743
|
+
while (current) {
|
|
21744
|
+
const variable = current.set.get(name);
|
|
21745
|
+
if (variable)
|
|
21746
|
+
return variable;
|
|
21747
|
+
current = current.upper;
|
|
21748
|
+
}
|
|
21749
|
+
return;
|
|
21750
|
+
}
|
|
21751
|
+
function getArrayElementsFromVariable(scope, name) {
|
|
21752
|
+
const variable = getVariableByName(scope, name);
|
|
21753
|
+
if (!variable)
|
|
21754
|
+
return [];
|
|
21755
|
+
const elements = new Array;
|
|
21756
|
+
for (const ref6 of variable.references) {
|
|
21757
|
+
const { identifier: identifier3 } = ref6;
|
|
21758
|
+
if (!identifier3.parent)
|
|
21759
|
+
continue;
|
|
21760
|
+
const { parent } = identifier3;
|
|
21761
|
+
if (parent.type !== AST_NODE_TYPES10.VariableDeclarator)
|
|
21762
|
+
continue;
|
|
21763
|
+
if (!parent.init || parent.init.type !== AST_NODE_TYPES10.ArrayExpression)
|
|
21764
|
+
continue;
|
|
21765
|
+
elements.push(...parent.init.elements);
|
|
21766
|
+
}
|
|
21767
|
+
return elements;
|
|
21768
|
+
}
|
|
21769
|
+
function countReturnElements(argument, scope) {
|
|
21770
|
+
if (argument.type === AST_NODE_TYPES10.Identifier)
|
|
21771
|
+
return getArrayElementsFromVariable(scope, argument.name).length;
|
|
21772
|
+
if (argument.type !== AST_NODE_TYPES10.ArrayExpression)
|
|
21773
|
+
return 0;
|
|
21774
|
+
let count = 0;
|
|
21775
|
+
for (const element of argument.elements) {
|
|
21776
|
+
if (element === null)
|
|
21777
|
+
count += 1;
|
|
21778
|
+
else if (element.type === AST_NODE_TYPES10.SpreadElement) {
|
|
21779
|
+
if (element.argument.type === AST_NODE_TYPES10.Identifier) {
|
|
21780
|
+
count += getArrayElementsFromVariable(scope, element.argument.name).length;
|
|
21781
|
+
} else if (element.argument.type === AST_NODE_TYPES10.ArrayExpression) {
|
|
21782
|
+
count += element.argument.elements.length;
|
|
21783
|
+
} else
|
|
21784
|
+
count += 1;
|
|
21785
|
+
} else
|
|
21786
|
+
count += 1;
|
|
21787
|
+
}
|
|
21788
|
+
return count;
|
|
21789
|
+
}
|
|
21790
|
+
function exceedsMaxReturnProperties(node, scope) {
|
|
21791
|
+
const { argument } = node;
|
|
21792
|
+
if (argument === null)
|
|
21793
|
+
return false;
|
|
21794
|
+
if (argument.type === AST_NODE_TYPES10.ObjectExpression)
|
|
21795
|
+
return false;
|
|
21796
|
+
if (argument.type === AST_NODE_TYPES10.Identifier) {
|
|
21797
|
+
const variable = getVariableByName(scope, argument.name);
|
|
21798
|
+
if (variable) {
|
|
21799
|
+
for (const { identifier: identifier3 } of variable.references) {
|
|
21800
|
+
const { parent } = identifier3;
|
|
21801
|
+
if (parent?.type === AST_NODE_TYPES10.VariableDeclarator && parent.init?.type === AST_NODE_TYPES10.ObjectExpression) {
|
|
21802
|
+
return false;
|
|
21803
|
+
}
|
|
21804
|
+
}
|
|
21805
|
+
}
|
|
21806
|
+
}
|
|
21807
|
+
return countReturnElements(argument, scope) > MAX_RETURN_ELEMENTS;
|
|
21808
|
+
}
|
|
21809
|
+
var reactHooksStrictReturn = {
|
|
21810
|
+
create(context) {
|
|
21811
|
+
let hookDepth = 0;
|
|
21812
|
+
function enterHook(node) {
|
|
21813
|
+
if (isHookNode(node))
|
|
21814
|
+
hookDepth += 1;
|
|
21815
|
+
}
|
|
21816
|
+
function exitHook(node) {
|
|
21817
|
+
if (isHookNode(node))
|
|
21818
|
+
hookDepth -= 1;
|
|
21819
|
+
}
|
|
21820
|
+
return {
|
|
21821
|
+
ArrowFunctionExpression(node) {
|
|
21822
|
+
const { parent } = node;
|
|
21823
|
+
if (parent?.type === AST_NODE_TYPES10.VariableDeclarator && parent.id.type === AST_NODE_TYPES10.Identifier && HOOK_PATTERN.test(parent.id.name)) {
|
|
21824
|
+
hookDepth += 1;
|
|
21825
|
+
}
|
|
21826
|
+
},
|
|
21827
|
+
"ArrowFunctionExpression:exit"(node) {
|
|
21828
|
+
const { parent } = node;
|
|
21829
|
+
if (parent?.type === AST_NODE_TYPES10.VariableDeclarator && parent.id.type === AST_NODE_TYPES10.Identifier && HOOK_PATTERN.test(parent.id.name)) {
|
|
21830
|
+
hookDepth -= 1;
|
|
21831
|
+
}
|
|
21832
|
+
},
|
|
21833
|
+
FunctionDeclaration: enterHook,
|
|
21834
|
+
"FunctionDeclaration:exit": exitHook,
|
|
21835
|
+
FunctionExpression: enterHook,
|
|
21836
|
+
"FunctionExpression:exit": exitHook,
|
|
21837
|
+
ReturnStatement(node) {
|
|
21838
|
+
if (hookDepth === 0)
|
|
21839
|
+
return;
|
|
21840
|
+
const scope = context.sourceCode.getScope(node);
|
|
21841
|
+
if (exceedsMaxReturnProperties(node, scope)) {
|
|
21842
|
+
context.report({
|
|
21843
|
+
messageId: "hooksStrictReturn",
|
|
21844
|
+
node
|
|
21845
|
+
});
|
|
21846
|
+
}
|
|
21847
|
+
},
|
|
21848
|
+
VariableDeclarator: enterHook,
|
|
21849
|
+
"VariableDeclarator:exit": exitHook
|
|
21850
|
+
};
|
|
21851
|
+
},
|
|
21852
|
+
defaultOptions: [],
|
|
21853
|
+
meta: {
|
|
21854
|
+
docs: {
|
|
21855
|
+
description: "Restrict the number of returned items from React hooks."
|
|
21856
|
+
},
|
|
21857
|
+
messages: {
|
|
21858
|
+
hooksStrictReturn: "React hooks must return a tuple of two or fewer values or a single object."
|
|
21859
|
+
},
|
|
21860
|
+
schema: [],
|
|
21861
|
+
type: "suggestion"
|
|
21862
|
+
}
|
|
21863
|
+
};
|
|
21864
|
+
var react_hooks_strict_return_default = reactHooksStrictReturn;
|
|
21865
|
+
|
|
19727
21866
|
// src/rules/require-named-effect-functions.ts
|
|
19728
21867
|
import { TSESTree as TSESTree8 } from "@typescript-eslint/types";
|
|
19729
21868
|
var DEFAULT_HOOKS = [
|
|
@@ -20057,7 +22196,7 @@ var requireNamedEffectFunctions = {
|
|
|
20057
22196
|
var require_named_effect_functions_default = requireNamedEffectFunctions;
|
|
20058
22197
|
|
|
20059
22198
|
// src/rules/require-paired-calls.ts
|
|
20060
|
-
import { AST_NODE_TYPES as
|
|
22199
|
+
import { AST_NODE_TYPES as AST_NODE_TYPES11 } from "@typescript-eslint/types";
|
|
20061
22200
|
var isStringArray = Compile(build_default.Readonly(build_default.Array(build_default.String())));
|
|
20062
22201
|
var isPairConfiguration = Compile(build_default.Readonly(build_default.Object({
|
|
20063
22202
|
alternatives: build_default.Optional(isStringArray),
|
|
@@ -20075,20 +22214,20 @@ var isRuleOptions3 = Compile(build_default.Partial(build_default.Readonly(build_
|
|
|
20075
22214
|
pairs: build_default.Readonly(build_default.Array(isPairConfiguration))
|
|
20076
22215
|
}))));
|
|
20077
22216
|
var LOOP_NODE_TYPES = new Set([
|
|
20078
|
-
|
|
20079
|
-
|
|
20080
|
-
|
|
20081
|
-
|
|
20082
|
-
|
|
22217
|
+
AST_NODE_TYPES11.DoWhileStatement,
|
|
22218
|
+
AST_NODE_TYPES11.ForInStatement,
|
|
22219
|
+
AST_NODE_TYPES11.ForOfStatement,
|
|
22220
|
+
AST_NODE_TYPES11.ForStatement,
|
|
22221
|
+
AST_NODE_TYPES11.WhileStatement
|
|
20083
22222
|
]);
|
|
20084
22223
|
var DEFAULT_ROBLOX_YIELDING_FUNCTIONS = ["task.wait", "wait", "*.WaitForChild", "*.*Async"];
|
|
20085
22224
|
function getCallName(node) {
|
|
20086
22225
|
const { callee } = node;
|
|
20087
|
-
if (callee.type ===
|
|
22226
|
+
if (callee.type === AST_NODE_TYPES11.Identifier)
|
|
20088
22227
|
return callee.name;
|
|
20089
|
-
if (callee.type ===
|
|
20090
|
-
const object3 = callee.object.type ===
|
|
20091
|
-
const property = callee.property.type ===
|
|
22228
|
+
if (callee.type === AST_NODE_TYPES11.MemberExpression) {
|
|
22229
|
+
const object3 = callee.object.type === AST_NODE_TYPES11.Identifier ? callee.object.name : undefined;
|
|
22230
|
+
const property = callee.property.type === AST_NODE_TYPES11.Identifier ? callee.property.name : undefined;
|
|
20092
22231
|
if (object3 !== undefined && property !== undefined)
|
|
20093
22232
|
return `${object3}.${property}`;
|
|
20094
22233
|
}
|
|
@@ -20124,12 +22263,12 @@ function isLoopLikeStatement(node) {
|
|
|
20124
22263
|
return LOOP_NODE_TYPES.has(node.type);
|
|
20125
22264
|
}
|
|
20126
22265
|
function isSwitchStatement(node) {
|
|
20127
|
-
return node?.type ===
|
|
22266
|
+
return node?.type === AST_NODE_TYPES11.SwitchStatement;
|
|
20128
22267
|
}
|
|
20129
22268
|
function findLabeledStatementBody(label, startingNode) {
|
|
20130
22269
|
let current = startingNode;
|
|
20131
22270
|
while (current) {
|
|
20132
|
-
if (current.type ===
|
|
22271
|
+
if (current.type === AST_NODE_TYPES11.LabeledStatement && current.label.name === label.name)
|
|
20133
22272
|
return current.body;
|
|
20134
22273
|
current = current.parent ?? undefined;
|
|
20135
22274
|
}
|
|
@@ -20382,7 +22521,7 @@ var rule = {
|
|
|
20382
22521
|
function onIfConsequentExit(node) {
|
|
20383
22522
|
const consequentNode = node;
|
|
20384
22523
|
const { parent } = consequentNode;
|
|
20385
|
-
if (parent?.type ===
|
|
22524
|
+
if (parent?.type === AST_NODE_TYPES11.IfStatement) {
|
|
20386
22525
|
const branches = branchStacks.get(parent) ?? [];
|
|
20387
22526
|
branches.push(cloneStack());
|
|
20388
22527
|
branchStacks.set(parent, branches);
|
|
@@ -20397,7 +22536,7 @@ var rule = {
|
|
|
20397
22536
|
function onIfAlternateExit(node) {
|
|
20398
22537
|
const alternateNode = node;
|
|
20399
22538
|
const { parent } = alternateNode;
|
|
20400
|
-
if (parent?.type ===
|
|
22539
|
+
if (parent?.type === AST_NODE_TYPES11.IfStatement) {
|
|
20401
22540
|
const branches = branchStacks.get(parent) ?? [];
|
|
20402
22541
|
branches.push(cloneStack());
|
|
20403
22542
|
branchStacks.set(parent, branches);
|
|
@@ -20446,7 +22585,7 @@ var rule = {
|
|
|
20446
22585
|
function onTryBlockExit(node) {
|
|
20447
22586
|
const blockNode = node;
|
|
20448
22587
|
const { parent } = blockNode;
|
|
20449
|
-
if (parent?.type ===
|
|
22588
|
+
if (parent?.type === AST_NODE_TYPES11.TryStatement) {
|
|
20450
22589
|
const branches = branchStacks.get(parent) ?? [];
|
|
20451
22590
|
branches.push(cloneStack());
|
|
20452
22591
|
branchStacks.set(parent, branches);
|
|
@@ -20465,7 +22604,7 @@ var rule = {
|
|
|
20465
22604
|
function onCatchClauseExit(node) {
|
|
20466
22605
|
const catchNode = node;
|
|
20467
22606
|
const { parent } = catchNode;
|
|
20468
|
-
if (parent?.type ===
|
|
22607
|
+
if (parent?.type === AST_NODE_TYPES11.TryStatement) {
|
|
20469
22608
|
const branches = branchStacks.get(parent) ?? [];
|
|
20470
22609
|
branches.push(cloneStack());
|
|
20471
22610
|
branchStacks.set(parent, branches);
|
|
@@ -20528,7 +22667,7 @@ var rule = {
|
|
|
20528
22667
|
function onSwitchCaseExit(node) {
|
|
20529
22668
|
const caseNode = node;
|
|
20530
22669
|
const { parent } = caseNode;
|
|
20531
|
-
if (parent?.type ===
|
|
22670
|
+
if (parent?.type === AST_NODE_TYPES11.SwitchStatement) {
|
|
20532
22671
|
const branches = branchStacks.get(parent) ?? [];
|
|
20533
22672
|
branches.push(cloneStack());
|
|
20534
22673
|
branchStacks.set(parent, branches);
|
|
@@ -20559,7 +22698,7 @@ var rule = {
|
|
|
20559
22698
|
for (const { opener, config, node: node2 } of openerStack) {
|
|
20560
22699
|
const validClosers = getValidClosers(config);
|
|
20561
22700
|
const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
|
|
20562
|
-
const statementType = statementNode.type ===
|
|
22701
|
+
const statementType = statementNode.type === AST_NODE_TYPES11.ReturnStatement ? "return" : "throw";
|
|
20563
22702
|
const lineNumber = statementNode.loc?.start.line ?? 0;
|
|
20564
22703
|
context.report({
|
|
20565
22704
|
data: {
|
|
@@ -20576,7 +22715,7 @@ var rule = {
|
|
|
20576
22715
|
const statementNode = node;
|
|
20577
22716
|
if (openerStack.length === 0)
|
|
20578
22717
|
return;
|
|
20579
|
-
const targetLoop = statementNode.type ===
|
|
22718
|
+
const targetLoop = statementNode.type === AST_NODE_TYPES11.ContinueStatement ? resolveContinueTargetLoop(statementNode) : resolveBreakTargetLoop(statementNode);
|
|
20580
22719
|
if (!targetLoop)
|
|
20581
22720
|
return;
|
|
20582
22721
|
for (const { node: openerNode, config, opener, loopAncestors } of openerStack) {
|
|
@@ -20584,7 +22723,7 @@ var rule = {
|
|
|
20584
22723
|
continue;
|
|
20585
22724
|
const validClosers = getValidClosers(config);
|
|
20586
22725
|
const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
|
|
20587
|
-
const statementType = statementNode.type ===
|
|
22726
|
+
const statementType = statementNode.type === AST_NODE_TYPES11.BreakStatement ? "break" : "continue";
|
|
20588
22727
|
const lineNumber = statementNode.loc?.start.line ?? 0;
|
|
20589
22728
|
context.report({
|
|
20590
22729
|
data: {
|
|
@@ -20722,7 +22861,7 @@ var rule = {
|
|
|
20722
22861
|
continue;
|
|
20723
22862
|
const validClosers = getValidClosers(config);
|
|
20724
22863
|
const closer = validClosers.length === 1 ? validClosers[0] ?? "closer" : validClosers.join("' or '");
|
|
20725
|
-
const asyncType = asyncNode.type ===
|
|
22864
|
+
const asyncType = asyncNode.type === AST_NODE_TYPES11.AwaitExpression ? "await" : "yield";
|
|
20726
22865
|
context.report({
|
|
20727
22866
|
data: { asyncType, closer, opener },
|
|
20728
22867
|
messageId: "asyncViolation",
|
|
@@ -21244,6 +23383,116 @@ var requireReactComponentKeys = {
|
|
|
21244
23383
|
};
|
|
21245
23384
|
var require_react_component_keys_default = requireReactComponentKeys;
|
|
21246
23385
|
|
|
23386
|
+
// src/rules/strict-component-boundaries.ts
|
|
23387
|
+
import { basename, extname, relative } from "node:path";
|
|
23388
|
+
|
|
23389
|
+
// src/utilities/resolve-import.ts
|
|
23390
|
+
var import_oxc_resolver = __toESM(require_oxc_resolver(), 1);
|
|
23391
|
+
import { dirname } from "node:path";
|
|
23392
|
+
var resolver = new import_oxc_resolver.ResolverFactory({
|
|
23393
|
+
extensions: [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".json", ".node"]
|
|
23394
|
+
});
|
|
23395
|
+
function resolveRelativeImport(importSource, sourceFile) {
|
|
23396
|
+
if (!importSource.startsWith("."))
|
|
23397
|
+
return { found: false };
|
|
23398
|
+
const { path: path2 } = resolver.sync(dirname(sourceFile), importSource);
|
|
23399
|
+
if (path2 === undefined || path2 === "")
|
|
23400
|
+
return { found: false };
|
|
23401
|
+
return { found: true, path: path2 };
|
|
23402
|
+
}
|
|
23403
|
+
|
|
23404
|
+
// src/rules/strict-component-boundaries.ts
|
|
23405
|
+
function toRegExp(pattern4) {
|
|
23406
|
+
return new RegExp(pattern4, "i");
|
|
23407
|
+
}
|
|
23408
|
+
function pathSegmentsFromSource(source) {
|
|
23409
|
+
return source.split("/").filter((part) => !part.startsWith("."));
|
|
23410
|
+
}
|
|
23411
|
+
function countParentTraversals(pathDiff) {
|
|
23412
|
+
return pathDiff.split("/").filter((part) => part === "..").length;
|
|
23413
|
+
}
|
|
23414
|
+
function hasAnotherComponentInPath(pathParts) {
|
|
23415
|
+
return pathParts.some((part) => part === toPascalCase(part) && !part.includes("."));
|
|
23416
|
+
}
|
|
23417
|
+
function hasDirectoryInPath(pathParts, directory) {
|
|
23418
|
+
return pathParts.includes(directory);
|
|
23419
|
+
}
|
|
23420
|
+
function isIndexFile(filePath) {
|
|
23421
|
+
return basename(filePath, extname(filePath)) === "index";
|
|
23422
|
+
}
|
|
23423
|
+
function isValidFixtureImport(pathParts) {
|
|
23424
|
+
if (!hasDirectoryInPath(pathParts, "fixtures"))
|
|
23425
|
+
return false;
|
|
23426
|
+
const fixtureIndex = pathParts.indexOf("fixtures");
|
|
23427
|
+
const partsBeforeFixture = pathParts.slice(0, fixtureIndex);
|
|
23428
|
+
return !hasAnotherComponentInPath(partsBeforeFixture);
|
|
23429
|
+
}
|
|
23430
|
+
var strictComponentBoundaries = {
|
|
23431
|
+
create(context) {
|
|
23432
|
+
const [{ allow = [], maxDepth = 1 } = {}] = context.options;
|
|
23433
|
+
const allowPatterns = allow.map(toRegExp);
|
|
23434
|
+
return {
|
|
23435
|
+
ImportDeclaration(node) {
|
|
23436
|
+
const importSource = node.source.value;
|
|
23437
|
+
if (typeof importSource !== "string" || !importSource.startsWith("."))
|
|
23438
|
+
return;
|
|
23439
|
+
if (allowPatterns.some((regexp) => regexp.test(importSource)))
|
|
23440
|
+
return;
|
|
23441
|
+
const filename = context.filename ?? "";
|
|
23442
|
+
if (filename === "")
|
|
23443
|
+
return;
|
|
23444
|
+
const resolved = resolveRelativeImport(importSource, filename);
|
|
23445
|
+
if (!resolved.found)
|
|
23446
|
+
return;
|
|
23447
|
+
const pathDifference = relative(filename, resolved.path);
|
|
23448
|
+
const pathParts = pathSegmentsFromSource(pathDifference);
|
|
23449
|
+
const traversals = countParentTraversals(pathDifference);
|
|
23450
|
+
const isDescendingOnly = traversals <= 1;
|
|
23451
|
+
const hasComponentsDir = hasDirectoryInPath(pathParts, "components");
|
|
23452
|
+
if ((!isDescendingOnly || hasComponentsDir) && hasAnotherComponentInPath(pathParts) && pathParts.length > maxDepth && !isIndexFile(pathDifference) && !isValidFixtureImport(pathParts)) {
|
|
23453
|
+
context.report({
|
|
23454
|
+
messageId: "noReachingIntoComponent",
|
|
23455
|
+
node
|
|
23456
|
+
});
|
|
23457
|
+
return;
|
|
23458
|
+
}
|
|
23459
|
+
if (hasDirectoryInPath(pathParts, "components") && pathParts.length > maxDepth + 1 && !isValidFixtureImport(pathParts)) {
|
|
23460
|
+
context.report({
|
|
23461
|
+
messageId: "noReachingIntoComponent",
|
|
23462
|
+
node
|
|
23463
|
+
});
|
|
23464
|
+
}
|
|
23465
|
+
}
|
|
23466
|
+
};
|
|
23467
|
+
},
|
|
23468
|
+
defaultOptions: [{}],
|
|
23469
|
+
meta: {
|
|
23470
|
+
docs: {
|
|
23471
|
+
description: "Prevent module imports between components."
|
|
23472
|
+
},
|
|
23473
|
+
messages: {
|
|
23474
|
+
noReachingIntoComponent: "Do not reach into an individual component's folder for nested modules. Import from the closest shared components folder instead."
|
|
23475
|
+
},
|
|
23476
|
+
schema: [
|
|
23477
|
+
{
|
|
23478
|
+
additionalProperties: false,
|
|
23479
|
+
properties: {
|
|
23480
|
+
allow: {
|
|
23481
|
+
items: { type: "string" },
|
|
23482
|
+
type: "array"
|
|
23483
|
+
},
|
|
23484
|
+
maxDepth: {
|
|
23485
|
+
type: "integer"
|
|
23486
|
+
}
|
|
23487
|
+
},
|
|
23488
|
+
type: "object"
|
|
23489
|
+
}
|
|
23490
|
+
],
|
|
23491
|
+
type: "problem"
|
|
23492
|
+
}
|
|
23493
|
+
};
|
|
23494
|
+
var strict_component_boundaries_default = strictComponentBoundaries;
|
|
23495
|
+
|
|
21247
23496
|
// src/rules/use-exhaustive-dependencies.ts
|
|
21248
23497
|
import { TSESTree as TSESTree10 } from "@typescript-eslint/types";
|
|
21249
23498
|
var FUNCTION_DECLARATIONS = new Set([
|
|
@@ -21569,13 +23818,13 @@ function collectCaptures(node, sourceCode) {
|
|
|
21569
23818
|
const captureSet = new Set;
|
|
21570
23819
|
function visit(current) {
|
|
21571
23820
|
if (current.type === TSESTree10.AST_NODE_TYPES.Identifier) {
|
|
21572
|
-
const { name } = current;
|
|
21573
|
-
if (captureSet.has(
|
|
23821
|
+
const { name: name2 } = current;
|
|
23822
|
+
if (captureSet.has(name2) || GLOBAL_BUILTINS.has(name2) || isInTypePosition(current))
|
|
21574
23823
|
return;
|
|
21575
23824
|
let variable;
|
|
21576
23825
|
let currentScope = sourceCode.getScope(current);
|
|
21577
23826
|
while (currentScope) {
|
|
21578
|
-
variable = currentScope.set.get(
|
|
23827
|
+
variable = currentScope.set.get(name2);
|
|
21579
23828
|
if (variable)
|
|
21580
23829
|
break;
|
|
21581
23830
|
currentScope = currentScope.upper;
|
|
@@ -21595,14 +23844,14 @@ function collectCaptures(node, sourceCode) {
|
|
|
21595
23844
|
testingMetrics.outerScopeSkip += 1;
|
|
21596
23845
|
return;
|
|
21597
23846
|
}
|
|
21598
|
-
captureSet.add(
|
|
23847
|
+
captureSet.add(name2);
|
|
21599
23848
|
const depthNode = findTopmostMemberExpression(current);
|
|
21600
23849
|
const usagePath = nodeToSafeDependencyPath(depthNode, sourceCode);
|
|
21601
23850
|
const depth = getMemberExpressionDepth(depthNode);
|
|
21602
23851
|
captures.push({
|
|
21603
23852
|
depth,
|
|
21604
23853
|
forceDependency: isComputedPropertyIdentifier(current),
|
|
21605
|
-
name,
|
|
23854
|
+
name: name2,
|
|
21606
23855
|
node: depthNode,
|
|
21607
23856
|
usagePath,
|
|
21608
23857
|
variable
|
|
@@ -21650,18 +23899,18 @@ function parseDependencies(node, sourceCode) {
|
|
|
21650
23899
|
if (!element)
|
|
21651
23900
|
continue;
|
|
21652
23901
|
const actualNode = element.type === TSESTree10.AST_NODE_TYPES.SpreadElement ? element.argument : element;
|
|
21653
|
-
const
|
|
23902
|
+
const name2 = nodeToDependencyString(actualNode, sourceCode);
|
|
21654
23903
|
const depth = getMemberExpressionDepth(actualNode);
|
|
21655
23904
|
dependencies4.push({
|
|
21656
23905
|
depth,
|
|
21657
|
-
name,
|
|
23906
|
+
name: name2,
|
|
21658
23907
|
node: actualNode
|
|
21659
23908
|
});
|
|
21660
23909
|
}
|
|
21661
23910
|
return dependencies4;
|
|
21662
23911
|
}
|
|
21663
|
-
function returnName({ name }) {
|
|
21664
|
-
return
|
|
23912
|
+
function returnName({ name: name2 }) {
|
|
23913
|
+
return name2;
|
|
21665
23914
|
}
|
|
21666
23915
|
function isUnstableValue(node) {
|
|
21667
23916
|
return node ? UNSTABLE_VALUES.has(node.type) : false;
|
|
@@ -21795,7 +24044,7 @@ var useExhaustiveDependencies = {
|
|
|
21795
24044
|
}
|
|
21796
24045
|
const maxCaptureDepth = Math.max(...matchingCaptures.map(({ depth }) => depth));
|
|
21797
24046
|
if (dependency.depth > maxCaptureDepth && options3.reportUnnecessaryDependencies) {
|
|
21798
|
-
const newDependencies = dependencies4.filter(({ name }) =>
|
|
24047
|
+
const newDependencies = dependencies4.filter(({ name: name2 }) => name2 !== dependency.name).map(returnName);
|
|
21799
24048
|
const dependencyString = `[${newDependencies.join(", ")}]`;
|
|
21800
24049
|
context.report({
|
|
21801
24050
|
data: { name: dependency.name },
|
|
@@ -21833,7 +24082,7 @@ var useExhaustiveDependencies = {
|
|
|
21833
24082
|
missingCaptures.push(capture);
|
|
21834
24083
|
}
|
|
21835
24084
|
if (missingCaptures.length > 0) {
|
|
21836
|
-
const dependencyNames = dependencies4.map(({ name }) =>
|
|
24085
|
+
const dependencyNames = dependencies4.map(({ name: name2 }) => name2);
|
|
21837
24086
|
const missingPaths = missingCaptures.map(({ usagePath }) => usagePath);
|
|
21838
24087
|
const newDependencies = [...dependencyNames, ...missingPaths].toSorted();
|
|
21839
24088
|
const newDependenciesString = `[${newDependencies.join(", ")}]`;
|
|
@@ -21975,32 +24224,32 @@ var use_exhaustive_dependencies_default = useExhaustiveDependencies;
|
|
|
21975
24224
|
import { TSESTree as TSESTree11 } from "@typescript-eslint/types";
|
|
21976
24225
|
var HOOK_NAME_PATTERN = /^use[A-Z]/;
|
|
21977
24226
|
var COMPONENT_NAME_PATTERN2 = /^[A-Z]/;
|
|
21978
|
-
function isReactHook(
|
|
21979
|
-
return HOOK_NAME_PATTERN.test(
|
|
24227
|
+
function isReactHook(name2) {
|
|
24228
|
+
return HOOK_NAME_PATTERN.test(name2);
|
|
21980
24229
|
}
|
|
21981
|
-
function isComponent(
|
|
21982
|
-
return COMPONENT_NAME_PATTERN2.test(
|
|
24230
|
+
function isComponent(name2) {
|
|
24231
|
+
return COMPONENT_NAME_PATTERN2.test(name2);
|
|
21983
24232
|
}
|
|
21984
24233
|
function isComponentOrHook(node) {
|
|
21985
24234
|
if (node.type === TSESTree11.AST_NODE_TYPES.FunctionDeclaration && node.id) {
|
|
21986
|
-
const { name } = node.id;
|
|
21987
|
-
return isComponent(
|
|
24235
|
+
const { name: name2 } = node.id;
|
|
24236
|
+
return isComponent(name2) || isReactHook(name2);
|
|
21988
24237
|
}
|
|
21989
24238
|
if (node.type === TSESTree11.AST_NODE_TYPES.FunctionExpression || node.type === TSESTree11.AST_NODE_TYPES.ArrowFunctionExpression) {
|
|
21990
24239
|
const { parent } = node;
|
|
21991
|
-
if (
|
|
24240
|
+
if (parent === undefined)
|
|
21992
24241
|
return false;
|
|
21993
24242
|
if (parent.type === TSESTree11.AST_NODE_TYPES.VariableDeclarator && parent.id.type === TSESTree11.AST_NODE_TYPES.Identifier) {
|
|
21994
|
-
const { name } = parent.id;
|
|
21995
|
-
return isComponent(
|
|
24243
|
+
const { name: name2 } = parent.id;
|
|
24244
|
+
return isComponent(name2) || isReactHook(name2);
|
|
21996
24245
|
}
|
|
21997
24246
|
if (parent.type === TSESTree11.AST_NODE_TYPES.Property && parent.key.type === TSESTree11.AST_NODE_TYPES.Identifier) {
|
|
21998
|
-
const { name } = parent.key;
|
|
21999
|
-
return isComponent(
|
|
24247
|
+
const { name: name2 } = parent.key;
|
|
24248
|
+
return isComponent(name2) || isReactHook(name2);
|
|
22000
24249
|
}
|
|
22001
24250
|
if (parent.type === TSESTree11.AST_NODE_TYPES.MethodDefinition && parent.key.type === TSESTree11.AST_NODE_TYPES.Identifier) {
|
|
22002
|
-
const { name } = parent.key;
|
|
22003
|
-
return isComponent(
|
|
24251
|
+
const { name: name2 } = parent.key;
|
|
24252
|
+
return isComponent(name2) || isReactHook(name2);
|
|
22004
24253
|
}
|
|
22005
24254
|
}
|
|
22006
24255
|
return false;
|
|
@@ -22021,21 +24270,24 @@ var FUNCTION_BOUNDARIES2 = new Set([
|
|
|
22021
24270
|
function isInFinallyBlock(node) {
|
|
22022
24271
|
let current = node.parent;
|
|
22023
24272
|
const maxDepth = 20;
|
|
24273
|
+
let inFinallyBlock = false;
|
|
22024
24274
|
for (let depth = 0;depth < maxDepth && current; depth += 1) {
|
|
22025
24275
|
if (FUNCTION_BOUNDARIES2.has(current.type))
|
|
22026
|
-
|
|
24276
|
+
break;
|
|
22027
24277
|
if (current.type === TSESTree11.AST_NODE_TYPES.TryStatement) {
|
|
22028
24278
|
let checkNode = node;
|
|
22029
24279
|
while (checkNode && checkNode !== current) {
|
|
22030
|
-
if (checkNode === current.finalizer)
|
|
22031
|
-
|
|
24280
|
+
if (checkNode === current.finalizer) {
|
|
24281
|
+
inFinallyBlock = true;
|
|
24282
|
+
break;
|
|
24283
|
+
}
|
|
22032
24284
|
checkNode = checkNode.parent;
|
|
22033
24285
|
}
|
|
22034
|
-
|
|
24286
|
+
break;
|
|
22035
24287
|
}
|
|
22036
24288
|
current = current.parent;
|
|
22037
24289
|
}
|
|
22038
|
-
return
|
|
24290
|
+
return inFinallyBlock;
|
|
22039
24291
|
}
|
|
22040
24292
|
function isRecursiveCall(node, functionName) {
|
|
22041
24293
|
if (!functionName)
|
|
@@ -22094,8 +24346,9 @@ var useHookAtTopLevel = {
|
|
|
22094
24346
|
const current = getCurrentContext();
|
|
22095
24347
|
const depth = current ? current.functionDepth + 1 : 0;
|
|
22096
24348
|
const isComponentOrHookFlag = isComponentOrHook(functionNode);
|
|
22097
|
-
if (functionNode.type === TSESTree11.AST_NODE_TYPES.FunctionDeclaration && functionNode.id)
|
|
24349
|
+
if (functionNode.type === TSESTree11.AST_NODE_TYPES.FunctionDeclaration && functionNode.id) {
|
|
22098
24350
|
currentFunctionName = functionNode.id.name;
|
|
24351
|
+
}
|
|
22099
24352
|
if (current?.isComponentOrHook) {
|
|
22100
24353
|
pushContext({
|
|
22101
24354
|
afterEarlyReturn: false,
|
|
@@ -22348,8 +24601,8 @@ function createNoShorthandOptions(options3 = {}) {
|
|
|
22348
24601
|
function createEffectFunctionOptions(options3 = {}) {
|
|
22349
24602
|
return { environment: "standard", hooks: [], ...options3 };
|
|
22350
24603
|
}
|
|
22351
|
-
function createHookConfiguration(
|
|
22352
|
-
return { allowAsync: false, name, ...options3 };
|
|
24604
|
+
function createHookConfiguration(name2, options3 = {}) {
|
|
24605
|
+
return { allowAsync: false, name: name2, ...options3 };
|
|
22353
24606
|
}
|
|
22354
24607
|
function createRequirePairedCallsOptions(options3 = {}) {
|
|
22355
24608
|
return {
|
|
@@ -22423,11 +24676,18 @@ var rules = {
|
|
|
22423
24676
|
"no-shorthand-names": no_shorthand_names_default,
|
|
22424
24677
|
"no-useless-use-spring": no_useless_use_spring_default,
|
|
22425
24678
|
"no-warn": no_warn_default,
|
|
24679
|
+
"prefer-class-properties": prefer_class_properties_default,
|
|
24680
|
+
"prefer-early-return": prefer_early_return_default,
|
|
24681
|
+
"prefer-module-scope-constants": prefer_module_scope_constants_default,
|
|
24682
|
+
"prefer-pascal-case-enums": prefer_pascal_case_enums_default,
|
|
22426
24683
|
"prefer-sequence-overloads": prefer_sequence_overloads_default,
|
|
24684
|
+
"prefer-singular-enums": prefer_singular_enums_default,
|
|
22427
24685
|
"prefer-udim2-shorthand": prefer_udim2_shorthand_default,
|
|
24686
|
+
"react-hooks-strict-return": react_hooks_strict_return_default,
|
|
22428
24687
|
"require-named-effect-functions": require_named_effect_functions_default,
|
|
22429
24688
|
"require-paired-calls": require_paired_calls_default,
|
|
22430
24689
|
"require-react-component-keys": require_react_component_keys_default,
|
|
24690
|
+
"strict-component-boundaries": strict_component_boundaries_default,
|
|
22431
24691
|
"use-exhaustive-dependencies": use_exhaustive_dependencies_default,
|
|
22432
24692
|
"use-hook-at-top-level": use_hook_at_top_level_default
|
|
22433
24693
|
};
|
|
@@ -22478,4 +24738,4 @@ export {
|
|
|
22478
24738
|
createBanInstancesOptions
|
|
22479
24739
|
};
|
|
22480
24740
|
|
|
22481
|
-
//# debugId=
|
|
24741
|
+
//# debugId=746CFBCF1D469D6C64756E2164756E21
|