@antelopejs/tooling-configs 0.7.4 → 0.7.5-next.356.g0d472b3
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 +32 -77
- package/dist/bin/api-diff.mjs +16 -36
- package/dist/bin/capture.mjs +4 -4
- package/dist/bin/check-size.mjs +12 -3
- package/dist/bin/checks.mjs +2 -2
- package/dist/bin/comment-proof.mjs +3 -4
- package/dist/bin/garden.mjs +45 -170
- package/dist/bin/readme-strip.mjs +2 -2
- package/dist/bin/suppressions.mjs +212 -9
- package/dist/bin/sync.mjs +284 -189
- package/dist/bin/tsc.mjs +1 -1
- package/dist/bin/verify.mjs +33 -613
- package/dist/{checks-BTFf0Evy.mjs → checks-C60vMFin.mjs} +130 -283
- package/dist/{docs-compat-BmczGA1d.mjs → docs-compat-CdgBviGf.mjs} +2 -2
- package/dist/eslint.mjs +1 -1
- package/dist/{files-C-JJhExM.mjs → files-BbzJEk-L.mjs} +5 -4
- package/dist/formal/index.mjs +1 -1
- package/dist/{guardrails-CNmSFSxO.mjs → guardrails-Dron1AbR.mjs} +5 -611
- package/dist/{map-BYkmnvNw.mjs → map-CbNbypUa.mjs} +2 -2
- package/dist/oxc/anti-slop/index.mjs +22 -964
- package/dist/oxc/guardrails/index.d.mts +1 -1
- package/dist/oxc/guardrails/index.mjs +1 -1
- package/dist/oxc/lint.d.mts +2 -14
- package/dist/oxc/lint.mjs +3 -20
- package/dist/{package-1pH5I0TF.mjs → package-7oylgBeT.mjs} +3 -12
- package/dist/{workflow-C-oBwL2H.mjs → renovate-D0su_v9p.mjs} +191 -91
- package/dist/{suppression-budget-BeJIgSTO.mjs → suppression-budget-De9nUzlD.mjs} +33 -13
- package/dist/{suppressions-BvWGA463.mjs → suppressions-CfJwL0fN.mjs} +1 -1
- package/dist/{templates-Df6SlGLA.mjs → templates-DLW0Ubfk.mjs} +26 -29
- package/dist/typescript-C7eU-cig.mjs +581 -0
- package/dist/verify/index.d.mts +5 -24
- package/package.json +1 -3
- package/dist/bin/body-check.d.mts +0 -1
- package/dist/bin/body-check.mjs +0 -350
- package/dist/bin/ratchet.d.mts +0 -1
- package/dist/bin/ratchet.mjs +0 -375
- package/dist/ceilings-B7KayYIG.mjs +0 -76
- package/dist/oxlint-CIeonWMB.mjs +0 -133
- package/dist/proof-stamp-Bg4ULLvr.mjs +0 -342
- package/dist/ratchet-CPpvIU6Y.mjs +0 -453
- package/dist/renames-L2owF5GD.mjs +0 -59
- package/dist/size-CCGLY4Ke.mjs +0 -18
- package/dist/suppression-base-CDiFJse2.mjs +0 -120
- package/dist/typescript-B0df00nl.mjs +0 -292
|
@@ -1518,7 +1518,7 @@ const noReadThenInsertRule = defineRule({
|
|
|
1518
1518
|
});
|
|
1519
1519
|
//#endregion
|
|
1520
1520
|
//#region src/oxc/guardrails/self-package.ts
|
|
1521
|
-
function isObject
|
|
1521
|
+
function isObject(value) {
|
|
1522
1522
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1523
1523
|
}
|
|
1524
1524
|
function isText(value) {
|
|
@@ -1531,12 +1531,12 @@ function readManifest(directory) {
|
|
|
1531
1531
|
} catch {
|
|
1532
1532
|
return;
|
|
1533
1533
|
}
|
|
1534
|
-
if (!isObject
|
|
1534
|
+
if (!isObject(parsed) || !isText(parsed.name)) return void 0;
|
|
1535
1535
|
const { antelopeJs } = parsed;
|
|
1536
1536
|
return {
|
|
1537
1537
|
name: parsed.name,
|
|
1538
1538
|
exports: parsed.exports,
|
|
1539
|
-
testedByAjs: isObject
|
|
1539
|
+
testedByAjs: isObject(antelopeJs) && isText(antelopeJs.test)
|
|
1540
1540
|
};
|
|
1541
1541
|
}
|
|
1542
1542
|
/** The nearest enclosing package that has a name, with the directory holding its manifest. */
|
|
@@ -1559,7 +1559,7 @@ function selfSubpath(name, specifier) {
|
|
|
1559
1559
|
return specifier.startsWith(`${name}/`) ? `./${specifier.slice(name.length + 1)}` : void 0;
|
|
1560
1560
|
}
|
|
1561
1561
|
function exportKeys(exportsField) {
|
|
1562
|
-
if (!isObject
|
|
1562
|
+
if (!isObject(exportsField)) return ["."];
|
|
1563
1563
|
const keys = Object.keys(exportsField);
|
|
1564
1564
|
return keys.some((key) => key.startsWith(".")) ? keys : ["."];
|
|
1565
1565
|
}
|
|
@@ -2183,611 +2183,6 @@ const noUnrunQueryRule = defineRule({
|
|
|
2183
2183
|
}
|
|
2184
2184
|
});
|
|
2185
2185
|
//#endregion
|
|
2186
|
-
//#region src/oxc/guardrails/any-leaks.ts
|
|
2187
|
-
const UNTYPED$1 = typescript6_default.TypeFlags.Any | typescript6_default.TypeFlags.Unknown;
|
|
2188
|
-
/** Whether `type` is `any` itself, not an error type from an import the program cannot resolve, such as another component. */
|
|
2189
|
-
function isAnyType(checker, type) {
|
|
2190
|
-
return type === checker.getAnyType();
|
|
2191
|
-
}
|
|
2192
|
-
/** Whether `type` is `unknown`. */
|
|
2193
|
-
function isUnknown(type) {
|
|
2194
|
-
return type !== void 0 && (type.flags & typescript6_default.TypeFlags.Unknown) !== 0;
|
|
2195
|
-
}
|
|
2196
|
-
/** The element type of an array or a readonly array, whether or not an alias names it, `undefined` for another type. */
|
|
2197
|
-
function arrayElement(checker, type) {
|
|
2198
|
-
return checker.isArrayType(type) ? checker.getIndexTypeOfType(type, typescript6_default.IndexKind.Number) : void 0;
|
|
2199
|
-
}
|
|
2200
|
-
/** Whether `type` is undeclared, `any` or `unknown`, an error type included. */
|
|
2201
|
-
function takesAnything(type) {
|
|
2202
|
-
return type === void 0 || (type.flags & UNTYPED$1) !== 0;
|
|
2203
|
-
}
|
|
2204
|
-
/** Whether `type` is an object type, such as an interface, a reference or an anonymous type. */
|
|
2205
|
-
function isObjectType(type) {
|
|
2206
|
-
return (type.flags & typescript6_default.TypeFlags.Object) !== 0;
|
|
2207
|
-
}
|
|
2208
|
-
/** Whether `type` is a reference to a generic type, such as `Set<string>`, an array or a tuple. */
|
|
2209
|
-
function isReference$1(type) {
|
|
2210
|
-
return (type.objectFlags & typescript6_default.ObjectFlags.Reference) !== 0;
|
|
2211
|
-
}
|
|
2212
|
-
/**
|
|
2213
|
-
* The generic reference `type` is, such as `Set<any>`, `any[]` or a tuple,
|
|
2214
|
-
* for comparing by its generic target as tsgolint does. A deferred reference,
|
|
2215
|
-
* such as one a type alias names as in `type AA = any[]` or `G<any>`, is not
|
|
2216
|
-
* compared, as tsgolint compares only references that are not deferred.
|
|
2217
|
-
*/
|
|
2218
|
-
function reference(type) {
|
|
2219
|
-
return isObjectType(type) && isReference$1(type) && type.node === void 0 ? type : void 0;
|
|
2220
|
-
}
|
|
2221
|
-
/** Whether `node` is `new Map()`, which the lib types `Map<any, any>` and tsgolint lets into any `Map`. */
|
|
2222
|
-
function isEmptyMap(node) {
|
|
2223
|
-
return node !== void 0 && typescript6_default.isNewExpression(node) && typescript6_default.isIdentifier(node.expression) && node.expression.text === "Map" && node.typeArguments === void 0 && (node.arguments === void 0 || node.arguments.length === 0);
|
|
2224
|
-
}
|
|
2225
|
-
/**
|
|
2226
|
-
* Whether a `sender` value lets `any` into a `receiver` slot as an argument,
|
|
2227
|
-
* an assignment or a type argument: `any` into a slot that is undeclared or
|
|
2228
|
-
* typed neither `any` nor `unknown`, or a generic reference holding `any`, as
|
|
2229
|
-
* in `any[]` or `Set<any>`, into one of the same generic target, such as
|
|
2230
|
-
* `string[]` or `Set<string>`, with another type in that position. `readonly`
|
|
2231
|
-
* and labelled tuples have targets of their own, and `node`, the expression
|
|
2232
|
-
* that sends the value, lets `new Map()` in. A pair of types is compared once,
|
|
2233
|
-
* however deep, as tsgolint compares it.
|
|
2234
|
-
*/
|
|
2235
|
-
function leaks(checker, sender, receiver, node) {
|
|
2236
|
-
if (isEmptyMap(node)) return false;
|
|
2237
|
-
const compared = /* @__PURE__ */ new Map();
|
|
2238
|
-
function compare(from, to) {
|
|
2239
|
-
if (isAnyType(checker, from)) return to === void 0 || !takesAnything(to);
|
|
2240
|
-
if (to === void 0) return false;
|
|
2241
|
-
const seen = compared.get(from) ?? /* @__PURE__ */ new Set();
|
|
2242
|
-
if (seen.has(to)) return false;
|
|
2243
|
-
compared.set(from, seen.add(to));
|
|
2244
|
-
const sent = reference(from);
|
|
2245
|
-
const slot = reference(to);
|
|
2246
|
-
if (sent === void 0 || slot === void 0 || sent.target !== slot.target) return false;
|
|
2247
|
-
const slots = checker.getTypeArguments(slot);
|
|
2248
|
-
return checker.getTypeArguments(sent).some((argument, index) => compare(argument, slots[index]));
|
|
2249
|
-
}
|
|
2250
|
-
return compare(sender, receiver);
|
|
2251
|
-
}
|
|
2252
|
-
/** Whether `type` is `any` or an array of `any`, as a spread or rest holds it. */
|
|
2253
|
-
function isAnyOrAnyArray(checker, type) {
|
|
2254
|
-
const element = arrayElement(checker, type);
|
|
2255
|
-
return isAnyType(checker, type) || element !== void 0 && isAnyType(checker, element);
|
|
2256
|
-
}
|
|
2257
|
-
//#endregion
|
|
2258
|
-
//#region src/oxc/guardrails/any-arguments.ts
|
|
2259
|
-
function isTupleTarget(target) {
|
|
2260
|
-
return (target.objectFlags & typescript6_default.ObjectFlags.Tuple) !== 0;
|
|
2261
|
-
}
|
|
2262
|
-
function tupleOf(type) {
|
|
2263
|
-
if (!isObjectType(type) || !isReference$1(type)) return void 0;
|
|
2264
|
-
const { target } = type;
|
|
2265
|
-
return isTupleTarget(target) ? {
|
|
2266
|
-
reference: type,
|
|
2267
|
-
target
|
|
2268
|
-
} : void 0;
|
|
2269
|
-
}
|
|
2270
|
-
function restOf(checker, type, index) {
|
|
2271
|
-
const element = arrayElement(checker, type);
|
|
2272
|
-
if (element !== void 0) return {
|
|
2273
|
-
kind: "element",
|
|
2274
|
-
type: element
|
|
2275
|
-
};
|
|
2276
|
-
const tuple = tupleOf(type);
|
|
2277
|
-
return tuple === void 0 ? {
|
|
2278
|
-
kind: "element",
|
|
2279
|
-
type
|
|
2280
|
-
} : {
|
|
2281
|
-
kind: "tuple",
|
|
2282
|
-
types: checker.getTypeArguments(tuple.reference),
|
|
2283
|
-
index
|
|
2284
|
-
};
|
|
2285
|
-
}
|
|
2286
|
-
function calleeOf(call) {
|
|
2287
|
-
return typescript6_default.isTaggedTemplateExpression(call) ? call.tag : call.expression;
|
|
2288
|
-
}
|
|
2289
|
-
function argumentsOf(call) {
|
|
2290
|
-
if (!typescript6_default.isTaggedTemplateExpression(call)) return call.arguments ?? [];
|
|
2291
|
-
return typescript6_default.isTemplateExpression(call.template) ? call.template.templateSpans.map((span) => span.expression) : [];
|
|
2292
|
-
}
|
|
2293
|
-
function parameterCursor(checker, call, signature) {
|
|
2294
|
-
const fixed = [];
|
|
2295
|
-
let rest;
|
|
2296
|
-
for (const [index, parameter] of signature.getParameters().entries()) {
|
|
2297
|
-
const type = checker.getTypeOfSymbolAtLocation(parameter, call);
|
|
2298
|
-
const declaration = parameter.getDeclarations()?.[0];
|
|
2299
|
-
if (declaration !== void 0 && typescript6_default.isParameter(declaration) && declaration.dotDotDotToken !== void 0) {
|
|
2300
|
-
rest = restOf(checker, type, index);
|
|
2301
|
-
break;
|
|
2302
|
-
}
|
|
2303
|
-
fixed.push(type);
|
|
2304
|
-
}
|
|
2305
|
-
let position = 0;
|
|
2306
|
-
let consumed = false;
|
|
2307
|
-
return {
|
|
2308
|
-
next() {
|
|
2309
|
-
const index = position;
|
|
2310
|
-
position += 1;
|
|
2311
|
-
if (index < fixed.length && !consumed) return fixed[index];
|
|
2312
|
-
if (rest === void 0) return void 0;
|
|
2313
|
-
if (rest.kind === "element") return rest.type;
|
|
2314
|
-
const last = rest.types.at(-1);
|
|
2315
|
-
return consumed ? last : rest.types[index - rest.index] ?? last;
|
|
2316
|
-
},
|
|
2317
|
-
consumeRest() {
|
|
2318
|
-
consumed = true;
|
|
2319
|
-
}
|
|
2320
|
-
};
|
|
2321
|
-
}
|
|
2322
|
-
/**
|
|
2323
|
-
* The arguments of `call` that pass `any` to a typed parameter, as
|
|
2324
|
-
* `typescript/no-unsafe-argument` reports them: each argument against the
|
|
2325
|
-
* parameter it fills, a spread `any` or `any[]` once, and each element of a
|
|
2326
|
-
* spread tuple against the parameter that element fills, so one spread can be
|
|
2327
|
-
* reported once per element. The substitutions of a tagged template fill the
|
|
2328
|
-
* parameters after the one its template strings fill. A call whose callee is
|
|
2329
|
-
* `any` is left alone.
|
|
2330
|
-
*/
|
|
2331
|
-
function unsafeArguments(checker, call) {
|
|
2332
|
-
const args = argumentsOf(call);
|
|
2333
|
-
if (args.length === 0 || isAnyType(checker, checker.getTypeAtLocation(calleeOf(call)))) return [];
|
|
2334
|
-
const signature = checker.getResolvedSignature(call);
|
|
2335
|
-
if (signature === void 0) return [];
|
|
2336
|
-
const cursor = parameterCursor(checker, call, signature);
|
|
2337
|
-
if (typescript6_default.isTaggedTemplateExpression(call)) cursor.next();
|
|
2338
|
-
return args.flatMap((argument) => {
|
|
2339
|
-
if (!typescript6_default.isSpreadElement(argument)) {
|
|
2340
|
-
const parameter = cursor.next();
|
|
2341
|
-
return parameter !== void 0 && leaks(checker, checker.getTypeAtLocation(argument), parameter, argument) ? [argument] : [];
|
|
2342
|
-
}
|
|
2343
|
-
const spread = checker.getTypeAtLocation(argument.expression);
|
|
2344
|
-
if (isAnyOrAnyArray(checker, spread)) return [argument];
|
|
2345
|
-
const tuple = tupleOf(spread);
|
|
2346
|
-
if (tuple === void 0) return [];
|
|
2347
|
-
const unsafe = checker.getTypeArguments(tuple.reference).flatMap((element) => {
|
|
2348
|
-
const parameter = cursor.next();
|
|
2349
|
-
return parameter !== void 0 && leaks(checker, element, parameter) ? [argument] : [];
|
|
2350
|
-
});
|
|
2351
|
-
if ((tuple.target.combinedFlags & typescript6_default.ElementFlags.Variable) !== 0) cursor.consumeRest();
|
|
2352
|
-
return unsafe;
|
|
2353
|
-
});
|
|
2354
|
-
}
|
|
2355
|
-
//#endregion
|
|
2356
|
-
//#region src/oxc/guardrails/type-order.ts
|
|
2357
|
-
function isObject(type) {
|
|
2358
|
-
return (type.flags & typescript6_default.TypeFlags.Object) !== 0;
|
|
2359
|
-
}
|
|
2360
|
-
function isReference(type) {
|
|
2361
|
-
return isObject(type) && (type.objectFlags & typescript6_default.ObjectFlags.Reference) !== 0;
|
|
2362
|
-
}
|
|
2363
|
-
function compareText(a, b) {
|
|
2364
|
-
if (a === b) return 0;
|
|
2365
|
-
return a < b ? -1 : 1;
|
|
2366
|
-
}
|
|
2367
|
-
/** The symbol tsgo orders a type by name: its alias's, or its own for a type parameter, a class, an interface or a reference. */
|
|
2368
|
-
function nameSymbol(type) {
|
|
2369
|
-
if (type.aliasSymbol !== void 0) return type.aliasSymbol;
|
|
2370
|
-
return (type.flags & typescript6_default.TypeFlags.TypeParameter) !== 0 || isObject(type) && (type.objectFlags & (typescript6_default.ObjectFlags.ClassOrInterface | typescript6_default.ObjectFlags.Reference)) !== 0 ? type.getSymbol() : void 0;
|
|
2371
|
-
}
|
|
2372
|
-
/** Nodes by position in one file. Nodes in different files compare equal, as the order tsgo gives its program's files is not this program's. */
|
|
2373
|
-
function compareNodes(a, b) {
|
|
2374
|
-
if (a === b) return 0;
|
|
2375
|
-
if (a === void 0) return 1;
|
|
2376
|
-
if (b === void 0) return -1;
|
|
2377
|
-
return a.getSourceFile() === b.getSourceFile() ? a.pos - b.pos : 0;
|
|
2378
|
-
}
|
|
2379
|
-
function compareSymbols(a, b) {
|
|
2380
|
-
if (a === b) return 0;
|
|
2381
|
-
if (a === void 0) return 1;
|
|
2382
|
-
if (b === void 0) return -1;
|
|
2383
|
-
const first = a.declarations?.[0];
|
|
2384
|
-
const second = b.declarations?.[0];
|
|
2385
|
-
if (first !== void 0 && second !== void 0) {
|
|
2386
|
-
const byNode = compareNodes(first, second);
|
|
2387
|
-
if (byNode !== 0) return byNode;
|
|
2388
|
-
} else if (first !== void 0) return -1;
|
|
2389
|
-
else if (second !== void 0) return 1;
|
|
2390
|
-
return compareText(a.name, b.name);
|
|
2391
|
-
}
|
|
2392
|
-
/**
|
|
2393
|
-
* The order tsgo, the checker tsgolint runs, gives the members of a union:
|
|
2394
|
-
* by type flags, then named types by name, unnamed ones after them, then
|
|
2395
|
-
* object types by their symbol's declaration, references first, and
|
|
2396
|
-
* intersections by their members. Where tsgo falls back to type creation
|
|
2397
|
-
* order this keeps the order the types already have, as a TypeScript 6 union
|
|
2398
|
-
* lists its members in creation order. So does a tie tsgo breaks with data
|
|
2399
|
-
* TypeScript 6 keeps internal: the type mappers of two instantiations of one
|
|
2400
|
-
* anonymous type, and the file order of tsgo's program.
|
|
2401
|
-
*/
|
|
2402
|
-
function typeOrder(checker) {
|
|
2403
|
-
function compareLists(a, b) {
|
|
2404
|
-
const first = a ?? [];
|
|
2405
|
-
const second = b ?? [];
|
|
2406
|
-
if (first.length !== second.length) return first.length - second.length;
|
|
2407
|
-
for (const [index, type] of first.entries()) {
|
|
2408
|
-
const other = second[index];
|
|
2409
|
-
const order = other === void 0 ? 0 : compare(type, other);
|
|
2410
|
-
if (order !== 0) return order;
|
|
2411
|
-
}
|
|
2412
|
-
return 0;
|
|
2413
|
-
}
|
|
2414
|
-
function compareNames(a, b) {
|
|
2415
|
-
const first = nameSymbol(a);
|
|
2416
|
-
const second = nameSymbol(b);
|
|
2417
|
-
if (first === second) return a.aliasSymbol === void 0 ? 0 : compareLists(a.aliasTypeArguments, b.aliasTypeArguments);
|
|
2418
|
-
if (first === void 0) return 1;
|
|
2419
|
-
if (second === void 0) return -1;
|
|
2420
|
-
return compareText(first.name, second.name);
|
|
2421
|
-
}
|
|
2422
|
-
function compareObjects(a, b) {
|
|
2423
|
-
const bySymbol = compareSymbols(a.getSymbol(), b.getSymbol());
|
|
2424
|
-
if (bySymbol !== 0) return bySymbol;
|
|
2425
|
-
if (isReference(a) && isReference(b)) return a.node === void 0 && b.node === void 0 ? compareLists(checker.getTypeArguments(a), checker.getTypeArguments(b)) : compareNodes(a.node, b.node);
|
|
2426
|
-
if (isReference(a)) return -1;
|
|
2427
|
-
return isReference(b) ? 1 : 0;
|
|
2428
|
-
}
|
|
2429
|
-
function compare(a, b) {
|
|
2430
|
-
if (a === b) return 0;
|
|
2431
|
-
if (a.flags !== b.flags) return a.flags - b.flags;
|
|
2432
|
-
const byName = compareNames(a, b);
|
|
2433
|
-
if (byName !== 0) return byName;
|
|
2434
|
-
if (isObject(a) && isObject(b)) return compareObjects(a, b);
|
|
2435
|
-
if (a.isUnionOrIntersection() && b.isUnionOrIntersection()) return compareLists(a.types, b.types);
|
|
2436
|
-
if (a.isStringLiteral() && b.isStringLiteral()) return compareText(a.value, b.value);
|
|
2437
|
-
return a.isNumberLiteral() && b.isNumberLiteral() ? a.value - b.value : 0;
|
|
2438
|
-
}
|
|
2439
|
-
return compare;
|
|
2440
|
-
}
|
|
2441
|
-
//#endregion
|
|
2442
|
-
//#region src/oxc/guardrails/any-returns.ts
|
|
2443
|
-
function anyKind(checker, type) {
|
|
2444
|
-
if (isAnyType(checker, type)) return "any";
|
|
2445
|
-
const element = arrayElement(checker, type);
|
|
2446
|
-
if (element !== void 0 && isAnyType(checker, element)) return "any[]";
|
|
2447
|
-
return (type.isUnionOrIntersection() ? type.types : [type]).some((part) => {
|
|
2448
|
-
const awaited = checker.getAwaitedType(part);
|
|
2449
|
-
return awaited !== void 0 && isAnyType(checker, awaited);
|
|
2450
|
-
}) ? "Promise<any>" : "safe";
|
|
2451
|
-
}
|
|
2452
|
-
/** The function a returned `value` leaves. */
|
|
2453
|
-
function ownerOf(value) {
|
|
2454
|
-
let owner = value.parent;
|
|
2455
|
-
while (!typescript6_default.isFunctionLike(owner)) {
|
|
2456
|
-
if (typescript6_default.isSourceFile(owner)) return void 0;
|
|
2457
|
-
owner = owner.parent;
|
|
2458
|
-
}
|
|
2459
|
-
return owner;
|
|
2460
|
-
}
|
|
2461
|
-
/** The type typescript-eslint's `getContextualType` gives a function expression: the parameter's at an argument, the annotation's in an annotated declaration, the target's at the right of an assignment, and none elsewhere, as in an object literal, an array, `as`, `satisfies`, a conditional, parentheses or a return. */
|
|
2462
|
-
function contextOf(checker, node) {
|
|
2463
|
-
const { parent } = node;
|
|
2464
|
-
if (typescript6_default.isCallExpression(parent) || typescript6_default.isNewExpression(parent)) return parent.expression === node ? void 0 : checker.getContextualType(node);
|
|
2465
|
-
if (typescript6_default.isVariableDeclaration(parent) || typescript6_default.isPropertyDeclaration(parent) || typescript6_default.isParameter(parent)) return parent.type && checker.getTypeFromTypeNode(parent.type);
|
|
2466
|
-
if (typescript6_default.isJsxExpression(parent)) return checker.getContextualType(parent);
|
|
2467
|
-
if (typescript6_default.isBinaryExpression(parent) && parent.operatorToken.kind === typescript6_default.SyntaxKind.EqualsToken && parent.right === node) return checker.getTypeAtLocation(parent.left);
|
|
2468
|
-
return typescript6_default.isTemplateSpan(parent) ? checker.getContextualType(node) : void 0;
|
|
2469
|
-
}
|
|
2470
|
-
/** The type whose call signatures declare what `owner` returns: a function expression's context, else its own type, as for a declaration, whose overloads leave its implementation out, or a getter, whose type is its property's and has no signature. */
|
|
2471
|
-
function declaringType(checker, owner) {
|
|
2472
|
-
return (typescript6_default.isArrowFunction(owner) || typescript6_default.isFunctionExpression(owner) ? contextOf(checker, owner) : void 0) ?? checker.getTypeAtLocation(owner);
|
|
2473
|
-
}
|
|
2474
|
-
/** The call signatures of `type` as tsgolint lists them: each union member's in turn, in the order {@link typeOrder} gives them, and an intersection's only when one member alone is callable. */
|
|
2475
|
-
function callSignatures(checker, type) {
|
|
2476
|
-
if (type.isUnion()) return type.types.toSorted(typeOrder(checker)).flatMap((member) => callSignatures(checker, member));
|
|
2477
|
-
if (!type.isIntersection()) return type.getCallSignatures();
|
|
2478
|
-
const callable = type.types.map((member) => callSignatures(checker, member)).filter((signatures) => signatures.length > 0);
|
|
2479
|
-
return callable.length === 1 ? callable[0] ?? [] : [];
|
|
2480
|
-
}
|
|
2481
|
-
/** Whether a declared return in `returns` excuses an annotated function returning `sender`: the type itself, `any` or `unknown`, or, for an async function, one whose awaited type is the awaited `sender`, `any` or `unknown`. */
|
|
2482
|
-
function annotationExcuses(checker, sender, returns, isAsync) {
|
|
2483
|
-
return returns.some((declared) => {
|
|
2484
|
-
if (declared === sender || takesAnything(declared)) return true;
|
|
2485
|
-
if (!isAsync) return false;
|
|
2486
|
-
const awaited = checker.getAwaitedType(declared);
|
|
2487
|
-
return awaited === checker.getAwaitedType(sender) || awaited !== void 0 && takesAnything(awaited);
|
|
2488
|
-
});
|
|
2489
|
-
}
|
|
2490
|
-
/** Whether a declared return in `returns` excuses a returned `any`, `any[]` or `Promise<any>`: `unknown`, `unknown[]` or a promise of `unknown`, each read without awaiting the declared return, or a `Promise<any>` that a function not async returns. */
|
|
2491
|
-
function anyExcuses(checker, kind, returns, isAsync) {
|
|
2492
|
-
if (kind === "Promise<any>" && !isAsync) return true;
|
|
2493
|
-
return returns.some((declared) => {
|
|
2494
|
-
if (kind === "any") return isUnknown(declared);
|
|
2495
|
-
if (kind === "any[]") return isUnknown(arrayElement(checker, declared));
|
|
2496
|
-
return isUnknown(checker.getAwaitedType(declared));
|
|
2497
|
-
});
|
|
2498
|
-
}
|
|
2499
|
-
/**
|
|
2500
|
-
* Whether returning `value` lets `any` out, as `typescript/no-unsafe-return`
|
|
2501
|
-
* judges it: by the call signatures of the type that declares the function's
|
|
2502
|
-
* return, a function expression's context or the function's own type. An own
|
|
2503
|
-
* annotation is excused when a signature returns that type, `any` or
|
|
2504
|
-
* `unknown`. An `any`, `any[]` or `Promise<any>` is reported unless a
|
|
2505
|
-
* signature returns `unknown`, `unknown[]` or `Promise<unknown>`, and another
|
|
2506
|
-
* type is compared with the first signature by {@link leaks}.
|
|
2507
|
-
*/
|
|
2508
|
-
function returnLeaks(checker, value) {
|
|
2509
|
-
const owner = ownerOf(value);
|
|
2510
|
-
if (owner === void 0) return false;
|
|
2511
|
-
const sender = checker.getTypeAtLocation(value);
|
|
2512
|
-
const returns = callSignatures(checker, declaringType(checker, owner)).map((signature) => signature.getReturnType());
|
|
2513
|
-
const isAsync = typescript6_default.canHaveModifiers(owner) && (typescript6_default.getModifiers(owner)?.some((modifier) => modifier.kind === typescript6_default.SyntaxKind.AsyncKeyword) ?? false);
|
|
2514
|
-
if (owner.type !== void 0 && annotationExcuses(checker, sender, returns, isAsync)) return false;
|
|
2515
|
-
const kind = anyKind(checker, sender);
|
|
2516
|
-
return kind === "safe" ? leaks(checker, sender, returns[0], value) : !anyExcuses(checker, kind, returns, isAsync);
|
|
2517
|
-
}
|
|
2518
|
-
//#endregion
|
|
2519
|
-
//#region src/oxc/guardrails/rules/no-unsafe-any-in-vue.ts
|
|
2520
|
-
/** Whether `value` lets `any` into an assigned `receiver`: `any` into anything but `unknown`, a slot declared `any` included, or what {@link leaks} finds. */
|
|
2521
|
-
function assignmentLeaks(checker, value, receiver) {
|
|
2522
|
-
const sender = checker.getTypeAtLocation(value);
|
|
2523
|
-
return isAnyType(checker, sender) ? !isUnknown(receiver) : leaks(checker, sender, receiver, value);
|
|
2524
|
-
}
|
|
2525
|
-
/** Whether `value`, flowing into the slot its context declares, lets `any` in. */
|
|
2526
|
-
function leaksIntoContext(checker, value) {
|
|
2527
|
-
return assignmentLeaks(checker, value, checker.getContextualType(value));
|
|
2528
|
-
}
|
|
2529
|
-
/** Whether `literal` is the target of a destructuring assignment, as in `({ a } = value)`, whose elements name targets, not values. */
|
|
2530
|
-
function isDestructuringTarget(literal) {
|
|
2531
|
-
let child = literal;
|
|
2532
|
-
let parent = literal.parent;
|
|
2533
|
-
while (typescript6_default.isParenthesizedExpression(parent) || typescript6_default.isArrayLiteralExpression(parent) || typescript6_default.isObjectLiteralExpression(parent) || typescript6_default.isPropertyAssignment(parent) || typescript6_default.isShorthandPropertyAssignment(parent) || typescript6_default.isSpreadElement(parent) || typescript6_default.isSpreadAssignment(parent)) {
|
|
2534
|
-
child = parent;
|
|
2535
|
-
parent = parent.parent;
|
|
2536
|
-
}
|
|
2537
|
-
return typescript6_default.isBinaryExpression(parent) && parent.operatorToken.kind === typescript6_default.SyntaxKind.EqualsToken && parent.left === child || (typescript6_default.isForOfStatement(parent) || typescript6_default.isForInStatement(parent)) && parent.initializer === child;
|
|
2538
|
-
}
|
|
2539
|
-
function returned(checker, value) {
|
|
2540
|
-
return returnLeaks(checker, value) ? [{
|
|
2541
|
-
kind: "return",
|
|
2542
|
-
node: value
|
|
2543
|
-
}] : [];
|
|
2544
|
-
}
|
|
2545
|
-
/** An `any` or `any[]` spread into an array literal that is not a destructuring target. A spread into a call is an argument, which {@link unsafeArguments} judges. */
|
|
2546
|
-
function spreadFindings(checker, spread) {
|
|
2547
|
-
return typescript6_default.isArrayLiteralExpression(spread.parent) && !isDestructuringTarget(spread.parent) && isAnyOrAnyArray(checker, checker.getTypeAtLocation(spread.expression)) ? [{
|
|
2548
|
-
kind: "assignment",
|
|
2549
|
-
node: spread
|
|
2550
|
-
}] : [];
|
|
2551
|
-
}
|
|
2552
|
-
function propertyFindings(checker, property) {
|
|
2553
|
-
if (isDestructuringTarget(property.parent)) {
|
|
2554
|
-
const fallback = typescript6_default.isShorthandPropertyAssignment(property) ? property.objectAssignmentInitializer : void 0;
|
|
2555
|
-
return fallback !== void 0 && assignmentLeaks(checker, fallback, checker.getTypeAtLocation(property.name)) ? [{
|
|
2556
|
-
kind: "assignment",
|
|
2557
|
-
node: property
|
|
2558
|
-
}] : [];
|
|
2559
|
-
}
|
|
2560
|
-
return leaksIntoContext(checker, typescript6_default.isPropertyAssignment(property) ? property.initializer : property.name) ? [{
|
|
2561
|
-
kind: "assignment",
|
|
2562
|
-
node: property
|
|
2563
|
-
}] : [];
|
|
2564
|
-
}
|
|
2565
|
-
function isPattern(node) {
|
|
2566
|
-
return typescript6_default.isObjectBindingPattern(node) || typescript6_default.isArrayBindingPattern(node) || typescript6_default.isObjectLiteralExpression(node) || typescript6_default.isArrayLiteralExpression(node);
|
|
2567
|
-
}
|
|
2568
|
-
/** The key a property name spells, a computed literal such as `['a']` included. */
|
|
2569
|
-
function literalKey(name) {
|
|
2570
|
-
if (typescript6_default.isIdentifier(name)) return name.text;
|
|
2571
|
-
const key = typescript6_default.isComputedPropertyName(name) ? name.expression : name;
|
|
2572
|
-
return typescript6_default.isStringLiteral(key) || typescript6_default.isNumericLiteral(key) || typescript6_default.isNoSubstitutionTemplateLiteral(key) ? key.text : void 0;
|
|
2573
|
-
}
|
|
2574
|
-
/** The target and default of an assignment pattern element, as in `a = fallback`. */
|
|
2575
|
-
function withDefault(element) {
|
|
2576
|
-
return typescript6_default.isBinaryExpression(element) && element.operatorToken.kind === typescript6_default.SyntaxKind.EqualsToken ? {
|
|
2577
|
-
target: element.left,
|
|
2578
|
-
initializer: element.right
|
|
2579
|
-
} : {
|
|
2580
|
-
target: element,
|
|
2581
|
-
initializer: void 0
|
|
2582
|
-
};
|
|
2583
|
-
}
|
|
2584
|
-
function objectElements(pattern) {
|
|
2585
|
-
if (typescript6_default.isObjectBindingPattern(pattern)) return pattern.elements.map((element) => ({
|
|
2586
|
-
key: element.dotDotDotToken === void 0 ? literalKey(element.propertyName ?? element.name) : void 0,
|
|
2587
|
-
target: element.name,
|
|
2588
|
-
initializer: element.initializer,
|
|
2589
|
-
node: element
|
|
2590
|
-
}));
|
|
2591
|
-
return pattern.properties.map((property) => {
|
|
2592
|
-
if (typescript6_default.isPropertyAssignment(property)) return {
|
|
2593
|
-
key: literalKey(property.name),
|
|
2594
|
-
...withDefault(property.initializer),
|
|
2595
|
-
node: property
|
|
2596
|
-
};
|
|
2597
|
-
if (typescript6_default.isShorthandPropertyAssignment(property)) return {
|
|
2598
|
-
key: property.name.text,
|
|
2599
|
-
target: property.name,
|
|
2600
|
-
initializer: property.objectAssignmentInitializer,
|
|
2601
|
-
node: property
|
|
2602
|
-
};
|
|
2603
|
-
return {
|
|
2604
|
-
key: void 0,
|
|
2605
|
-
target: property,
|
|
2606
|
-
initializer: void 0,
|
|
2607
|
-
node: property
|
|
2608
|
-
};
|
|
2609
|
-
});
|
|
2610
|
-
}
|
|
2611
|
-
function arrayElements(pattern) {
|
|
2612
|
-
return pattern.elements.flatMap((element, index) => {
|
|
2613
|
-
if (typescript6_default.isOmittedExpression(element)) return [];
|
|
2614
|
-
if (typescript6_default.isBindingElement(element)) return [{
|
|
2615
|
-
key: element.dotDotDotToken === void 0 ? String(index) : void 0,
|
|
2616
|
-
target: element.name,
|
|
2617
|
-
initializer: element.initializer,
|
|
2618
|
-
node: element
|
|
2619
|
-
}];
|
|
2620
|
-
if (typescript6_default.isSpreadElement(element)) return [{
|
|
2621
|
-
key: void 0,
|
|
2622
|
-
target: element.expression,
|
|
2623
|
-
initializer: void 0,
|
|
2624
|
-
node: element
|
|
2625
|
-
}];
|
|
2626
|
-
return [{
|
|
2627
|
-
key: String(index),
|
|
2628
|
-
...withDefault(element),
|
|
2629
|
-
node: element
|
|
2630
|
-
}];
|
|
2631
|
-
});
|
|
2632
|
-
}
|
|
2633
|
-
/** An element that takes an `any` its source declares, and the elements nested under one with no default, as a nested pattern with a default reads that default. */
|
|
2634
|
-
function elementFindings(checker, element, source) {
|
|
2635
|
-
if (isAnyType(checker, source)) return [{
|
|
2636
|
-
kind: "assignment",
|
|
2637
|
-
node: element.node
|
|
2638
|
-
}];
|
|
2639
|
-
return element.initializer === void 0 && isPattern(element.target) ? destructuredFindings(checker, element.target, source) : [];
|
|
2640
|
-
}
|
|
2641
|
-
/** The property or tuple slot named `key` that `source` declares, not one an index signature stands for. */
|
|
2642
|
-
function declaredSlot(checker, source, key, at) {
|
|
2643
|
-
const slot = checker.getPropertyOfType(source, key);
|
|
2644
|
-
return slot === void 0 ? void 0 : checker.getTypeOfSymbolAtLocation(slot, at);
|
|
2645
|
-
}
|
|
2646
|
-
function slotFindings(checker, element, source) {
|
|
2647
|
-
const slot = element.key === void 0 ? void 0 : declaredSlot(checker, source, element.key, element.node);
|
|
2648
|
-
return slot === void 0 ? [] : elementFindings(checker, element, slot);
|
|
2649
|
-
}
|
|
2650
|
-
/**
|
|
2651
|
-
* The elements of an untyped destructuring declaration or of a destructuring
|
|
2652
|
-
* assignment that take `any` from what `source` declares: a property or
|
|
2653
|
-
* tuple slot typed `any`, whatever the target's own type, or the whole
|
|
2654
|
-
* pattern once when it reads an `any[]`. An index signature, another iterable
|
|
2655
|
-
* and a rest from an object or a tuple are left alone, as
|
|
2656
|
-
* `typescript/no-unsafe-assignment` leaves them.
|
|
2657
|
-
*/
|
|
2658
|
-
function destructuredFindings(checker, pattern, source) {
|
|
2659
|
-
if (typescript6_default.isObjectBindingPattern(pattern) || typescript6_default.isObjectLiteralExpression(pattern)) return objectElements(pattern).flatMap((element) => slotFindings(checker, element, source));
|
|
2660
|
-
if (isAnyOrAnyArray(checker, source)) return [{
|
|
2661
|
-
kind: "assignment",
|
|
2662
|
-
node: pattern
|
|
2663
|
-
}];
|
|
2664
|
-
return checker.isTupleType(source) ? arrayElements(pattern).flatMap((element) => slotFindings(checker, element, source)) : [];
|
|
2665
|
-
}
|
|
2666
|
-
/** The elements a pattern `name`, annotated or not, takes `any` into from `initializer`. */
|
|
2667
|
-
function bindingFindings(checker, name, initializer) {
|
|
2668
|
-
const source = checker.getTypeAtLocation(initializer);
|
|
2669
|
-
return typescript6_default.isIdentifier(name) ? [] : destructuredFindings(checker, name, source);
|
|
2670
|
-
}
|
|
2671
|
-
function declarationFindings(checker, node, initializer) {
|
|
2672
|
-
return assignmentLeaks(checker, initializer, node.type && checker.getTypeAtLocation(node.name)) ? [{
|
|
2673
|
-
kind: "assignment",
|
|
2674
|
-
node
|
|
2675
|
-
}] : bindingFindings(checker, node.name, initializer);
|
|
2676
|
-
}
|
|
2677
|
-
/** A JSX attribute whose value lets `any` into the prop it fills. */
|
|
2678
|
-
function attributeFindings(checker, attribute) {
|
|
2679
|
-
const value = attribute.initializer !== void 0 && typescript6_default.isJsxExpression(attribute.initializer) ? attribute.initializer.expression : void 0;
|
|
2680
|
-
return value !== void 0 && leaksIntoContext(checker, value) ? [{
|
|
2681
|
-
kind: "assignment",
|
|
2682
|
-
node: value
|
|
2683
|
-
}] : [];
|
|
2684
|
-
}
|
|
2685
|
-
/** A class field whose initializer lets `any` in: against its annotation, or whatever its type when it has none. */
|
|
2686
|
-
function fieldFindings(checker, field) {
|
|
2687
|
-
return field.initializer !== void 0 && assignmentLeaks(checker, field.initializer, field.type && checker.getTypeAtLocation(field.name)) ? [{
|
|
2688
|
-
kind: "assignment",
|
|
2689
|
-
node: field
|
|
2690
|
-
}] : [];
|
|
2691
|
-
}
|
|
2692
|
-
function assignmentFindings(checker, node) {
|
|
2693
|
-
if (typescript6_default.isVariableDeclaration(node) && node.initializer !== void 0) return declarationFindings(checker, node, node.initializer);
|
|
2694
|
-
if (typescript6_default.isBinaryExpression(node) && node.operatorToken.kind === typescript6_default.SyntaxKind.EqualsToken) {
|
|
2695
|
-
if (assignmentLeaks(checker, node.right, checker.getTypeAtLocation(node.left))) return [{
|
|
2696
|
-
kind: "assignment",
|
|
2697
|
-
node
|
|
2698
|
-
}];
|
|
2699
|
-
return typescript6_default.isObjectLiteralExpression(node.left) || typescript6_default.isArrayLiteralExpression(node.left) ? destructuredFindings(checker, node.left, checker.getTypeAtLocation(node.right)) : [];
|
|
2700
|
-
}
|
|
2701
|
-
if (typescript6_default.isParameter(node) && node.initializer !== void 0) return leaksIntoContext(checker, node.initializer) ? [{
|
|
2702
|
-
kind: "assignment",
|
|
2703
|
-
node
|
|
2704
|
-
}] : bindingFindings(checker, node.name, node.initializer);
|
|
2705
|
-
if (typescript6_default.isBindingElement(node) && node.initializer !== void 0) return assignmentLeaks(checker, node.initializer, checker.getTypeAtLocation(node.name)) ? [{
|
|
2706
|
-
kind: "assignment",
|
|
2707
|
-
node
|
|
2708
|
-
}] : bindingFindings(checker, node.name, node.initializer);
|
|
2709
|
-
if (typescript6_default.isJsxAttribute(node)) return attributeFindings(checker, node);
|
|
2710
|
-
if (typescript6_default.isPropertyDeclaration(node)) return fieldFindings(checker, node);
|
|
2711
|
-
if (typescript6_default.isPropertyAssignment(node) || typescript6_default.isShorthandPropertyAssignment(node)) return propertyFindings(checker, node);
|
|
2712
|
-
return [];
|
|
2713
|
-
}
|
|
2714
|
-
function nodeFindings(checker, node) {
|
|
2715
|
-
if (typescript6_default.isSpreadElement(node)) return spreadFindings(checker, node);
|
|
2716
|
-
if (typescript6_default.isCallExpression(node) || typescript6_default.isNewExpression(node) || typescript6_default.isTaggedTemplateExpression(node)) return unsafeArguments(checker, node).map((argument) => ({
|
|
2717
|
-
kind: "argument",
|
|
2718
|
-
node: argument
|
|
2719
|
-
}));
|
|
2720
|
-
if (typescript6_default.isReturnStatement(node) && node.expression !== void 0) return returned(checker, node.expression);
|
|
2721
|
-
if (typescript6_default.isArrowFunction(node) && !typescript6_default.isBlock(node.body)) return returned(checker, node.body);
|
|
2722
|
-
return assignmentFindings(checker, node);
|
|
2723
|
-
}
|
|
2724
|
-
function findings({ checker, sourceFile }) {
|
|
2725
|
-
const found = [];
|
|
2726
|
-
function visit(node) {
|
|
2727
|
-
found.push(...nodeFindings(checker, node));
|
|
2728
|
-
typescript6_default.forEachChild(node, visit);
|
|
2729
|
-
}
|
|
2730
|
-
visit(sourceFile);
|
|
2731
|
-
return found;
|
|
2732
|
-
}
|
|
2733
|
-
/**
|
|
2734
|
-
* `typescript/no-unsafe-assignment`, `no-unsafe-argument` and
|
|
2735
|
-
* `no-unsafe-return` for the script blocks of a `.vue` file, which
|
|
2736
|
-
* oxlint-tsgolint cannot read: an `any`, or a generic such as `any[]` or
|
|
2737
|
-
* `Set<any>` holding one, reaching a declared type
|
|
2738
|
-
* through a declaration, an assignment, an object literal property, a class
|
|
2739
|
-
* field, a JSX attribute in a `lang="tsx"` script, a default value, an
|
|
2740
|
-
* argument, a tagged template substitution, a spread, a tuple spread into
|
|
2741
|
-
* parameters, a destructured binding,
|
|
2742
|
-
* a destructuring assignment such as `({ a } = value)` or a return. An `any`
|
|
2743
|
-
* assigned to a slot declared `any` is reported too, as tsgolint reports it.
|
|
2744
|
-
* TypeScript files stay with tsgolint, and a
|
|
2745
|
-
* component with `generic` type parameters is skipped, as only Vue's compiler
|
|
2746
|
-
* brings them into scope.
|
|
2747
|
-
*
|
|
2748
|
-
* A tuple or generic returned into a union of callables is compared with the
|
|
2749
|
-
* member tsgo, which tsgolint runs, orders first. Two ties stay in TypeScript
|
|
2750
|
-
* 6's creation order, so the rule can compare another member than tsgolint
|
|
2751
|
-
* does: two instantiations of one anonymous generic, as in
|
|
2752
|
-
* `H<string>["m"] | H<unknown>["m"]`, which tsgo orders by their type
|
|
2753
|
-
* mappers, and two same-named types declared in different files, which tsgo
|
|
2754
|
-
* orders by its program's file order. TypeScript 6 exposes neither.
|
|
2755
|
-
*/
|
|
2756
|
-
const noUnsafeAnyInVueRule = defineRule({
|
|
2757
|
-
meta: {
|
|
2758
|
-
type: "problem",
|
|
2759
|
-
docs: { description: "A Vue component's script assigns, passes and returns no `any` where a type is declared." },
|
|
2760
|
-
messages: {
|
|
2761
|
-
assignment: "Unsafe assignment of an `any` value, which `typescript/no-unsafe-assignment` reports in a TypeScript file. Use a typed value or `unknown`, and narrow it before use.",
|
|
2762
|
-
argument: "Unsafe argument of type `any` to a typed parameter, which `typescript/no-unsafe-argument` reports in a TypeScript file. Pass a typed value.",
|
|
2763
|
-
return: "Unsafe return of an `any` value, which `typescript/no-unsafe-return` reports in a TypeScript file. Return a typed value."
|
|
2764
|
-
}
|
|
2765
|
-
},
|
|
2766
|
-
createOnce(context) {
|
|
2767
|
-
return { Program() {
|
|
2768
|
-
const { filename, sourceCode } = context;
|
|
2769
|
-
if (!filename.endsWith(".vue")) return;
|
|
2770
|
-
const { text } = sourceCode;
|
|
2771
|
-
const linted = lintedSource(filename, text);
|
|
2772
|
-
if (linted === void 0) return;
|
|
2773
|
-
const { offset } = linted;
|
|
2774
|
-
const typed = typedFile(filename, linted.text);
|
|
2775
|
-
if (typed === void 0) return;
|
|
2776
|
-
for (const { kind, node } of findings(typed)) {
|
|
2777
|
-
const start = node.getStart(typed.sourceFile) - offset;
|
|
2778
|
-
const end = node.end - offset;
|
|
2779
|
-
if (start >= 0 && end <= text.length) context.report({
|
|
2780
|
-
messageId: kind,
|
|
2781
|
-
loc: {
|
|
2782
|
-
start: sourceCode.getLocFromIndex(start),
|
|
2783
|
-
end: sourceCode.getLocFromIndex(end)
|
|
2784
|
-
}
|
|
2785
|
-
});
|
|
2786
|
-
}
|
|
2787
|
-
} };
|
|
2788
|
-
}
|
|
2789
|
-
});
|
|
2790
|
-
//#endregion
|
|
2791
2186
|
//#region src/oxc/guardrails/literal-fit.ts
|
|
2792
2187
|
const MAX_DEPTH$1 = 8;
|
|
2793
2188
|
const INDEX = /^\d+$/u;
|
|
@@ -3086,7 +2481,7 @@ const requireTsconfigTypesRule = defineRule({
|
|
|
3086
2481
|
});
|
|
3087
2482
|
//#endregion
|
|
3088
2483
|
//#region src/oxc/guardrails/index.ts
|
|
3089
|
-
/** AntelopeJS rules that reject comments, inherited-key lookups, presence-only type guards, inserts that follow a read of the same table or that a called function makes once an awaited read found nothing, unrun interface-database queries an awaited function returns, unchecked Object.assign writes,
|
|
2484
|
+
/** AntelopeJS rules that reject comments, inherited-key lookups, presence-only type guards, inserts that follow a read of the same table or that a called function makes once an awaited read found nothing, unrun interface-database queries an awaited function returns, unchecked Object.assign writes, low-evidence tests, files no tsconfig lists and tsconfigs that list no `types`. */
|
|
3090
2485
|
const guardrailsPlugin = eslintCompatPlugin({
|
|
3091
2486
|
meta: { name: "antelopejs" },
|
|
3092
2487
|
rules: {
|
|
@@ -3099,7 +2494,6 @@ const guardrailsPlugin = eslintCompatPlugin({
|
|
|
3099
2494
|
"no-self-import-in-tests": noSelfImportInTestsRule,
|
|
3100
2495
|
"no-typeof-function-only-test": noTypeofFunctionOnlyTestRule,
|
|
3101
2496
|
"no-unrun-query": noUnrunQueryRule,
|
|
3102
|
-
"no-unsafe-any-in-vue": noUnsafeAnyInVueRule,
|
|
3103
2497
|
"no-unsafe-object-assign": noUnsafeObjectAssignRule,
|
|
3104
2498
|
"require-assertion": requireAssertionRule,
|
|
3105
2499
|
"require-tsconfig-include": requireTsconfigIncludeRule,
|
|
@@ -4,8 +4,8 @@ import { c as leaseTmpDir, i as PARENT_TMPDIR, n as LEASE_DIR, r as LEASE_MARKER
|
|
|
4
4
|
import { t as relativeSlashed } from "./slash-BEgSnfYw.mjs";
|
|
5
5
|
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, utimesSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { basename, delimiter, dirname, join, resolve } from "node:path";
|
|
7
|
-
import { execFileSync } from "node:child_process";
|
|
8
7
|
import { pathToFileURL } from "node:url";
|
|
8
|
+
import { execFileSync } from "node:child_process";
|
|
9
9
|
import { randomBytes } from "node:crypto";
|
|
10
10
|
import { homedir, tmpdir } from "node:os";
|
|
11
11
|
import { minimatch } from "minimatch";
|
|
@@ -545,4 +545,4 @@ function planFor(workspace, baseRef, all = false) {
|
|
|
545
545
|
};
|
|
546
546
|
}
|
|
547
547
|
//#endregion
|
|
548
|
-
export {
|
|
548
|
+
export { matchesPath as C, pauseSync as S, recordProcesses as _, readFeatures as a, withLocalBins as b, allocateRun as c, git as d, isolatedEnv as f, ownRun as g, operatorEnv as h, planFor as i, canonical as l, openWorkspace as m, SMOKE_FEATURE as n, CACHE_DIR as o, loadRun as p, checkMap as r, RUNS_DIR as s, DEFAULT_SHARED as t, commandRecords as u, removeTree as v, writeWhole as x, saveRun as y };
|