corsa-oxlint 1.1.0 → 1.2.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/dist/ast_utils.d.ts +1 -3
- package/dist/checker.d.ts +0 -1
- package/dist/checker.js +35 -7
- package/dist/checker.js.map +1 -1
- package/dist/context.d.ts +0 -1
- package/dist/index.d.ts +3 -4
- package/dist/node_map.d.ts +0 -1
- package/dist/oxlint_utils.d.ts +0 -1
- package/dist/parser_services.d.ts +0 -1
- package/dist/plugin.d.ts +1 -2
- package/dist/registry.d.ts +0 -1
- package/dist/rule_tester.d.ts +2 -3
- package/dist/rules/await_thenable.d.ts +1 -0
- package/dist/rules/index.d.ts +1 -0
- package/dist/rules/native_bridge.d.ts +1 -1
- package/dist/rules/native_bridge.js.map +1 -1
- package/dist/rules/no_array_delete.d.ts +1 -0
- package/dist/rules/no_base_to_string.d.ts +1 -0
- package/dist/rules/no_floating_promises.d.ts +1 -0
- package/dist/rules/no_for_in_array.d.ts +1 -0
- package/dist/rules/no_implied_eval.d.ts +1 -0
- package/dist/rules/no_meaningless_void_operator.d.ts +1 -0
- package/dist/rules/no_mixed_enums.d.ts +1 -0
- package/dist/rules/no_unsafe_assignment.d.ts +1 -0
- package/dist/rules/no_unsafe_call.d.ts +1 -0
- package/dist/rules/no_unsafe_member_access.d.ts +1 -0
- package/dist/rules/no_unsafe_return.d.ts +1 -0
- package/dist/rules/no_unsafe_type_assertion.d.ts +1 -0
- package/dist/rules/no_unsafe_unary_minus.d.ts +1 -0
- package/dist/rules/only_throw_error.d.ts +1 -0
- package/dist/rules/pending_parity.d.ts +1 -0
- package/dist/rules/prefer_find.d.ts +1 -0
- package/dist/rules/prefer_includes.d.ts +1 -0
- package/dist/rules/prefer_promise_reject_errors.d.ts +1 -0
- package/dist/rules/prefer_reduce_type_parameter.d.ts +1 -0
- package/dist/rules/prefer_regexp_exec.d.ts +1 -0
- package/dist/rules/prefer_string_starts_ends_with.d.ts +1 -0
- package/dist/rules/require_array_sort_compare.d.ts +1 -0
- package/dist/rules/restrict_plus_operands.d.ts +1 -0
- package/dist/rules/restrict_template_expressions.d.ts +1 -0
- package/dist/rules/rule_creator.d.ts +1 -0
- package/dist/rules/type_utils.d.ts +0 -1
- package/dist/rules/use_unknown_in_catch_callback_variable.d.ts +1 -0
- package/dist/session.d.ts +17 -1
- package/dist/session.js +288 -7
- package/dist/session.js.map +1 -1
- package/dist/stylistic.d.ts +0 -2
- package/dist/test_support.d.ts +18 -0
- package/dist/test_support.js +34 -0
- package/dist/test_support.js.map +1 -0
- package/dist/ts_eslint.d.ts +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/utils.d.ts +0 -2
- package/package.json +6 -6
package/dist/ast_utils.d.ts
CHANGED
|
@@ -365,9 +365,7 @@ declare const ASTUtils: Readonly<{
|
|
|
365
365
|
readonly type?: string;
|
|
366
366
|
readonly value?: string;
|
|
367
367
|
} | null | undefined) => boolean;
|
|
368
|
-
isCommentToken:
|
|
369
|
-
readonly type?: string;
|
|
370
|
-
} | null | undefined) => boolean;
|
|
368
|
+
isCommentToken: typeof isCommentToken;
|
|
371
369
|
isConstructor: typeof isConstructor;
|
|
372
370
|
isFunction: typeof isFunction;
|
|
373
371
|
isFunctionOrFunctionType: typeof isFunctionOrFunctionType;
|
package/dist/checker.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ContextWithParserOptions, CorsaProgramShape, CorsaTypeCheckerShape } from "./types.js";
|
|
2
2
|
import { createNodeMaps } from "./node_map.js";
|
|
3
|
-
|
|
4
3
|
//#region src/bindings/nodejs/corsa_oxlint/ts/checker.d.ts
|
|
5
4
|
declare function createProgram(context: ContextWithParserOptions): CorsaProgramShape & {
|
|
6
5
|
readonly nodeMaps: ReturnType<typeof createNodeMaps>;
|
package/dist/checker.js
CHANGED
|
@@ -276,18 +276,23 @@ function implementedTypesFromTypeDeclaration(context, type, checker) {
|
|
|
276
276
|
const session = sessionForContext(context).session;
|
|
277
277
|
const cached = session.getCachedOwnImplementedTypes(type.id);
|
|
278
278
|
if (cached) return cached;
|
|
279
|
-
const symbol = type.symbol ? session.getSymbol(type.symbol) : void 0;
|
|
279
|
+
const symbol = (type.symbol ? session.getSymbol(type.symbol) : void 0) ?? checker.getSymbolOfType(type);
|
|
280
280
|
const declaration = symbol?.valueDeclaration ?? symbol?.declarations?.[0];
|
|
281
281
|
const declarationNode = declaration ? session.getNode(declaration) : void 0;
|
|
282
|
-
const
|
|
282
|
+
const matchedDeclarationNode = session.getClassDeclarationForType(type);
|
|
283
|
+
const localImplementingDeclaration = declarationNode && pathsReferToSameFile(declarationNode.fileName, context.filename) ? implementingClassDeclaration(context, type, symbol, declarationNode) : void 0;
|
|
284
|
+
const resolvedDeclarationNode = matchedDeclarationNode ?? localImplementingDeclaration ?? declarationNode ?? implementingClassDeclaration(context, type, symbol);
|
|
283
285
|
const sourceText = resolvedDeclarationNode ? sourceTextForPath(context, resolvedDeclarationNode.fileName) : void 0;
|
|
284
286
|
const implemented = resolvedDeclarationNode && sourceText ? implementedTypesFromSourceText(context, resolvedDeclarationNode, sourceText, checker) : [];
|
|
285
287
|
return session.cacheOwnImplementedTypes(type.id, implemented);
|
|
286
288
|
}
|
|
287
|
-
function implementingClassDeclaration(context, type, symbol) {
|
|
289
|
+
function implementingClassDeclaration(context, type, symbol, declarationNode) {
|
|
288
290
|
const name = implementingClassName(type, symbol);
|
|
289
291
|
if (!name) return;
|
|
290
|
-
const
|
|
292
|
+
const { byName, ambiguousNames } = implementingClassDeclarations(context);
|
|
293
|
+
const ranges = byName.get(name);
|
|
294
|
+
if (!ranges || ranges.length === 0) return;
|
|
295
|
+
const range = ambiguousNames.has(name) ? declaredRange(ranges, declarationNode, context.filename) : ranges[0];
|
|
291
296
|
return range ? {
|
|
292
297
|
fileName: context.filename,
|
|
293
298
|
pos: range[0],
|
|
@@ -295,6 +300,16 @@ function implementingClassDeclaration(context, type, symbol) {
|
|
|
295
300
|
range
|
|
296
301
|
} : void 0;
|
|
297
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Picks the candidate whose `class` keyword sits inside `declarationNode`, which
|
|
305
|
+
* is the declaration the symbol actually points at. Without a usable declaration
|
|
306
|
+
* range there is nothing to disambiguate with, so the lookup gives up rather
|
|
307
|
+
* than returning a same-named class from another scope.
|
|
308
|
+
*/
|
|
309
|
+
function declaredRange(ranges, declarationNode, filename) {
|
|
310
|
+
if (!declarationNode || !pathsReferToSameFile(declarationNode.fileName, filename)) return;
|
|
311
|
+
return ranges.find(([start]) => start >= declarationNode.pos && start < declarationNode.end);
|
|
312
|
+
}
|
|
298
313
|
function implementingClassName(type, symbol) {
|
|
299
314
|
return symbol?.name || typeSymbolName(type.texts ?? []);
|
|
300
315
|
}
|
|
@@ -322,7 +337,9 @@ function implementingClassDeclarations(context) {
|
|
|
322
337
|
return declarations;
|
|
323
338
|
}
|
|
324
339
|
function collectImplementingClassDeclarations(sourceText) {
|
|
325
|
-
const
|
|
340
|
+
const byName = /* @__PURE__ */ new Map();
|
|
341
|
+
const declaredNames = /* @__PURE__ */ new Set();
|
|
342
|
+
const ambiguousNames = /* @__PURE__ */ new Set();
|
|
326
343
|
let offset = 0;
|
|
327
344
|
while (offset < sourceText.length) {
|
|
328
345
|
const classOffset = findKeywordOutsideTrivia(sourceText.slice(offset), "class");
|
|
@@ -331,12 +348,23 @@ function collectImplementingClassDeclarations(sourceText) {
|
|
|
331
348
|
const rest = sourceText.slice(declarationStart);
|
|
332
349
|
const match = /^\s*([$_\p{ID_Start}][$_\u200c\u200d\p{ID_Continue}]*)/u.exec(rest);
|
|
333
350
|
if (match?.[1]) {
|
|
351
|
+
const name = match[1];
|
|
352
|
+
if (declaredNames.has(name)) ambiguousNames.add(name);
|
|
353
|
+
declaredNames.add(name);
|
|
334
354
|
const bodyOpen = findClassBodyOpen(rest, 0);
|
|
335
|
-
if (findKeywordOutsideTrivia(rest.slice(0, bodyOpen >= 0 ? bodyOpen : rest.length), "implements") >= 0)
|
|
355
|
+
if (findKeywordOutsideTrivia(rest.slice(0, bodyOpen >= 0 ? bodyOpen : rest.length), "implements") >= 0) {
|
|
356
|
+
const range = [offset + classOffset, sourceText.length];
|
|
357
|
+
const ranges = byName.get(name);
|
|
358
|
+
if (ranges) ranges.push(range);
|
|
359
|
+
else byName.set(name, [range]);
|
|
360
|
+
}
|
|
336
361
|
}
|
|
337
362
|
offset = declarationStart;
|
|
338
363
|
}
|
|
339
|
-
return
|
|
364
|
+
return {
|
|
365
|
+
byName,
|
|
366
|
+
ambiguousNames
|
|
367
|
+
};
|
|
340
368
|
}
|
|
341
369
|
function implementedTypesFromSourceText(context, node, sourceText, checker) {
|
|
342
370
|
if (node.pos < 0 || node.end > sourceText.length || node.pos >= node.end) return [];
|
package/dist/checker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checker.js","names":[],"sources":["../ts/checker.ts"],"sourcesContent":["import type { Node } from \"@oxlint/plugins\";\n\nimport { createNodeMaps, toPosition } from \"./node_map\";\nimport { sessionForContext } from \"./registry\";\nimport type { CorsaProjectSession } from \"./session\";\nimport { SignatureKind } from \"./types\";\nimport type {\n ContextWithParserOptions,\n CorsaNode,\n CorsaProgramShape,\n CorsaSignature,\n CorsaSymbol,\n CorsaType,\n CorsaTypeCheckerShape,\n} from \"./types\";\n\ntype ImplementingClassCache = {\n readonly sourceText: string;\n readonly declarations: ReadonlyMap<string, readonly [start: number, end: number]>;\n};\n\nconst implementingClassNamesBySession = new WeakMap<\n CorsaProjectSession,\n Map<string, ImplementingClassCache>\n>();\n\nexport function createProgram(\n context: ContextWithParserOptions,\n): CorsaProgramShape & { readonly nodeMaps: ReturnType<typeof createNodeMaps> } {\n const nodeMaps = createNodeMaps(context);\n return {\n nodeMaps,\n getCompilerOptions() {\n return sessionForContext(context).session.getCompilerOptions();\n },\n getCurrentDirectory() {\n return sessionForContext(context).project.rootDir;\n },\n getRootFileNames() {\n return sessionForContext(context).session.getRootFileNames();\n },\n getSourceFile(fileName = context.filename) {\n return { fileName, text: context.sourceCode.text };\n },\n getTypeChecker() {\n return createTypeChecker(context);\n },\n };\n}\n\nexport function createTypeChecker(context: ContextWithParserOptions): CorsaTypeCheckerShape {\n return {\n getTypeAtLocation(node) {\n if ((node as { readonly type?: string }).type === \"NewExpression\") {\n return typeOfNewExpression(node as Node, this);\n }\n const lookupNode = nodeForTypeLookup(node);\n const type = sessionForContext(context).session.getTypeAtSourceRange(\n filenameFor(context, lookupNode),\n toPosition(lookupNode),\n endPosition(lookupNode),\n sourceTextFor(context, lookupNode),\n nodeKind(lookupNode),\n );\n primeImplementedTypesCacheFromNode(context, node, type, this);\n return type;\n },\n getContextualType(node) {\n return this.getTypeAtLocation(node);\n },\n getSymbolAtLocation(node) {\n const lookupNode = nodeForTypeLookup(node);\n return sessionForContext(context).session.getSymbolAtPosition(\n filenameFor(context, lookupNode),\n toPosition(lookupNode),\n sourceTextFor(context, lookupNode),\n );\n },\n getSymbol(symbol) {\n return sessionForContext(context).session.getSymbol(symbol);\n },\n getSymbolById(id) {\n return sessionForContext(context).session.getSymbol(id);\n },\n getSymbolOfType(type) {\n return sessionForContext(context).session.getSymbolOfType(type);\n },\n getNode(node) {\n return sessionForContext(context).session.getNode(node);\n },\n getNodeById(id) {\n return sessionForContext(context).session.getNode(id);\n },\n getTypeOfSymbol(symbol) {\n return sessionForContext(context).session.getTypeOfSymbol(symbol);\n },\n getTypeOfSymbolById(id) {\n return sessionForContext(context).session.getTypeOfSymbolById(id);\n },\n getDeclaredTypeOfSymbol(symbol) {\n return sessionForContext(context).session.getDeclaredTypeOfSymbol(symbol);\n },\n getDeclaredTypeOfSymbolById(id) {\n return sessionForContext(context).session.getDeclaredTypeOfSymbolById(id);\n },\n getTypeOfSymbolAtLocation(symbol, node) {\n return (\n this.getTypeOfSymbol(symbol) ??\n this.getDeclaredTypeOfSymbol(symbol) ??\n this.getTypeAtLocation(node)\n );\n },\n typeToString(type, enclosingDeclaration, flags) {\n void enclosingDeclaration;\n return sessionForContext(context).session.typeToString(type, flags);\n },\n getBaseTypeOfLiteralType(type) {\n return sessionForContext(context).session.getBaseTypeOfLiteralType(type);\n },\n getPropertiesOfType(type) {\n return sessionForContext(context).session.getPropertiesOfType(type);\n },\n getSignaturesOfType(type, kind) {\n return sessionForContext(context).session.getSignaturesOfType(type, kind);\n },\n getCallSignatureFacts(type, kind, argumentTypeTexts, explicitTypeArgumentTexts) {\n return sessionForContext(context).session.getCallSignatureFacts(\n type,\n kind,\n argumentTypeTexts,\n explicitTypeArgumentTexts,\n );\n },\n getReturnTypeOfSignature(signature) {\n return sessionForContext(context).session.getReturnTypeOfSignature(signature);\n },\n getTypePredicateOfSignature(signature) {\n return sessionForContext(context).session.getTypePredicateOfSignature(signature);\n },\n getBaseTypes(type) {\n return sessionForContext(context).session.getBaseTypes(type);\n },\n getImplementedTypes(node) {\n if (\"pos\" in node) {\n return implementedTypesFromCorsaNode(context, node, this);\n }\n const sourceText = sourceTextFor(context, node);\n const sourceNode = sourceText ? corsaNodeFromEstree(context, node) : undefined;\n if (sourceText && sourceNode) {\n const implemented = implementedTypesFromSourceText(context, sourceNode, sourceText, this);\n if (implemented.length > 0) {\n return implemented;\n }\n }\n return implementedClauseNodes(node)\n .map((clause) => {\n const expression = implementedClauseChildNode(clause, \"expression\") ?? clause;\n const symbol = this.getSymbolAtLocation(expression) ?? this.getSymbolAtLocation(clause);\n return symbol\n ? (this.getDeclaredTypeOfSymbol(symbol) ?? this.getTypeOfSymbol(symbol))\n : (this.getTypeAtLocation(expression) ?? this.getTypeAtLocation(clause));\n })\n .filter((type): type is CorsaType => type !== undefined);\n },\n getImplementedTypesOfType(type) {\n return implementedTypesFromTypeAndBases(context, type, this);\n },\n getTypeArguments(type) {\n return sessionForContext(context).session.getTypeArguments(type);\n },\n getTypesOfType(type) {\n return sessionForContext(context).session.getTypesOfType(type);\n },\n getTargetOfType(type) {\n return sessionForContext(context).session.getTargetOfType(type);\n },\n getTypeParametersOfType(type) {\n return sessionForContext(context).session.getTypeParametersOfType(type);\n },\n getOuterTypeParametersOfType(type) {\n return sessionForContext(context).session.getOuterTypeParametersOfType(type);\n },\n getLocalTypeParametersOfType(type) {\n return sessionForContext(context).session.getLocalTypeParametersOfType(type);\n },\n getObjectTypeOfType(type) {\n return sessionForContext(context).session.getObjectTypeOfType(type);\n },\n getIndexTypeOfType(type) {\n return sessionForContext(context).session.getIndexTypeOfType(type);\n },\n getCheckTypeOfType(type) {\n return sessionForContext(context).session.getCheckTypeOfType(type);\n },\n getExtendsTypeOfType(type) {\n return sessionForContext(context).session.getExtendsTypeOfType(type);\n },\n getBaseTypeOfType(type) {\n return sessionForContext(context).session.getBaseTypeOfType(type);\n },\n getConstraintOfType(type) {\n return sessionForContext(context).session.getConstraintOfType(type);\n },\n isUnionType(type) {\n return (type.flags & typeFlags.union) !== 0;\n },\n isIntersectionType(type) {\n return (type.flags & typeFlags.intersection) !== 0;\n },\n };\n}\n\nfunction primeImplementedTypesCacheFromNode(\n context: ContextWithParserOptions,\n node: Node | CorsaNode,\n type: CorsaType | undefined,\n checker: CorsaTypeCheckerShape,\n): void {\n if (!type || \"pos\" in node) {\n return;\n }\n const kind = (node as { readonly type?: string }).type;\n if (kind !== \"ClassDeclaration\" && kind !== \"ClassExpression\") {\n return;\n }\n const session = sessionForContext(context).session;\n if (session.getCachedOwnImplementedTypes(type.id)) {\n return;\n }\n session.cacheOwnImplementedTypes(type.id, checker.getImplementedTypes(node));\n}\n\nconst typeFlags = {\n union: 1 << 27,\n intersection: 1 << 28,\n} as const;\n\nfunction sourceTextFor(\n context: ContextWithParserOptions,\n node: Node | CorsaNode | CorsaType | CorsaSymbol | CorsaSignature,\n): string | undefined {\n return sourceTextForPath(context, filenameFor(context, node));\n}\n\nfunction sourceTextForPath(\n context: ContextWithParserOptions,\n fileName: string,\n): string | undefined {\n return pathsReferToSameFile(fileName, context.filename)\n ? context.sourceCode.text\n : sessionForContext(context).session.getSourceTextForPath(fileName);\n}\n\nfunction pathsReferToSameFile(left: string, right: string): boolean {\n const normalizedLeft = left.replaceAll(\"\\\\\", \"/\").toLowerCase();\n const normalizedRight = right.replaceAll(\"\\\\\", \"/\").toLowerCase();\n return (\n normalizedLeft === normalizedRight ||\n normalizedLeft.endsWith(`/${normalizedRight}`) ||\n normalizedRight.endsWith(`/${normalizedLeft}`)\n );\n}\n\nfunction typeOfNewExpression(node: Node, checker: CorsaTypeCheckerShape): CorsaType | undefined {\n const callee = childNode(node, \"callee\");\n if (!callee) {\n return undefined;\n }\n const calleeType = checker.getTypeAtLocation(callee);\n if (!calleeType) {\n return undefined;\n }\n const constructSignature = checker.getSignaturesOfType(calleeType, SignatureKind.Construct)[0];\n return constructSignature\n ? (checker.getReturnTypeOfSignature(constructSignature) ?? calleeType)\n : calleeType;\n}\n\nfunction nodeForTypeLookup(node: Node | CorsaNode): Node | CorsaNode {\n if (\"pos\" in node) {\n return node;\n }\n switch ((node as { readonly type?: string }).type) {\n case \"ClassDeclaration\":\n case \"ClassExpression\":\n return childNode(node, \"id\") ?? node;\n case \"TSPropertySignature\":\n return childNode(node, \"key\") ?? node;\n default:\n return node;\n }\n}\n\nfunction endPosition(node: Node | CorsaNode): number {\n if (\"end\" in node) {\n return node.end;\n }\n const range = (node as Node & { readonly range?: readonly [number, number] }).range;\n if (!range) {\n throw new Error(\"corsa oxlint requires ESTree nodes with range data\");\n }\n return range[1];\n}\n\nfunction nodeKind(node: Node | CorsaNode): string | undefined {\n return \"pos\" in node ? undefined : (node as { readonly type?: string }).type;\n}\n\nfunction childNode(node: Node, key: string): Node | undefined {\n const value = (node as unknown as Record<string, unknown>)[key];\n if (isNode(value)) {\n return value;\n }\n return undefined;\n}\n\nfunction implementedClauseNodes(node: Node | CorsaNode): readonly Node[] {\n if (\"pos\" in node) {\n return [];\n }\n const clauses = (node as unknown as { readonly implements?: unknown }).implements;\n if (!Array.isArray(clauses)) {\n return [];\n }\n return clauses.filter(isNode);\n}\n\nfunction implementedClauseChildNode(node: Node, key: string): Node | undefined {\n const value = (node as unknown as Record<string, unknown>)[key];\n if (isNode(value)) {\n return value;\n }\n return undefined;\n}\n\nfunction implementedTypesFromCorsaNode(\n context: ContextWithParserOptions,\n node: CorsaNode,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n const symbol = checker.getSymbolAtLocation(node);\n if (symbol) {\n const declaredType = checker.getDeclaredTypeOfSymbol(symbol) ?? checker.getTypeOfSymbol(symbol);\n if (declaredType) {\n const implemented = checker.getImplementedTypesOfType(declaredType);\n if (implemented.length > 0) {\n return implemented;\n }\n }\n }\n const sourceText = sourceTextFor(context, node);\n if (sourceText) {\n return implementedTypesFromSourceText(context, node, sourceText, checker);\n }\n const type = checker.getTypeAtLocation(node);\n return type ? checker.getImplementedTypesOfType(type) : [];\n}\n\nfunction corsaNodeFromEstree(context: ContextWithParserOptions, node: Node): CorsaNode | undefined {\n const range = (node as { readonly range?: unknown }).range;\n if (\n !Array.isArray(range) ||\n range.length < 2 ||\n typeof range[0] !== \"number\" ||\n typeof range[1] !== \"number\"\n ) {\n return undefined;\n }\n return {\n fileName: context.filename,\n pos: range[0],\n end: range[1],\n range: [range[0], range[1]] as const,\n };\n}\n\nfunction implementedTypesFromTypeAndBases(\n context: ContextWithParserOptions,\n type: CorsaType,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n const session = sessionForContext(context).session;\n const cached = session.getCachedImplementedTypes(type.id);\n if (cached) {\n return cached;\n }\n // Iterative DFS over the base chain so we don't pay for one closure call\n // and one `push(...subResult)` spread per base (each spread used to copy\n // the entire growing accumulator). Visit order doesn't matter because we\n // dedupe by `type.id`.\n const seenTypes = new Set<string>();\n const seenImplementedTypes = new Set<string>();\n const implemented: CorsaType[] = [];\n const stack: CorsaType[] = [type];\n while (stack.length > 0) {\n const current = stack.pop()!;\n if (seenTypes.has(current.id)) {\n continue;\n }\n seenTypes.add(current.id);\n\n const ownImplemented = implementedTypesFromTypeDeclaration(context, current, checker);\n for (let index = 0; index < ownImplemented.length; index += 1) {\n const ownType = ownImplemented[index]!;\n if (seenImplementedTypes.has(ownType.id)) {\n continue;\n }\n seenImplementedTypes.add(ownType.id);\n implemented.push(ownType);\n }\n\n const bases = checker.getBaseTypes(current);\n // Push in reverse so the natural visit order matches the recursive form.\n for (let index = bases.length - 1; index >= 0; index -= 1) {\n const baseType = bases[index]!;\n if (seenTypes.has(baseType.id)) {\n continue;\n }\n stack.push(baseType);\n }\n }\n return session.cacheImplementedTypes(type.id, implemented);\n}\n\nfunction implementedTypesFromTypeDeclaration(\n context: ContextWithParserOptions,\n type: CorsaType,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n const session = sessionForContext(context).session;\n const cached = session.getCachedOwnImplementedTypes(type.id);\n if (cached) {\n return cached;\n }\n const symbol = type.symbol ? session.getSymbol(type.symbol) : undefined;\n const declaration = symbol?.valueDeclaration ?? symbol?.declarations?.[0];\n const declarationNode = declaration ? session.getNode(declaration) : undefined;\n const localImplementingDeclaration =\n declarationNode && pathsReferToSameFile(declarationNode.fileName, context.filename)\n ? implementingClassDeclaration(context, type, symbol)\n : undefined;\n const resolvedDeclarationNode =\n localImplementingDeclaration ??\n declarationNode ??\n implementingClassDeclaration(context, type, symbol);\n const sourceText = resolvedDeclarationNode\n ? sourceTextForPath(context, resolvedDeclarationNode.fileName)\n : undefined;\n const implemented =\n resolvedDeclarationNode && sourceText\n ? implementedTypesFromSourceText(context, resolvedDeclarationNode, sourceText, checker)\n : [];\n return session.cacheOwnImplementedTypes(type.id, implemented);\n}\n\nfunction implementingClassDeclaration(\n context: ContextWithParserOptions,\n type: CorsaType,\n symbol?: CorsaSymbol,\n): CorsaNode | undefined {\n const name = implementingClassName(type, symbol);\n if (!name) {\n return undefined;\n }\n const range = implementingClassDeclarations(context).get(name);\n return range\n ? {\n fileName: context.filename,\n pos: range[0],\n end: range[1],\n range,\n }\n : undefined;\n}\n\nfunction implementingClassName(type: CorsaType, symbol?: CorsaSymbol): string | undefined {\n return symbol?.name || typeSymbolName(type.texts ?? []);\n}\n\nfunction typeSymbolName(texts: readonly string[]): string | undefined {\n for (const text of texts) {\n const match =\n /^(?:typeof\\s+)?(?:[$_\\p{ID_Start}][$_\\u200c\\u200d\\p{ID_Continue}]*\\.)*([$_\\p{ID_Start}][$_\\u200c\\u200d\\p{ID_Continue}]*)(?:\\s*<|$)/u.exec(\n text.trim(),\n );\n if (match?.[1]) {\n return match[1];\n }\n }\n return undefined;\n}\n\nfunction implementingClassDeclarations(\n context: ContextWithParserOptions,\n): ReadonlyMap<string, readonly [start: number, end: number]> {\n const session = sessionForContext(context).session;\n let byFile = implementingClassNamesBySession.get(session);\n if (!byFile) {\n byFile = new Map();\n implementingClassNamesBySession.set(session, byFile);\n }\n const sourceText = context.sourceCode.text;\n const cached = byFile.get(context.filename);\n if (cached?.sourceText === sourceText) {\n return cached.declarations;\n }\n const declarations = collectImplementingClassDeclarations(sourceText);\n byFile.set(context.filename, { sourceText, declarations });\n return declarations;\n}\n\nfunction collectImplementingClassDeclarations(\n sourceText: string,\n): ReadonlyMap<string, readonly [start: number, end: number]> {\n const declarations = new Map<string, readonly [start: number, end: number]>();\n let offset = 0;\n while (offset < sourceText.length) {\n const classOffset = findKeywordOutsideTrivia(sourceText.slice(offset), \"class\");\n if (classOffset < 0) {\n break;\n }\n const declarationStart = offset + classOffset + \"class\".length;\n const rest = sourceText.slice(declarationStart);\n const match = /^\\s*([$_\\p{ID_Start}][$_\\u200c\\u200d\\p{ID_Continue}]*)/u.exec(rest);\n if (match?.[1]) {\n const bodyOpen = findClassBodyOpen(rest, 0);\n const header = rest.slice(0, bodyOpen >= 0 ? bodyOpen : rest.length);\n if (findKeywordOutsideTrivia(header, \"implements\") >= 0) {\n declarations.set(match[1], [offset + classOffset, sourceText.length]);\n }\n }\n offset = declarationStart;\n }\n return declarations;\n}\n\nfunction implementedTypesFromSourceText(\n context: ContextWithParserOptions,\n node: CorsaNode,\n sourceText: string,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n if (node.pos < 0 || node.end > sourceText.length || node.pos >= node.end) {\n return [];\n }\n const classText = sourceText.slice(node.pos, node.end);\n const classStart = findKeywordOutsideTrivia(classText, \"class\");\n const headerStart = classStart >= 0 ? classStart : 0;\n const bodyOpen = findClassBodyOpen(classText, headerStart);\n const headerText = classText.slice(headerStart, bodyOpen >= 0 ? bodyOpen : classText.length);\n const implementsIndex = findKeywordOutsideTrivia(headerText, \"implements\");\n if (implementsIndex < 0) {\n return [];\n }\n const clauseText = headerText.slice(implementsIndex + \"implements\".length);\n const clauseStart = node.pos + headerStart + implementsIndex + \"implements\".length;\n return splitTopLevelRanges(clauseText, \",\")\n .map((range) => {\n const raw = clauseText.slice(range.start, range.end);\n const leading = raw.search(/\\S/);\n if (leading < 0) {\n return undefined;\n }\n const trailing = raw.match(/\\s*$/)?.[0].length ?? 0;\n const pos = clauseStart + range.start + leading;\n const end = clauseStart + range.end - trailing;\n const lookupNode: CorsaNode = {\n fileName: node.fileName,\n pos,\n end,\n range: [pos, end] as const,\n };\n const nameNode = implementedClauseNameNode(lookupNode, raw);\n const symbol =\n checker.getSymbolAtLocation(nameNode) ?? checker.getSymbolAtLocation(lookupNode);\n const type = symbol\n ? (checker.getDeclaredTypeOfSymbol(symbol) ?? checker.getTypeOfSymbol(symbol))\n : (checker.getTypeAtLocation(nameNode) ?? checker.getTypeAtLocation(lookupNode));\n if (type) {\n try {\n checker.typeToString(type);\n } catch {\n // Corsa-side relation fallbacks handle stale type handles; avoid\n // deriving replacement text from source names in the JS bridge.\n }\n }\n return type;\n })\n .filter((type): type is CorsaType => type !== undefined);\n}\n\nfunction implementedClauseNameNode(node: CorsaNode, raw: string): CorsaNode {\n const range = lastTypeNameIdentifierRange(raw);\n if (!range) {\n return node;\n }\n const pos = node.pos + range.start;\n const end = node.pos + range.end;\n return {\n fileName: node.fileName,\n pos,\n end,\n range: [pos, end] as const,\n };\n}\n\nfunction lastTypeNameIdentifierRange(\n text: string,\n): { readonly start: number; readonly end: number } | undefined {\n let last: { start: number; end: number } | undefined;\n const scanner = createScanner();\n for (let index = 0; index < text.length; index += 1) {\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n const char = text[index];\n if (char === \"<\") {\n break;\n }\n if (!isIdentifierStart(char)) {\n continue;\n }\n let end = index + 1;\n while (isIdentifierPart(text[end])) {\n end += 1;\n }\n last = { start: index, end };\n index = end - 1;\n }\n return last;\n}\n\nfunction findClassBodyOpen(text: string, start: number): number {\n const scanner = createScanner();\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = start; index < text.length; index += 1) {\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n const char = text[index];\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (\n char === \"{\" &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n return index;\n } else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n }\n return -1;\n}\n\nfunction findKeywordOutsideTrivia(text: string, keyword: string): number {\n const scanner = createScanner();\n for (let index = 0; index < text.length; index += 1) {\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n if (matchesKeyword(text, keyword, index)) {\n return index;\n }\n }\n return -1;\n}\n\nfunction matchesKeyword(text: string, keyword: string, index: number): boolean {\n return (\n text.startsWith(keyword, index) &&\n !isIdentifierPart(text[index - 1]) &&\n !isIdentifierPart(text[index + keyword.length])\n );\n}\n\nfunction isIdentifierPart(char: string | undefined): boolean {\n return char !== undefined && (isIdentifierStart(char) || /[0-9]/.test(char));\n}\n\nfunction isIdentifierStart(char: string | undefined): boolean {\n return char !== undefined && /[A-Za-z_$]/.test(char);\n}\n\nfunction splitTopLevelRanges(\n text: string,\n delimiter: string,\n): readonly { readonly start: number; readonly end: number }[] {\n const ranges: { start: number; end: number }[] = [];\n const scanner = createScanner();\n let start = 0;\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = 0; index < text.length; index += 1) {\n const char = text[index];\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n else if (\n char === delimiter &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n ranges.push({ start, end: index });\n start = index + 1;\n }\n }\n ranges.push({ start, end: text.length });\n return ranges;\n}\n\nfunction createScanner(): {\n skip(text: string, index: number): number;\n} {\n let quote: string | undefined;\n let escaped = false;\n let inLineComment = false;\n let inBlockComment = false;\n return {\n skip(text, index) {\n const char = text[index];\n const next = text[index + 1];\n if (inLineComment) {\n if (char === \"\\n\" || char === \"\\r\") {\n inLineComment = false;\n }\n return index + 1;\n }\n if (inBlockComment) {\n if (char === \"*\" && next === \"/\") {\n inBlockComment = false;\n return index + 2;\n }\n return index + 1;\n }\n if (quote) {\n if (escaped) {\n escaped = false;\n } else if (char === \"\\\\\") {\n escaped = true;\n } else if (char === quote) {\n quote = undefined;\n }\n return index + 1;\n }\n if (char === \"/\" && next === \"/\") {\n inLineComment = true;\n return index + 2;\n }\n if (char === \"/\" && next === \"*\") {\n inBlockComment = true;\n return index + 2;\n }\n if (char === '\"' || char === \"'\" || char === \"`\") {\n quote = char;\n return index + 1;\n }\n return index;\n },\n };\n}\n\nfunction isNode(value: unknown): value is Node {\n return typeof value === \"object\" && value !== null && \"type\" in value && \"range\" in value;\n}\n\nfunction filenameFor(\n context: ContextWithParserOptions,\n node: Node | CorsaNode | CorsaType | CorsaSymbol | CorsaSignature,\n): string {\n if (\"fileName\" in node) {\n return node.fileName;\n }\n return context.filename;\n}\n"],"mappings":";;;;AAqBA,MAAM,kDAAkC,IAAI,QAG1C;AAEF,SAAgB,cACd,SAC8E;CAE9E,OAAO;EACL,UAFe,eAAe,OAEvB;EACP,qBAAqB;GACnB,OAAO,kBAAkB,OAAO,CAAC,CAAC,QAAQ,mBAAmB;EAC/D;EACA,sBAAsB;GACpB,OAAO,kBAAkB,OAAO,CAAC,CAAC,QAAQ;EAC5C;EACA,mBAAmB;GACjB,OAAO,kBAAkB,OAAO,CAAC,CAAC,QAAQ,iBAAiB;EAC7D;EACA,cAAc,WAAW,QAAQ,UAAU;GACzC,OAAO;IAAE;IAAU,MAAM,QAAQ,WAAW;GAAK;EACnD;EACA,iBAAiB;GACf,OAAO,kBAAkB,OAAO;EAClC;CACF;AACF;AAEA,SAAgB,kBAAkB,SAA0D;CAC1F,OAAO;EACL,kBAAkB,MAAM;GACtB,IAAK,KAAoC,SAAS,iBAChD,OAAO,oBAAoB,MAAc,IAAI;GAE/C,MAAM,aAAa,kBAAkB,IAAI;GACzC,MAAM,OAAO,kBAAkB,OAAO,CAAC,CAAC,QAAQ,qBAC9C,YAAY,SAAS,UAAU,GAC/B,WAAW,UAAU,GACrB,YAAY,UAAU,GACtB,cAAc,SAAS,UAAU,GACjC,SAAS,UAAU,CACrB;GACA,mCAAmC,SAAS,MAAM,MAAM,IAAI;GAC5D,OAAO;EACT;EACA,kBAAkB,MAAM;GACtB,OAAO,KAAK,kBAAkB,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AAO,QAAQ;AACjB"}
|
|
1
|
+
{"version":3,"file":"checker.js","names":[],"sources":["../ts/checker.ts"],"sourcesContent":["import type { Node } from \"@oxlint/plugins\";\n\nimport { createNodeMaps, toPosition } from \"./node_map\";\nimport { sessionForContext } from \"./registry\";\nimport type { CorsaProjectSession } from \"./session\";\nimport { SignatureKind } from \"./types\";\nimport type {\n ContextWithParserOptions,\n CorsaNode,\n CorsaProgramShape,\n CorsaSignature,\n CorsaSymbol,\n CorsaType,\n CorsaTypeCheckerShape,\n} from \"./types\";\n\ntype ImplementingClassDeclarations = {\n /** Ranges of the classes that carry an `implements` clause, keyed by name. */\n readonly byName: ReadonlyMap<string, readonly (readonly [start: number, end: number])[]>;\n /**\n * Names declared by more than one class in the file. A lookup by simple name\n * cannot tell those declarations apart, so it needs a declaration position to\n * pick the right one.\n */\n readonly ambiguousNames: ReadonlySet<string>;\n};\n\ntype ImplementingClassCache = {\n readonly sourceText: string;\n readonly declarations: ImplementingClassDeclarations;\n};\n\nconst implementingClassNamesBySession = new WeakMap<\n CorsaProjectSession,\n Map<string, ImplementingClassCache>\n>();\n\nexport function createProgram(\n context: ContextWithParserOptions,\n): CorsaProgramShape & { readonly nodeMaps: ReturnType<typeof createNodeMaps> } {\n const nodeMaps = createNodeMaps(context);\n return {\n nodeMaps,\n getCompilerOptions() {\n return sessionForContext(context).session.getCompilerOptions();\n },\n getCurrentDirectory() {\n return sessionForContext(context).project.rootDir;\n },\n getRootFileNames() {\n return sessionForContext(context).session.getRootFileNames();\n },\n getSourceFile(fileName = context.filename) {\n return { fileName, text: context.sourceCode.text };\n },\n getTypeChecker() {\n return createTypeChecker(context);\n },\n };\n}\n\nexport function createTypeChecker(context: ContextWithParserOptions): CorsaTypeCheckerShape {\n return {\n getTypeAtLocation(node) {\n if ((node as { readonly type?: string }).type === \"NewExpression\") {\n return typeOfNewExpression(node as Node, this);\n }\n const lookupNode = nodeForTypeLookup(node);\n const type = sessionForContext(context).session.getTypeAtSourceRange(\n filenameFor(context, lookupNode),\n toPosition(lookupNode),\n endPosition(lookupNode),\n sourceTextFor(context, lookupNode),\n nodeKind(lookupNode),\n );\n primeImplementedTypesCacheFromNode(context, node, type, this);\n return type;\n },\n getContextualType(node) {\n return this.getTypeAtLocation(node);\n },\n getSymbolAtLocation(node) {\n const lookupNode = nodeForTypeLookup(node);\n return sessionForContext(context).session.getSymbolAtPosition(\n filenameFor(context, lookupNode),\n toPosition(lookupNode),\n sourceTextFor(context, lookupNode),\n );\n },\n getSymbol(symbol) {\n return sessionForContext(context).session.getSymbol(symbol);\n },\n getSymbolById(id) {\n return sessionForContext(context).session.getSymbol(id);\n },\n getSymbolOfType(type) {\n return sessionForContext(context).session.getSymbolOfType(type);\n },\n getNode(node) {\n return sessionForContext(context).session.getNode(node);\n },\n getNodeById(id) {\n return sessionForContext(context).session.getNode(id);\n },\n getTypeOfSymbol(symbol) {\n return sessionForContext(context).session.getTypeOfSymbol(symbol);\n },\n getTypeOfSymbolById(id) {\n return sessionForContext(context).session.getTypeOfSymbolById(id);\n },\n getDeclaredTypeOfSymbol(symbol) {\n return sessionForContext(context).session.getDeclaredTypeOfSymbol(symbol);\n },\n getDeclaredTypeOfSymbolById(id) {\n return sessionForContext(context).session.getDeclaredTypeOfSymbolById(id);\n },\n getTypeOfSymbolAtLocation(symbol, node) {\n return (\n this.getTypeOfSymbol(symbol) ??\n this.getDeclaredTypeOfSymbol(symbol) ??\n this.getTypeAtLocation(node)\n );\n },\n typeToString(type, enclosingDeclaration, flags) {\n void enclosingDeclaration;\n return sessionForContext(context).session.typeToString(type, flags);\n },\n getBaseTypeOfLiteralType(type) {\n return sessionForContext(context).session.getBaseTypeOfLiteralType(type);\n },\n getPropertiesOfType(type) {\n return sessionForContext(context).session.getPropertiesOfType(type);\n },\n getSignaturesOfType(type, kind) {\n return sessionForContext(context).session.getSignaturesOfType(type, kind);\n },\n getCallSignatureFacts(type, kind, argumentTypeTexts, explicitTypeArgumentTexts) {\n return sessionForContext(context).session.getCallSignatureFacts(\n type,\n kind,\n argumentTypeTexts,\n explicitTypeArgumentTexts,\n );\n },\n getReturnTypeOfSignature(signature) {\n return sessionForContext(context).session.getReturnTypeOfSignature(signature);\n },\n getTypePredicateOfSignature(signature) {\n return sessionForContext(context).session.getTypePredicateOfSignature(signature);\n },\n getBaseTypes(type) {\n return sessionForContext(context).session.getBaseTypes(type);\n },\n getImplementedTypes(node) {\n if (\"pos\" in node) {\n return implementedTypesFromCorsaNode(context, node, this);\n }\n const sourceText = sourceTextFor(context, node);\n const sourceNode = sourceText ? corsaNodeFromEstree(context, node) : undefined;\n if (sourceText && sourceNode) {\n const implemented = implementedTypesFromSourceText(context, sourceNode, sourceText, this);\n if (implemented.length > 0) {\n return implemented;\n }\n }\n return implementedClauseNodes(node)\n .map((clause) => {\n const expression = implementedClauseChildNode(clause, \"expression\") ?? clause;\n const symbol = this.getSymbolAtLocation(expression) ?? this.getSymbolAtLocation(clause);\n return symbol\n ? (this.getDeclaredTypeOfSymbol(symbol) ?? this.getTypeOfSymbol(symbol))\n : (this.getTypeAtLocation(expression) ?? this.getTypeAtLocation(clause));\n })\n .filter((type): type is CorsaType => type !== undefined);\n },\n getImplementedTypesOfType(type) {\n return implementedTypesFromTypeAndBases(context, type, this);\n },\n getTypeArguments(type) {\n return sessionForContext(context).session.getTypeArguments(type);\n },\n getTypesOfType(type) {\n return sessionForContext(context).session.getTypesOfType(type);\n },\n getTargetOfType(type) {\n return sessionForContext(context).session.getTargetOfType(type);\n },\n getTypeParametersOfType(type) {\n return sessionForContext(context).session.getTypeParametersOfType(type);\n },\n getOuterTypeParametersOfType(type) {\n return sessionForContext(context).session.getOuterTypeParametersOfType(type);\n },\n getLocalTypeParametersOfType(type) {\n return sessionForContext(context).session.getLocalTypeParametersOfType(type);\n },\n getObjectTypeOfType(type) {\n return sessionForContext(context).session.getObjectTypeOfType(type);\n },\n getIndexTypeOfType(type) {\n return sessionForContext(context).session.getIndexTypeOfType(type);\n },\n getCheckTypeOfType(type) {\n return sessionForContext(context).session.getCheckTypeOfType(type);\n },\n getExtendsTypeOfType(type) {\n return sessionForContext(context).session.getExtendsTypeOfType(type);\n },\n getBaseTypeOfType(type) {\n return sessionForContext(context).session.getBaseTypeOfType(type);\n },\n getConstraintOfType(type) {\n return sessionForContext(context).session.getConstraintOfType(type);\n },\n isUnionType(type) {\n return (type.flags & typeFlags.union) !== 0;\n },\n isIntersectionType(type) {\n return (type.flags & typeFlags.intersection) !== 0;\n },\n };\n}\n\nfunction primeImplementedTypesCacheFromNode(\n context: ContextWithParserOptions,\n node: Node | CorsaNode,\n type: CorsaType | undefined,\n checker: CorsaTypeCheckerShape,\n): void {\n if (!type || \"pos\" in node) {\n return;\n }\n const kind = (node as { readonly type?: string }).type;\n if (kind !== \"ClassDeclaration\" && kind !== \"ClassExpression\") {\n return;\n }\n const session = sessionForContext(context).session;\n if (session.getCachedOwnImplementedTypes(type.id)) {\n return;\n }\n session.cacheOwnImplementedTypes(type.id, checker.getImplementedTypes(node));\n}\n\nconst typeFlags = {\n union: 1 << 27,\n intersection: 1 << 28,\n} as const;\n\nfunction sourceTextFor(\n context: ContextWithParserOptions,\n node: Node | CorsaNode | CorsaType | CorsaSymbol | CorsaSignature,\n): string | undefined {\n return sourceTextForPath(context, filenameFor(context, node));\n}\n\nfunction sourceTextForPath(\n context: ContextWithParserOptions,\n fileName: string,\n): string | undefined {\n return pathsReferToSameFile(fileName, context.filename)\n ? context.sourceCode.text\n : sessionForContext(context).session.getSourceTextForPath(fileName);\n}\n\nfunction pathsReferToSameFile(left: string, right: string): boolean {\n const normalizedLeft = left.replaceAll(\"\\\\\", \"/\").toLowerCase();\n const normalizedRight = right.replaceAll(\"\\\\\", \"/\").toLowerCase();\n return (\n normalizedLeft === normalizedRight ||\n normalizedLeft.endsWith(`/${normalizedRight}`) ||\n normalizedRight.endsWith(`/${normalizedLeft}`)\n );\n}\n\nfunction typeOfNewExpression(node: Node, checker: CorsaTypeCheckerShape): CorsaType | undefined {\n const callee = childNode(node, \"callee\");\n if (!callee) {\n return undefined;\n }\n const calleeType = checker.getTypeAtLocation(callee);\n if (!calleeType) {\n return undefined;\n }\n const constructSignature = checker.getSignaturesOfType(calleeType, SignatureKind.Construct)[0];\n return constructSignature\n ? (checker.getReturnTypeOfSignature(constructSignature) ?? calleeType)\n : calleeType;\n}\n\nfunction nodeForTypeLookup(node: Node | CorsaNode): Node | CorsaNode {\n if (\"pos\" in node) {\n return node;\n }\n switch ((node as { readonly type?: string }).type) {\n case \"ClassDeclaration\":\n case \"ClassExpression\":\n return childNode(node, \"id\") ?? node;\n case \"TSPropertySignature\":\n return childNode(node, \"key\") ?? node;\n default:\n return node;\n }\n}\n\nfunction endPosition(node: Node | CorsaNode): number {\n if (\"end\" in node) {\n return node.end;\n }\n const range = (node as Node & { readonly range?: readonly [number, number] }).range;\n if (!range) {\n throw new Error(\"corsa oxlint requires ESTree nodes with range data\");\n }\n return range[1];\n}\n\nfunction nodeKind(node: Node | CorsaNode): string | undefined {\n return \"pos\" in node ? undefined : (node as { readonly type?: string }).type;\n}\n\nfunction childNode(node: Node, key: string): Node | undefined {\n const value = (node as unknown as Record<string, unknown>)[key];\n if (isNode(value)) {\n return value;\n }\n return undefined;\n}\n\nfunction implementedClauseNodes(node: Node | CorsaNode): readonly Node[] {\n if (\"pos\" in node) {\n return [];\n }\n const clauses = (node as unknown as { readonly implements?: unknown }).implements;\n if (!Array.isArray(clauses)) {\n return [];\n }\n return clauses.filter(isNode);\n}\n\nfunction implementedClauseChildNode(node: Node, key: string): Node | undefined {\n const value = (node as unknown as Record<string, unknown>)[key];\n if (isNode(value)) {\n return value;\n }\n return undefined;\n}\n\nfunction implementedTypesFromCorsaNode(\n context: ContextWithParserOptions,\n node: CorsaNode,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n const symbol = checker.getSymbolAtLocation(node);\n if (symbol) {\n const declaredType = checker.getDeclaredTypeOfSymbol(symbol) ?? checker.getTypeOfSymbol(symbol);\n if (declaredType) {\n const implemented = checker.getImplementedTypesOfType(declaredType);\n if (implemented.length > 0) {\n return implemented;\n }\n }\n }\n const sourceText = sourceTextFor(context, node);\n if (sourceText) {\n return implementedTypesFromSourceText(context, node, sourceText, checker);\n }\n const type = checker.getTypeAtLocation(node);\n return type ? checker.getImplementedTypesOfType(type) : [];\n}\n\nfunction corsaNodeFromEstree(context: ContextWithParserOptions, node: Node): CorsaNode | undefined {\n const range = (node as { readonly range?: unknown }).range;\n if (\n !Array.isArray(range) ||\n range.length < 2 ||\n typeof range[0] !== \"number\" ||\n typeof range[1] !== \"number\"\n ) {\n return undefined;\n }\n return {\n fileName: context.filename,\n pos: range[0],\n end: range[1],\n range: [range[0], range[1]] as const,\n };\n}\n\nfunction implementedTypesFromTypeAndBases(\n context: ContextWithParserOptions,\n type: CorsaType,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n const session = sessionForContext(context).session;\n const cached = session.getCachedImplementedTypes(type.id);\n if (cached) {\n return cached;\n }\n // Iterative DFS over the base chain so we don't pay for one closure call\n // and one `push(...subResult)` spread per base (each spread used to copy\n // the entire growing accumulator). Visit order doesn't matter because we\n // dedupe by `type.id`.\n const seenTypes = new Set<string>();\n const seenImplementedTypes = new Set<string>();\n const implemented: CorsaType[] = [];\n const stack: CorsaType[] = [type];\n while (stack.length > 0) {\n const current = stack.pop()!;\n if (seenTypes.has(current.id)) {\n continue;\n }\n seenTypes.add(current.id);\n\n const ownImplemented = implementedTypesFromTypeDeclaration(context, current, checker);\n for (let index = 0; index < ownImplemented.length; index += 1) {\n const ownType = ownImplemented[index]!;\n if (seenImplementedTypes.has(ownType.id)) {\n continue;\n }\n seenImplementedTypes.add(ownType.id);\n implemented.push(ownType);\n }\n\n const bases = checker.getBaseTypes(current);\n // Push in reverse so the natural visit order matches the recursive form.\n for (let index = bases.length - 1; index >= 0; index -= 1) {\n const baseType = bases[index]!;\n if (seenTypes.has(baseType.id)) {\n continue;\n }\n stack.push(baseType);\n }\n }\n return session.cacheImplementedTypes(type.id, implemented);\n}\n\nfunction implementedTypesFromTypeDeclaration(\n context: ContextWithParserOptions,\n type: CorsaType,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n const session = sessionForContext(context).session;\n const cached = session.getCachedOwnImplementedTypes(type.id);\n if (cached) {\n return cached;\n }\n const symbol =\n (type.symbol ? session.getSymbol(type.symbol) : undefined) ?? checker.getSymbolOfType(type);\n const declaration = symbol?.valueDeclaration ?? symbol?.declarations?.[0];\n const declarationNode = declaration ? session.getNode(declaration) : undefined;\n const matchedDeclarationNode = session.getClassDeclarationForType(type);\n const localImplementingDeclaration =\n declarationNode && pathsReferToSameFile(declarationNode.fileName, context.filename)\n ? implementingClassDeclaration(context, type, symbol, declarationNode)\n : undefined;\n const resolvedDeclarationNode =\n matchedDeclarationNode ??\n localImplementingDeclaration ??\n declarationNode ??\n implementingClassDeclaration(context, type, symbol);\n const sourceText = resolvedDeclarationNode\n ? sourceTextForPath(context, resolvedDeclarationNode.fileName)\n : undefined;\n const implemented =\n resolvedDeclarationNode && sourceText\n ? implementedTypesFromSourceText(context, resolvedDeclarationNode, sourceText, checker)\n : [];\n return session.cacheOwnImplementedTypes(type.id, implemented);\n}\n\nfunction implementingClassDeclaration(\n context: ContextWithParserOptions,\n type: CorsaType,\n symbol?: CorsaSymbol,\n declarationNode?: CorsaNode,\n): CorsaNode | undefined {\n const name = implementingClassName(type, symbol);\n if (!name) {\n return undefined;\n }\n const { byName, ambiguousNames } = implementingClassDeclarations(context);\n const ranges = byName.get(name);\n if (!ranges || ranges.length === 0) {\n return undefined;\n }\n const range = ambiguousNames.has(name)\n ? declaredRange(ranges, declarationNode, context.filename)\n : ranges[0];\n return range\n ? {\n fileName: context.filename,\n pos: range[0],\n end: range[1],\n range,\n }\n : undefined;\n}\n\n/**\n * Picks the candidate whose `class` keyword sits inside `declarationNode`, which\n * is the declaration the symbol actually points at. Without a usable declaration\n * range there is nothing to disambiguate with, so the lookup gives up rather\n * than returning a same-named class from another scope.\n */\nfunction declaredRange(\n ranges: readonly (readonly [start: number, end: number])[],\n declarationNode: CorsaNode | undefined,\n filename: string,\n): readonly [start: number, end: number] | undefined {\n if (!declarationNode || !pathsReferToSameFile(declarationNode.fileName, filename)) {\n return undefined;\n }\n return ranges.find(([start]) => start >= declarationNode.pos && start < declarationNode.end);\n}\n\nfunction implementingClassName(type: CorsaType, symbol?: CorsaSymbol): string | undefined {\n return symbol?.name || typeSymbolName(type.texts ?? []);\n}\n\nfunction typeSymbolName(texts: readonly string[]): string | undefined {\n for (const text of texts) {\n const match =\n /^(?:typeof\\s+)?(?:[$_\\p{ID_Start}][$_\\u200c\\u200d\\p{ID_Continue}]*\\.)*([$_\\p{ID_Start}][$_\\u200c\\u200d\\p{ID_Continue}]*)(?:\\s*<|$)/u.exec(\n text.trim(),\n );\n if (match?.[1]) {\n return match[1];\n }\n }\n return undefined;\n}\n\nfunction implementingClassDeclarations(\n context: ContextWithParserOptions,\n): ImplementingClassDeclarations {\n const session = sessionForContext(context).session;\n let byFile = implementingClassNamesBySession.get(session);\n if (!byFile) {\n byFile = new Map();\n implementingClassNamesBySession.set(session, byFile);\n }\n const sourceText = context.sourceCode.text;\n const cached = byFile.get(context.filename);\n if (cached?.sourceText === sourceText) {\n return cached.declarations;\n }\n const declarations = collectImplementingClassDeclarations(sourceText);\n byFile.set(context.filename, { sourceText, declarations });\n return declarations;\n}\n\nfunction collectImplementingClassDeclarations(sourceText: string): ImplementingClassDeclarations {\n const byName = new Map<string, (readonly [start: number, end: number])[]>();\n const declaredNames = new Set<string>();\n const ambiguousNames = new Set<string>();\n let offset = 0;\n while (offset < sourceText.length) {\n const classOffset = findKeywordOutsideTrivia(sourceText.slice(offset), \"class\");\n if (classOffset < 0) {\n break;\n }\n const declarationStart = offset + classOffset + \"class\".length;\n const rest = sourceText.slice(declarationStart);\n const match = /^\\s*([$_\\p{ID_Start}][$_\\u200c\\u200d\\p{ID_Continue}]*)/u.exec(rest);\n if (match?.[1]) {\n const name = match[1];\n if (declaredNames.has(name)) {\n ambiguousNames.add(name);\n }\n declaredNames.add(name);\n const bodyOpen = findClassBodyOpen(rest, 0);\n const header = rest.slice(0, bodyOpen >= 0 ? bodyOpen : rest.length);\n if (findKeywordOutsideTrivia(header, \"implements\") >= 0) {\n const range = [offset + classOffset, sourceText.length] as const;\n const ranges = byName.get(name);\n if (ranges) {\n ranges.push(range);\n } else {\n byName.set(name, [range]);\n }\n }\n }\n offset = declarationStart;\n }\n return { byName, ambiguousNames };\n}\n\nfunction implementedTypesFromSourceText(\n context: ContextWithParserOptions,\n node: CorsaNode,\n sourceText: string,\n checker: CorsaTypeCheckerShape,\n): readonly CorsaType[] {\n if (node.pos < 0 || node.end > sourceText.length || node.pos >= node.end) {\n return [];\n }\n const classText = sourceText.slice(node.pos, node.end);\n const classStart = findKeywordOutsideTrivia(classText, \"class\");\n const headerStart = classStart >= 0 ? classStart : 0;\n const bodyOpen = findClassBodyOpen(classText, headerStart);\n const headerText = classText.slice(headerStart, bodyOpen >= 0 ? bodyOpen : classText.length);\n const implementsIndex = findKeywordOutsideTrivia(headerText, \"implements\");\n if (implementsIndex < 0) {\n return [];\n }\n const clauseText = headerText.slice(implementsIndex + \"implements\".length);\n const clauseStart = node.pos + headerStart + implementsIndex + \"implements\".length;\n return splitTopLevelRanges(clauseText, \",\")\n .map((range) => {\n const raw = clauseText.slice(range.start, range.end);\n const leading = raw.search(/\\S/);\n if (leading < 0) {\n return undefined;\n }\n const trailing = raw.match(/\\s*$/)?.[0].length ?? 0;\n const pos = clauseStart + range.start + leading;\n const end = clauseStart + range.end - trailing;\n const lookupNode: CorsaNode = {\n fileName: node.fileName,\n pos,\n end,\n range: [pos, end] as const,\n };\n const nameNode = implementedClauseNameNode(lookupNode, raw);\n const symbol =\n checker.getSymbolAtLocation(nameNode) ?? checker.getSymbolAtLocation(lookupNode);\n const type = symbol\n ? (checker.getDeclaredTypeOfSymbol(symbol) ?? checker.getTypeOfSymbol(symbol))\n : (checker.getTypeAtLocation(nameNode) ?? checker.getTypeAtLocation(lookupNode));\n if (type) {\n try {\n checker.typeToString(type);\n } catch {\n // Corsa-side relation fallbacks handle stale type handles; avoid\n // deriving replacement text from source names in the JS bridge.\n }\n }\n return type;\n })\n .filter((type): type is CorsaType => type !== undefined);\n}\n\nfunction implementedClauseNameNode(node: CorsaNode, raw: string): CorsaNode {\n const range = lastTypeNameIdentifierRange(raw);\n if (!range) {\n return node;\n }\n const pos = node.pos + range.start;\n const end = node.pos + range.end;\n return {\n fileName: node.fileName,\n pos,\n end,\n range: [pos, end] as const,\n };\n}\n\nfunction lastTypeNameIdentifierRange(\n text: string,\n): { readonly start: number; readonly end: number } | undefined {\n let last: { start: number; end: number } | undefined;\n const scanner = createScanner();\n for (let index = 0; index < text.length; index += 1) {\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n const char = text[index];\n if (char === \"<\") {\n break;\n }\n if (!isIdentifierStart(char)) {\n continue;\n }\n let end = index + 1;\n while (isIdentifierPart(text[end])) {\n end += 1;\n }\n last = { start: index, end };\n index = end - 1;\n }\n return last;\n}\n\nfunction findClassBodyOpen(text: string, start: number): number {\n const scanner = createScanner();\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = start; index < text.length; index += 1) {\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n const char = text[index];\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (\n char === \"{\" &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n return index;\n } else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n }\n return -1;\n}\n\nfunction findKeywordOutsideTrivia(text: string, keyword: string): number {\n const scanner = createScanner();\n for (let index = 0; index < text.length; index += 1) {\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n if (matchesKeyword(text, keyword, index)) {\n return index;\n }\n }\n return -1;\n}\n\nfunction matchesKeyword(text: string, keyword: string, index: number): boolean {\n return (\n text.startsWith(keyword, index) &&\n !isIdentifierPart(text[index - 1]) &&\n !isIdentifierPart(text[index + keyword.length])\n );\n}\n\nfunction isIdentifierPart(char: string | undefined): boolean {\n return char !== undefined && (isIdentifierStart(char) || /[0-9]/.test(char));\n}\n\nfunction isIdentifierStart(char: string | undefined): boolean {\n return char !== undefined && /[A-Za-z_$]/.test(char);\n}\n\nfunction splitTopLevelRanges(\n text: string,\n delimiter: string,\n): readonly { readonly start: number; readonly end: number }[] {\n const ranges: { start: number; end: number }[] = [];\n const scanner = createScanner();\n let start = 0;\n let angleDepth = 0;\n let parenDepth = 0;\n let bracketDepth = 0;\n let braceDepth = 0;\n for (let index = 0; index < text.length; index += 1) {\n const char = text[index];\n const nextIndex = scanner.skip(text, index);\n if (nextIndex > index) {\n index = nextIndex - 1;\n continue;\n }\n if (char === \"<\") angleDepth += 1;\n else if (char === \">\") angleDepth = Math.max(0, angleDepth - 1);\n else if (char === \"(\") parenDepth += 1;\n else if (char === \")\") parenDepth = Math.max(0, parenDepth - 1);\n else if (char === \"[\") bracketDepth += 1;\n else if (char === \"]\") bracketDepth = Math.max(0, bracketDepth - 1);\n else if (char === \"{\") braceDepth += 1;\n else if (char === \"}\") braceDepth = Math.max(0, braceDepth - 1);\n else if (\n char === delimiter &&\n angleDepth === 0 &&\n parenDepth === 0 &&\n bracketDepth === 0 &&\n braceDepth === 0\n ) {\n ranges.push({ start, end: index });\n start = index + 1;\n }\n }\n ranges.push({ start, end: text.length });\n return ranges;\n}\n\nfunction createScanner(): {\n skip(text: string, index: number): number;\n} {\n let quote: string | undefined;\n let escaped = false;\n let inLineComment = false;\n let inBlockComment = false;\n return {\n skip(text, index) {\n const char = text[index];\n const next = text[index + 1];\n if (inLineComment) {\n if (char === \"\\n\" || char === \"\\r\") {\n inLineComment = false;\n }\n return index + 1;\n }\n if (inBlockComment) {\n if (char === \"*\" && next === \"/\") {\n inBlockComment = false;\n return index + 2;\n }\n return index + 1;\n }\n if (quote) {\n if (escaped) {\n escaped = false;\n } else if (char === \"\\\\\") {\n escaped = true;\n } else if (char === quote) {\n quote = undefined;\n }\n return index + 1;\n }\n if (char === \"/\" && next === \"/\") {\n inLineComment = true;\n return index + 2;\n }\n if (char === \"/\" && next === \"*\") {\n inBlockComment = true;\n return index + 2;\n }\n if (char === '\"' || char === \"'\" || char === \"`\") {\n quote = char;\n return index + 1;\n }\n return index;\n },\n };\n}\n\nfunction isNode(value: unknown): value is Node {\n return typeof value === \"object\" && value !== null && \"type\" in value && \"range\" in value;\n}\n\nfunction filenameFor(\n context: ContextWithParserOptions,\n node: Node | CorsaNode | CorsaType | CorsaSymbol | CorsaSignature,\n): string {\n if (\"fileName\" in node) {\n return node.fileName;\n }\n return context.filename;\n}\n"],"mappings":";;;;AAgCA,MAAM,kDAAkC,IAAI,QAG1C;AAEF,SAAgB,cACd,SAC8E;CAE9E,OAAO;EACL,UAFe,eAAe,OAEvB;EACP,qBAAqB;GACnB,OAAO,kBAAkB,OAAO,CAAC,CAAC,QAAQ,mBAAmB;EAC/D;EACA,sBAAsB;GACpB,OAAO,kBAAkB,OAAO,CAAC,CAAC,QAAQ;EAC5C;EACA,mBAAmB;GACjB,OAAO,kBAAkB,OAAO,CAAC,CAAC,QAAQ,iBAAiB;EAC7D;EACA,cAAc,WAAW,QAAQ,UAAU;GACzC,OAAO;IAAE;IAAU,MAAM,QAAQ,WAAW;GAAK;EACnD;EACA,iBAAiB;GACf,OAAO,kBAAkB,OAAO;EAClC;CACF;AACF;AAEA,SAAgB,kBAAk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
1
1
|
import { ContextWithParserOptions, ResolvedProjectConfig, TypeAwareParserOptions } from "./types.js";
|
|
2
|
-
|
|
3
2
|
//#region src/bindings/nodejs/corsa_oxlint/ts/context.d.ts
|
|
4
3
|
declare function defaultCorsaExecutable(rootDir: string, platform?: NodeJS.Platform, resolveFrom?: string): string;
|
|
5
4
|
declare function resolveProjectConfig(context: ContextWithParserOptions): ResolvedProjectConfig;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ import { TSESLint } from "./ts_eslint.js";
|
|
|
13
13
|
import { index_d_exports } from "./rules/index.js";
|
|
14
14
|
import { stylistic_d_exports } from "./stylistic.js";
|
|
15
15
|
import { ESTree as ESTree$1 } from "@oxlint/plugins";
|
|
16
|
-
|
|
17
16
|
//#region src/bindings/nodejs/corsa_oxlint/ts/index.d.ts
|
|
18
17
|
type CorsaAstNodeType = keyof typeof AST_NODE_TYPES;
|
|
19
18
|
type ESTree = ESTree.NodeTypes;
|
|
@@ -26,9 +25,9 @@ declare namespace ESTree {
|
|
|
26
25
|
} : never : never;
|
|
27
26
|
type RemapTuple<Value extends readonly unknown[]> = Value extends [] ? [] : Value extends [infer Head, ...infer Tail] ? [RemapNodeField<Head>, ...RemapTuple<Tail>] : Value extends readonly [infer Head, ...infer Tail] ? readonly [RemapNodeField<Head>, ...RemapTuple<Tail>] : never;
|
|
28
27
|
type RemapNodeField<Value> = Value extends ESTree$1.BindingIdentifier ? BindingIdentifier : Value extends readonly [unknown, ...unknown[]] ? RemapTuple<Value> : Value extends OxlintNode ? NodeByType<Extract<Value["type"], string>> : Value extends readonly (infer Item)[] ? readonly RemapNodeField<Item>[] : Value extends (infer Item)[] ? RemapNodeField<Item>[] : Value;
|
|
29
|
-
type RemapNodeShape<Candidate> = Candidate extends object ? { [Key in keyof Candidate]: RemapNodeField<Candidate[Key]
|
|
28
|
+
type RemapNodeShape<Candidate> = Candidate extends object ? { [Key in keyof Candidate]: RemapNodeField<Candidate[Key]>; } : Candidate;
|
|
30
29
|
export type NodeByType<Kind extends string> = Kind extends string ? RemapNodeShape<NarrowNode<OxlintNode, Kind>> : never;
|
|
31
|
-
export type Node = { [Kind in CorsaAstNodeType]: NodeByType<Kind
|
|
30
|
+
export type Node = { [Kind in CorsaAstNodeType]: NodeByType<Kind>; }[CorsaAstNodeType] | BindingIdentifier;
|
|
32
31
|
export type AccessorProperty = NodeByType<"AccessorProperty">;
|
|
33
32
|
export type ArrayExpression = NodeByType<"ArrayExpression">;
|
|
34
33
|
export type ArrayPattern = NodeByType<"ArrayPattern">;
|
|
@@ -222,7 +221,7 @@ declare namespace ESTree {
|
|
|
222
221
|
export type FormalParameterRest = RestElement;
|
|
223
222
|
export type ParamPattern = FormalParameter | TSParameterProperty | FormalParameterRest;
|
|
224
223
|
export type ClassElement = StaticBlock | MethodDefinition | TSAbstractMethodDefinition | PropertyDefinition | TSAbstractPropertyDefinition | AccessorProperty | TSAbstractAccessorProperty | TSIndexSignature;
|
|
225
|
-
export type NodeTypes = { [Kind in CorsaAstNodeType]: NodeByType<Kind
|
|
224
|
+
export type NodeTypes = { [Kind in CorsaAstNodeType]: NodeByType<Kind>; } & {
|
|
226
225
|
BindingIdentifier: BindingIdentifier;
|
|
227
226
|
Identifier: Identifier | BindingIdentifier;
|
|
228
227
|
NewExpression: NewExpression;
|
package/dist/node_map.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ContextWithParserOptions, CorsaNode } from "./types.js";
|
|
2
2
|
import { Node } from "@oxlint/plugins";
|
|
3
|
-
|
|
4
3
|
//#region src/bindings/nodejs/corsa_oxlint/ts/node_map.d.ts
|
|
5
4
|
declare function createNodeMaps(context: ContextWithParserOptions): {
|
|
6
5
|
esTreeNodeToTSNodeMap: {
|
package/dist/oxlint_utils.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ContextWithParserOptions, ParserServices } from "./types.js";
|
|
2
2
|
import { getParserServices } from "./parser_services.js";
|
|
3
3
|
import { Rule, RuleMetaWithMessages, Visitor } from "./plugin.js";
|
|
4
|
-
|
|
5
4
|
//#region src/bindings/nodejs/corsa_oxlint/ts/oxlint_utils.d.ts
|
|
6
5
|
type RuleCreatorRule<TOptions extends readonly unknown[] = readonly unknown[], TMessageIds extends string = string> = {
|
|
7
6
|
readonly name: string;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { ContextWithParserOptions } from "./types.js";
|
|
|
2
2
|
import { AST_NODE_TYPES } from "./compat.js";
|
|
3
3
|
import { ESTree as ESTree$1 } from "./index.js";
|
|
4
4
|
import { Diagnostic, Plugin as Plugin$1, Rule as Rule$1, RuleMeta } from "@oxlint/plugins";
|
|
5
|
-
|
|
6
5
|
//#region src/bindings/nodejs/corsa_oxlint/ts/plugin.d.ts
|
|
7
6
|
type Plugin = Omit<Plugin$1, "rules"> & {
|
|
8
7
|
/**
|
|
@@ -40,7 +39,7 @@ type BivariantVisitorHandler<Handler extends (...args: any[]) => any> = {
|
|
|
40
39
|
bivarianceHack(...args: Parameters<Handler>): ReturnType<Handler>;
|
|
41
40
|
}["bivarianceHack"];
|
|
42
41
|
type VisitorNode<Kind extends CorsaAstNodeType> = ESTree$1[Kind];
|
|
43
|
-
type Visitor = { [Kind in CorsaAstNodeType]?: BivariantVisitorHandler<(node: VisitorNode<Kind>) => void
|
|
42
|
+
type Visitor = { [Kind in CorsaAstNodeType]?: BivariantVisitorHandler<(node: VisitorNode<Kind>) => void>; } & { [Kind in CorsaAstNodeType as `${Kind}:exit`]?: BivariantVisitorHandler<(node: VisitorNode<Kind>) => void>; } & Record<string, BivariantVisitorHandler<(node: ESTree$1.Node) => void> | undefined>;
|
|
44
43
|
type VisitorWithHooks = Visitor & {
|
|
45
44
|
readonly before?: () => boolean | void;
|
|
46
45
|
readonly after?: () => void;
|
package/dist/registry.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ContextWithParserOptions } from "./types.js";
|
|
2
2
|
import { resolveProjectConfig } from "./context.js";
|
|
3
3
|
import { CorsaProjectSession } from "./session.js";
|
|
4
|
-
|
|
5
4
|
//#region src/bindings/nodejs/corsa_oxlint/ts/registry.d.ts
|
|
6
5
|
declare function sessionForContext(context: ContextWithParserOptions): {
|
|
7
6
|
project: ReturnType<typeof resolveProjectConfig>;
|
package/dist/rule_tester.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CorsaOxlintSettings } from "./types.js";
|
|
2
|
-
|
|
3
2
|
//#region src/bindings/nodejs/corsa_oxlint/ts/rule_tester.d.ts
|
|
4
3
|
type TesterConfig = import("oxlint/plugins-dev").RuleTester.Config;
|
|
5
4
|
type TestCase = import("oxlint/plugins-dev").RuleTester.ValidTestCase & Partial<import("oxlint/plugins-dev").RuleTester.InvalidTestCase>;
|
|
@@ -29,10 +28,10 @@ declare class RuleTester {
|
|
|
29
28
|
static get describe(): (text: string, fn: () => void) => void;
|
|
30
29
|
static set describe(value: (text: string, fn: () => void) => void);
|
|
31
30
|
static get it(): ((text: string, fn: () => void) => void) & {
|
|
32
|
-
only?: ((text: string, fn: () => void) => void) & /*elided*/any;
|
|
31
|
+
only?: ((text: string, fn: () => void) => void) & /*elided*/ any;
|
|
33
32
|
};
|
|
34
33
|
static set it(value: ((text: string, fn: () => void) => void) & {
|
|
35
|
-
only?: ((text: string, fn: () => void) => void) & /*elided*/any;
|
|
34
|
+
only?: ((text: string, fn: () => void) => void) & /*elided*/ any;
|
|
36
35
|
});
|
|
37
36
|
static only(item: string | TestCase): TestCase;
|
|
38
37
|
constructor(config?: RuleTesterConfig);
|
package/dist/rules/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ContextWithParserOptions } from "../types.js";
|
|
2
2
|
import { Rule } from "../plugin.js";
|
|
3
|
+
import "../index.js";
|
|
3
4
|
import { NativeLintDiagnostic, NativeLintNode } from "@corsa-bind/napi";
|
|
4
|
-
|
|
5
5
|
//#region src/bindings/nodejs/corsa_oxlint/ts/rules/native_bridge.d.ts
|
|
6
6
|
type RangedNode = {
|
|
7
7
|
readonly type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native_bridge.js","names":[],"sources":["../../ts/rules/native_bridge.ts"],"sourcesContent":["import { nativeLintRuleMetas, runNativeLintRule } from \"@corsa-bind/napi\";\nimport type {\n NativeLintDiagnostic,\n NativeLintNode,\n NativeLintRange,\n NativeLintRuleMeta,\n NativeNodeMetadataDepth,\n} from \"@corsa-bind/napi\";\n\nimport { createNativeRule } from \"./rule_creator\";\nimport { checkerFor, propertyNamesOfNode, typeAtNode, typeTextsAtNode } from \"./type_utils\";\nimport type { ContextWithParserOptions, CorsaCallSignatureFacts, CorsaType } from \"../types\";\n\ntype RangedNode = {\n readonly type: string;\n readonly range: readonly [number, number];\n};\n\ntype NativeRuleBridgeOptions = {\n readonly shouldRun?: (node: RangedNode, context: ContextWithParserOptions) => boolean;\n readonly includeTypeTexts?: NodeMetadataOption;\n readonly includePropertyNames?: NodeMetadataOption;\n readonly includeText?: NodeMetadataOption;\n readonly maxDepth?: number;\n};\n\ntype NodeMetadataOption = boolean | ((node: RangedNode, depth: number) => boolean);\n\nconst MAX_NATIVE_NODE_DEPTH = 4;\nconst nativeRuleMetasByName = new Map(nativeLintRuleMetas().map((meta) => [meta.name, meta]));\n\nexport function createRustNativeRule(\n ruleName: string,\n metaOverrides: Record<string, unknown> = {},\n bridgeOptions: NativeRuleBridgeOptions = {},\n) {\n const meta = nativeRuleMeta(ruleName);\n return createNativeRule(\n ruleName,\n {\n docs: {\n description: meta.docsDescription,\n },\n hasSuggestions: meta.hasSuggestions,\n messages: meta.messages,\n ...metaOverrides,\n },\n (context) =>\n Object.fromEntries(\n meta.listeners.map((listener) => [\n listener,\n (node: RangedNode) => {\n if (bridgeOptions.shouldRun?.(node, context) === false) {\n return;\n }\n const includeTypeTexts = includeTypeTextsOption(bridgeOptions, meta);\n const includeText = includeTextOption(bridgeOptions, meta);\n reportNativeDiagnostics(\n context,\n node,\n runNativeLintRule(\n ruleName,\n toNativeNode(\n context,\n node,\n includeTypeTexts,\n maxDepthOption(bridgeOptions, meta),\n true,\n includePropertyNamesOption(bridgeOptions, meta),\n includeText,\n ),\n ),\n );\n },\n ]),\n ),\n );\n}\n\nexport function toNativeNode(\n context: ContextWithParserOptions,\n node: RangedNode,\n includeTypeTexts: NodeMetadataOption = true,\n maxDepth = MAX_NATIVE_NODE_DEPTH,\n includeRuleOptions = true,\n includePropertyNames: NodeMetadataOption = includeTypeTexts,\n includeText: NodeMetadataOption = false,\n depth = 0,\n): NativeLintNode {\n const fields: Record<string, unknown> = {};\n const children: Record<string, NativeLintNode> = {};\n const childLists: Record<string, NativeLintNode[]> = {};\n\n for (const [key, value] of Object.entries(node)) {\n if (isSkippedField(key)) {\n continue;\n }\n if (isNativeChildNode(value)) {\n if (maxDepth > 0) {\n children[key] = toNativeNode(\n context,\n value,\n includeTypeTexts,\n maxDepth - 1,\n false,\n includePropertyNames,\n includeText,\n depth + 1,\n );\n }\n continue;\n }\n if (Array.isArray(value)) {\n if (maxDepth > 0 && value.every(isNativeChildNode)) {\n childLists[key] = value.map((child) =>\n toNativeNode(\n context,\n child,\n includeTypeTexts,\n maxDepth - 1,\n false,\n includePropertyNames,\n includeText,\n depth + 1,\n ),\n );\n } else if (value.every(isJsonPrimitive)) {\n fields[key] = value;\n }\n continue;\n }\n if (isPrimitiveRecord(value)) {\n fields[key] = value;\n continue;\n }\n if (isJsonPrimitive(value)) {\n fields[key] = value;\n }\n }\n\n const typeAnnotationText = sourceTypeAnnotationText(context, node);\n if (typeAnnotationText) {\n fields.__typeAnnotationText = typeAnnotationText;\n }\n\n const options = (context as { options?: unknown }).options;\n if (includeRuleOptions && Array.isArray(options) && options.length > 0 && isJsonValue(options)) {\n fields.__ruleOptions = options;\n }\n if (includeRuleOptions) {\n addHostInputs(context, node, fields);\n }\n\n const nativeNode: NativeLintNode = {\n kind: node.type,\n range: nativeRange(node.range),\n };\n if (includeMetadataForNode(includeText, node, depth)) {\n nativeNode.text = context.sourceCode.getText(node as never);\n }\n if (includeMetadataForNode(includeTypeTexts, node, depth)) {\n nativeNode.typeTexts = typeTextsAtNode(context, node);\n }\n if (includeMetadataForNode(includePropertyNames, node, depth)) {\n nativeNode.propertyNames = propertyNamesOfNode(context, node);\n }\n if (Object.keys(fields).length > 0) {\n nativeNode.fields = fields;\n }\n if (Object.keys(children).length > 0) {\n nativeNode.children = children;\n }\n if (Object.keys(childLists).length > 0) {\n nativeNode.childLists = childLists;\n }\n return nativeNode;\n}\n\nexport function reportNativeDiagnostics(\n context: ContextWithParserOptions,\n node: RangedNode,\n diagnostics: readonly NativeLintDiagnostic[],\n): void {\n for (const diagnostic of diagnostics) {\n context.report({\n node: reportNodeForRange(node, diagnostic.range),\n messageId: diagnostic.messageId,\n ...(diagnostic.suggestions?.length\n ? {\n suggest: diagnostic.suggestions.map((suggestion) => ({\n messageId: suggestion.messageId,\n fix: (fixer: any) =>\n suggestion.fixes.map((fix) =>\n fixer.replaceTextRange(oxlintRange(fix.range), fix.replacementText),\n ),\n })),\n }\n : {}),\n } as never);\n }\n}\n\nfunction reportNodeForRange(root: RangedNode, range: NativeLintRange): RangedNode {\n return findNodeByRange(root, range) ?? root;\n}\n\nfunction findNodeByRange(\n value: unknown,\n range: NativeLintRange,\n seen = new Set<object>(),\n): RangedNode | undefined {\n if (typeof value !== \"object\" || value === null || seen.has(value)) {\n return undefined;\n }\n seen.add(value);\n\n if (isNativeChildNode(value) && sameRange(value.range, range)) {\n return value;\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n const match = findNodeByRange(item, range, seen);\n if (match) {\n return match;\n }\n }\n return undefined;\n }\n\n for (const [key, child] of Object.entries(value)) {\n if (isSkippedField(key)) {\n continue;\n }\n const match = findNodeByRange(child, range, seen);\n if (match) {\n return match;\n }\n }\n return undefined;\n}\n\nfunction nativeRuleMeta(ruleName: string): NativeLintRuleMeta {\n const meta = nativeRuleMetasByName.get(ruleName);\n if (!meta) {\n throw new Error(`corsa oxlint native Rust rule is not registered: ${ruleName}`);\n }\n return meta;\n}\n\nfunction includeTypeTextsOption(\n options: NativeRuleBridgeOptions,\n meta: NativeLintRuleMeta,\n): NodeMetadataOption {\n return options.includeTypeTexts ?? nodeMetadataDepthOption(meta.bridge.typeTexts, false);\n}\n\nfunction includePropertyNamesOption(\n options: NativeRuleBridgeOptions,\n meta: NativeLintRuleMeta,\n): NodeMetadataOption {\n return options.includePropertyNames ?? nodeMetadataDepthOption(meta.bridge.propertyNames, false);\n}\n\nfunction includeTextOption(\n options: NativeRuleBridgeOptions,\n meta: NativeLintRuleMeta,\n): NodeMetadataOption {\n return options.includeText ?? nodeMetadataDepthOption(meta.bridge.text, false);\n}\n\nfunction maxDepthOption(options: NativeRuleBridgeOptions, meta: NativeLintRuleMeta): number {\n return options.maxDepth ?? meta.bridge.maxDepth ?? MAX_NATIVE_NODE_DEPTH;\n}\n\nfunction nodeMetadataDepthOption(\n metadata: NativeNodeMetadataDepth | undefined,\n fallback: NodeMetadataOption,\n): NodeMetadataOption {\n if (!metadata) {\n return fallback;\n }\n return (_node, depth) => depth >= metadata.minDepth && depth <= metadata.maxDepth;\n}\n\nfunction includeMetadataForNode(\n option: NodeMetadataOption,\n node: RangedNode,\n depth: number,\n): boolean {\n return typeof option === \"function\" ? option(node, depth) : option;\n}\n\nfunction sourceTypeAnnotationText(\n context: ContextWithParserOptions,\n node: RangedNode,\n): string | undefined {\n const annotation = (node as any).typeAnnotation?.typeAnnotation ?? (node as any).typeAnnotation;\n if (!annotation) {\n return undefined;\n }\n const text = (context as any).sourceCode?.getText(annotation);\n return typeof text === \"string\" && text.length > 0 ? text : undefined;\n}\n\nfunction nativeRange(range: readonly [number, number]): NativeLintRange {\n return { start: range[0], end: range[1] };\n}\n\nfunction oxlintRange(range: NativeLintRange): [number, number] {\n return [range.start, range.end];\n}\n\nfunction sameRange(range: readonly [number, number], expected: NativeLintRange): boolean {\n return range[0] === expected.start && range[1] === expected.end;\n}\n\nfunction addHostInputs(\n context: ContextWithParserOptions,\n node: RangedNode,\n fields: Record<string, unknown>,\n): void {\n const current = node as any;\n const ancestors = ancestorFacts(context, current);\n if (ancestors.length > 0) {\n fields.__ancestorFacts = ancestors;\n }\n if (current.type === \"CallExpression\" || current.type === \"NewExpression\") {\n const callFacts = callFactsOfNode(context, current);\n if (Object.keys(callFacts).length > 0) {\n fields.__callFacts = callFacts;\n }\n }\n if (current.parent?.type) {\n fields.__parentKind = current.parent.type;\n }\n const symbolFacts = symbolFactsOfNode(context, current);\n if (Object.keys(symbolFacts).length > 0) {\n fields.__symbolFacts = symbolFacts;\n }\n const typeParameterFacts = typeParameterFactsOfNode(context, current);\n if (Object.keys(typeParameterFacts).length > 0) {\n fields.__typeParameterFacts = typeParameterFacts;\n }\n const returnTypeFacts = returnTypeFactsOfNode(context, current);\n if (Object.keys(returnTypeFacts).length > 0) {\n fields.__returnTypeFacts = returnTypeFacts;\n }\n}\n\nfunction callFactsOfNode(context: ContextWithParserOptions, node: any): Record<string, unknown> {\n const facts: Record<string, unknown> = {};\n const calleeName = identifierName(stripChainExpression(node.callee));\n if (calleeName) {\n facts.calleeName = calleeName;\n }\n const signatureFacts = callSignatureFactsOfNode(context, node);\n if (signatureFacts.expectedArgumentTypeTexts?.length) {\n facts.expectedArgumentTypeTexts = signatureFacts.expectedArgumentTypeTexts;\n }\n if (signatureFacts.explicitTypeArgumentsRequired !== undefined) {\n facts.explicitTypeArgumentsRequired = signatureFacts.explicitTypeArgumentsRequired;\n }\n const typeArgumentFacts = typeArgumentFactsOfCall(node, signatureFacts);\n for (const [key, value] of Object.entries(typeArgumentFacts)) {\n facts[key] = value;\n }\n return facts;\n}\n\nfunction symbolFactsOfNode(context: ContextWithParserOptions, node: any): Record<string, unknown> {\n if (node.type !== \"Identifier\" && node.type !== \"MemberExpression\") {\n return {};\n }\n const target = node.type === \"MemberExpression\" ? node.property : node;\n if (target?.type !== \"Identifier\") {\n return {};\n }\n const symbol = checkerFor(context).getSymbolAtLocation(target);\n const declarations = symbol?.declarations?.filter(\n (declaration): declaration is string => typeof declaration === \"string\",\n );\n if (!declarations || declarations.length === 0) {\n return {};\n }\n return {\n declarations,\n filename: context.filename,\n cwd: context.cwd,\n sourceText: context.sourceCode.text,\n };\n}\n\nfunction typeParameterFactsOfNode(\n context: ContextWithParserOptions,\n node: any,\n): Record<string, unknown> {\n if (node.type !== \"TSTypeParameterDeclaration\") {\n return {};\n }\n const params = Array.isArray(node.params) ? node.params : [];\n if (params.length !== 1) {\n return {};\n }\n const name = typeParameterName(params[0]);\n if (!name) {\n return {};\n }\n return {\n name,\n ownerText: node.parent\n ? context.sourceCode.getText(node.parent)\n : context.sourceCode.getText(node),\n };\n}\n\nfunction returnTypeFactsOfNode(\n context: ContextWithParserOptions,\n node: any,\n): Record<string, unknown> {\n const returnTypeTexts =\n node.type === \"ReturnStatement\"\n ? returnTypeTextsOfNearestFunction(context, node)\n : isFunctionLike(node) || node.type === \"ArrowFunctionExpression\"\n ? returnTypeTextsOfFunction(context, node)\n : [];\n return returnTypeTexts.length > 0 ? { texts: returnTypeTexts } : {};\n}\n\nfunction ancestorFacts(\n context: ContextWithParserOptions,\n node: any,\n): readonly Record<string, unknown>[] {\n const ancestors = (context.sourceCode as any)?.getAncestors?.(node) ?? [];\n return ancestors\n .filter((ancestor: any) => typeof ancestor?.type === \"string\")\n .map((ancestor: any) => {\n const fact: Record<string, unknown> = { kind: ancestor.type };\n if (isRange(ancestor.range)) {\n fact.start = ancestor.range[0];\n fact.end = ancestor.range[1];\n }\n if (typeof ancestor.async === \"boolean\") {\n fact.async = ancestor.async;\n }\n const className = ancestor.id?.name;\n if (\n (ancestor.type === \"ClassDeclaration\" || ancestor.type === \"ClassExpression\") &&\n typeof className === \"string\" &&\n className.length > 0\n ) {\n fact.className = className;\n }\n if (isFunctionLike(ancestor)) {\n const paramNames = Array.isArray(ancestor.params)\n ? ancestor.params\n .map(identifierName)\n .filter((name: string | undefined): name is string => name !== undefined)\n : [];\n if (paramNames.length > 0) {\n fact.paramNames = paramNames;\n }\n if (ancestor.parent?.type) {\n fact.parentKind = ancestor.parent.type;\n }\n const parentCalleeName = identifierName(stripChainExpression(ancestor.parent?.callee));\n if (parentCalleeName) {\n fact.parentCalleeName = parentCalleeName;\n }\n if (ancestor.parent?.parent?.type) {\n fact.parentParentKind = ancestor.parent.parent.type;\n }\n const parentParentCalleeName = identifierName(\n stripChainExpression(ancestor.parent?.parent?.callee),\n );\n if (parentParentCalleeName) {\n fact.parentParentCalleeName = parentParentCalleeName;\n }\n }\n return fact;\n });\n}\n\nfunction callSignatureFactsOfNode(\n context: ContextWithParserOptions,\n node: any,\n): CorsaCallSignatureFacts {\n const callee = stripChainExpression(node.callee);\n if (!callee) {\n return {};\n }\n const calleeType = typeAtNode(context, callee);\n if (!calleeType) {\n return {};\n }\n const args = Array.isArray(node.arguments) ? node.arguments : [];\n const explicitTypeArguments = typeArgumentNodes(node)\n .map((typeArgument) => context.sourceCode.getText(typeArgument))\n .filter((text: string): text is string => text.length > 0);\n return checkerFor(context).getCallSignatureFacts(\n calleeType,\n node.type === \"NewExpression\" ? 1 : 0,\n args.map((arg: unknown) => typeTextsAtNode(context, arg as never)),\n explicitTypeArguments,\n );\n}\n\nfunction typeArgumentNodes(node: any): readonly any[] {\n const candidates = [\n node.typeArguments?.params,\n node.typeParameters?.params,\n node.typeParameterInstantiation?.params,\n ];\n return candidates.find(Array.isArray) ?? [];\n}\n\nfunction typeArgumentFactsOfCall(\n node: any,\n signatureFacts: CorsaCallSignatureFacts,\n): Record<string, unknown> {\n const typeArguments = typeArgumentNodes(node);\n if (typeArguments.length === 0) {\n return {};\n }\n const facts: Record<string, unknown> = {\n typeArgumentRanges: typeArguments\n .map((typeArgument) => rangeObject(typeArgument.range))\n .filter((range): range is { start: number; end: number } => range !== undefined),\n };\n const listRange = typeArgumentListRange(node, typeArguments);\n if (listRange) {\n facts.typeArgumentListRange = listRange;\n }\n const parameterCount =\n signatureFacts.signature?.typeParameters?.length ??\n signatureFacts.signature?.typeParameterDefaultTexts?.length ??\n 0;\n if (parameterCount > 0) {\n facts.typeParameterCount = parameterCount;\n }\n const defaultTexts = signatureFacts.signature?.typeParameterDefaultTexts ?? [];\n const lastIndex = typeArguments.length - 1;\n const lastDefaultText = defaultTexts[lastIndex];\n if (lastDefaultText !== undefined) {\n const hasDefault = lastDefaultText.trim().length > 0;\n facts.lastTypeParameterHasDefault = hasDefault;\n if (hasDefault && signatureFacts.explicitTypeArgumentsRequired === false) {\n facts.lastTypeArgumentEqualsDefault = true;\n facts.lastTypeArgumentSameTypeFlagsAsDefault = true;\n facts.lastTypeArgumentIdenticalToDefault = true;\n }\n }\n return facts;\n}\n\nfunction typeArgumentListRange(\n node: any,\n typeArguments: readonly any[],\n): { start: number; end: number } | undefined {\n const candidates = [node.typeArguments, node.typeParameters, node.typeParameterInstantiation];\n const list = candidates.find((candidate) => Array.isArray(candidate?.params));\n const fromList = rangeObject(list?.range);\n if (fromList) {\n return fromList;\n }\n const first = rangeObject(typeArguments[0]?.range);\n const last = rangeObject(typeArguments[typeArguments.length - 1]?.range);\n if (!first || !last || first.start <= 0) {\n return undefined;\n }\n return { start: first.start - 1, end: last.end + 1 };\n}\n\nfunction rangeObject(range: unknown): { start: number; end: number } | undefined {\n return isRange(range) ? { start: range[0], end: range[1] } : undefined;\n}\n\nfunction typeParameterName(node: any): string | undefined {\n if (typeof node?.name === \"string\") {\n return node.name;\n }\n if (typeof node?.name?.name === \"string\") {\n return node.name.name;\n }\n return undefined;\n}\n\nfunction renderTypeTexts(context: ContextWithParserOptions, type: CorsaType): readonly string[] {\n const texts = new Set<string>();\n const checker = checkerFor(context);\n for (const text of [...(type.texts ?? []), checker.typeToString(type)]) {\n if (text) {\n texts.add(text);\n }\n }\n return [...texts];\n}\n\nfunction nearestFunctionAncestor(context: ContextWithParserOptions, node: any): any {\n const ancestors = (context.sourceCode as any)?.getAncestors?.(node) ?? [];\n return [...ancestors].reverse().find((ancestor: any) => ancestor.type?.includes(\"Function\"));\n}\n\nfunction isFunctionLike(node: any): boolean {\n return typeof node?.type === \"string\" && node.type.includes(\"Function\");\n}\n\nfunction returnTypeTextsOfNearestFunction(\n context: ContextWithParserOptions,\n node: any,\n): readonly string[] {\n const owner = nearestFunctionAncestor(context, node);\n return owner ? returnTypeTextsOfFunction(context, owner) : [];\n}\n\nfunction returnTypeTextsOfFunction(\n context: ContextWithParserOptions,\n node: any,\n): readonly string[] {\n const explicitAnnotation = node.returnType?.typeAnnotation ?? node.returnType;\n if (explicitAnnotation) {\n const text = context.sourceCode.getText(explicitAnnotation);\n if (text) {\n return [text];\n }\n }\n\n const checker = checkerFor(context);\n const type = typeAtNode(context, node);\n if (!type) {\n return [];\n }\n\n const texts = new Set<string>();\n for (const signature of checker.getSignaturesOfType(type, 0)) {\n const returnType = checker.getReturnTypeOfSignature(signature);\n if (!returnType) {\n continue;\n }\n for (const text of [...(returnType.texts ?? []), checker.typeToString(returnType)]) {\n if (text) {\n texts.add(text);\n }\n }\n }\n\n const resolved = [...texts];\n return resolved.every(isPermissiveTypeText) ? [] : resolved;\n}\n\nfunction isPermissiveTypeText(text: string): boolean {\n return text === \"any\" || text === \"unknown\" || text === \"never\";\n}\n\nfunction stripChainExpression(node: any): any {\n let current = node;\n while (current?.type === \"ChainExpression\") {\n current = current.expression;\n }\n return current;\n}\n\nfunction identifierName(node: any): string | undefined {\n const current = stripChainExpression(node);\n return current?.type === \"Identifier\" && typeof current.name === \"string\"\n ? current.name\n : undefined;\n}\n\nfunction isNativeChildNode(value: unknown): value is RangedNode {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { type?: unknown }).type === \"string\" &&\n isRange((value as { range?: unknown }).range)\n );\n}\n\nfunction isRange(value: unknown): value is readonly [number, number] {\n return (\n Array.isArray(value) &&\n value.length === 2 &&\n typeof value[0] === \"number\" &&\n typeof value[1] === \"number\"\n );\n}\n\nfunction isJsonPrimitive(value: unknown): value is string | number | boolean | null {\n return value === null || [\"boolean\", \"number\", \"string\"].includes(typeof value);\n}\n\nfunction isJsonValue(value: unknown): boolean {\n if (isJsonPrimitive(value)) {\n return true;\n }\n if (Array.isArray(value)) {\n return value.every(isJsonValue);\n }\n return typeof value === \"object\" && value !== null && Object.values(value).every(isJsonValue);\n}\n\nfunction isPrimitiveRecord(\n value: unknown,\n): value is Record<string, string | number | boolean | null> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value) &&\n Object.values(value).every(isJsonPrimitive)\n );\n}\n\nfunction isSkippedField(key: string): boolean {\n return key === \"type\" || key === \"range\" || key === \"loc\" || key === \"parent\";\n}\n"],"mappings":";;;;AA4BA,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB,IAAI,IAAI,oBAAoB,CAAC,CAAC,KAAK,SAAS,CAAC,KAAK,MAAM,IAAI,CAAC,CAAC;AAE5F,SAAgB,qBACd,UACA,gBAAyC,CAAC,GAC1C,gBAAyC,CAAC,GAC1C;CACA,MAAM,OAAO,eAAe,QAAQ;CACpC,OAAO,iBACL,UACA;EACE,MAAM,EACJ,aAAa,KAAK,gBACpB;EACA,gBAAgB,KAAK;EACrB,UAAU,KAAK;EACf,GAAG;CACL,IACC,YACC,OAAO,YACL,KAAK,UAAU,KAAK,aAAa,CAC/B,WACC,SAAqB;EACpB,IAAI,cAAc,YAAY,MAAM,OAAO,MAAM,OAC/C;EAEF,MAAM,mBAAmB,uBAAuB,eAAe,IAAI;EACnE,MAAM,cAAc,kBAAkB,eAAe,IAAI;EACzD,wBACE,SACA,MACA,kBACE,UACA,aACE,SACA,MACA,kBACA,eAAe,eAAe,IAAI,GAClC,MACA,2BAA2B,eAAe,IAAI,GAC9C,WACF,CACF,CACF;CACF,CACF,CAAC,CACH,CACJ;AACF;AAEA,SAAgB,aACd,SACA,MACA,mBAAuC,MACvC,WAAW,uBACX,qBAAqB,MACrB,uBAA2C,kBAC3C,cAAkC,OAClC,QAAQ,GACQ;CAChB,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AEA,SAAS,eAAe,KAAsB;CAC5C,OAAO,QAAQ,UAAU,QAAQ,WAAW,QAAQ,SAAS,QAAQ;AACvE"}
|
|
1
|
+
{"version":3,"file":"native_bridge.js","names":[],"sources":["../../ts/rules/native_bridge.ts"],"sourcesContent":["import { nativeLintRuleMetas, runNativeLintRule } from \"@corsa-bind/napi\";\nimport type {\n NativeLintDiagnostic,\n NativeLintNode,\n NativeLintRange,\n NativeLintRuleMeta,\n NativeNodeMetadataDepth,\n} from \"@corsa-bind/napi\";\n\nimport { createNativeRule } from \"./rule_creator\";\nimport { checkerFor, propertyNamesOfNode, typeAtNode, typeTextsAtNode } from \"./type_utils\";\nimport type { ContextWithParserOptions, CorsaCallSignatureFacts } from \"../types\";\n\ntype RangedNode = {\n readonly type: string;\n readonly range: readonly [number, number];\n};\n\ntype NativeRuleBridgeOptions = {\n readonly shouldRun?: (node: RangedNode, context: ContextWithParserOptions) => boolean;\n readonly includeTypeTexts?: NodeMetadataOption;\n readonly includePropertyNames?: NodeMetadataOption;\n readonly includeText?: NodeMetadataOption;\n readonly maxDepth?: number;\n};\n\ntype NodeMetadataOption = boolean | ((node: RangedNode, depth: number) => boolean);\n\nconst MAX_NATIVE_NODE_DEPTH = 4;\nconst nativeRuleMetasByName = new Map(nativeLintRuleMetas().map((meta) => [meta.name, meta]));\n\nexport function createRustNativeRule(\n ruleName: string,\n metaOverrides: Record<string, unknown> = {},\n bridgeOptions: NativeRuleBridgeOptions = {},\n) {\n const meta = nativeRuleMeta(ruleName);\n return createNativeRule(\n ruleName,\n {\n docs: {\n description: meta.docsDescription,\n },\n hasSuggestions: meta.hasSuggestions,\n messages: meta.messages,\n ...metaOverrides,\n },\n (context) =>\n Object.fromEntries(\n meta.listeners.map((listener) => [\n listener,\n (node: RangedNode) => {\n if (bridgeOptions.shouldRun?.(node, context) === false) {\n return;\n }\n const includeTypeTexts = includeTypeTextsOption(bridgeOptions, meta);\n const includeText = includeTextOption(bridgeOptions, meta);\n reportNativeDiagnostics(\n context,\n node,\n runNativeLintRule(\n ruleName,\n toNativeNode(\n context,\n node,\n includeTypeTexts,\n maxDepthOption(bridgeOptions, meta),\n true,\n includePropertyNamesOption(bridgeOptions, meta),\n includeText,\n ),\n ),\n );\n },\n ]),\n ),\n );\n}\n\nexport function toNativeNode(\n context: ContextWithParserOptions,\n node: RangedNode,\n includeTypeTexts: NodeMetadataOption = true,\n maxDepth = MAX_NATIVE_NODE_DEPTH,\n includeRuleOptions = true,\n includePropertyNames: NodeMetadataOption = includeTypeTexts,\n includeText: NodeMetadataOption = false,\n depth = 0,\n): NativeLintNode {\n const fields: Record<string, unknown> = {};\n const children: Record<string, NativeLintNode> = {};\n const childLists: Record<string, NativeLintNode[]> = {};\n\n for (const [key, value] of Object.entries(node)) {\n if (isSkippedField(key)) {\n continue;\n }\n if (isNativeChildNode(value)) {\n if (maxDepth > 0) {\n children[key] = toNativeNode(\n context,\n value,\n includeTypeTexts,\n maxDepth - 1,\n false,\n includePropertyNames,\n includeText,\n depth + 1,\n );\n }\n continue;\n }\n if (Array.isArray(value)) {\n if (maxDepth > 0 && value.every(isNativeChildNode)) {\n childLists[key] = value.map((child) =>\n toNativeNode(\n context,\n child,\n includeTypeTexts,\n maxDepth - 1,\n false,\n includePropertyNames,\n includeText,\n depth + 1,\n ),\n );\n } else if (value.every(isJsonPrimitive)) {\n fields[key] = value;\n }\n continue;\n }\n if (isPrimitiveRecord(value)) {\n fields[key] = value;\n continue;\n }\n if (isJsonPrimitive(value)) {\n fields[key] = value;\n }\n }\n\n const typeAnnotationText = sourceTypeAnnotationText(context, node);\n if (typeAnnotationText) {\n fields.__typeAnnotationText = typeAnnotationText;\n }\n\n const options = (context as { options?: unknown }).options;\n if (includeRuleOptions && Array.isArray(options) && options.length > 0 && isJsonValue(options)) {\n fields.__ruleOptions = options;\n }\n if (includeRuleOptions) {\n addHostInputs(context, node, fields);\n }\n\n const nativeNode: NativeLintNode = {\n kind: node.type,\n range: nativeRange(node.range),\n };\n if (includeMetadataForNode(includeText, node, depth)) {\n nativeNode.text = context.sourceCode.getText(node as never);\n }\n if (includeMetadataForNode(includeTypeTexts, node, depth)) {\n nativeNode.typeTexts = typeTextsAtNode(context, node);\n }\n if (includeMetadataForNode(includePropertyNames, node, depth)) {\n nativeNode.propertyNames = propertyNamesOfNode(context, node);\n }\n if (Object.keys(fields).length > 0) {\n nativeNode.fields = fields;\n }\n if (Object.keys(children).length > 0) {\n nativeNode.children = children;\n }\n if (Object.keys(childLists).length > 0) {\n nativeNode.childLists = childLists;\n }\n return nativeNode;\n}\n\nexport function reportNativeDiagnostics(\n context: ContextWithParserOptions,\n node: RangedNode,\n diagnostics: readonly NativeLintDiagnostic[],\n): void {\n for (const diagnostic of diagnostics) {\n context.report({\n node: reportNodeForRange(node, diagnostic.range),\n messageId: diagnostic.messageId,\n ...(diagnostic.suggestions?.length\n ? {\n suggest: diagnostic.suggestions.map((suggestion) => ({\n messageId: suggestion.messageId,\n fix: (fixer: any) =>\n suggestion.fixes.map((fix) =>\n fixer.replaceTextRange(oxlintRange(fix.range), fix.replacementText),\n ),\n })),\n }\n : {}),\n } as never);\n }\n}\n\nfunction reportNodeForRange(root: RangedNode, range: NativeLintRange): RangedNode {\n return findNodeByRange(root, range) ?? root;\n}\n\nfunction findNodeByRange(\n value: unknown,\n range: NativeLintRange,\n seen = new Set<object>(),\n): RangedNode | undefined {\n if (typeof value !== \"object\" || value === null || seen.has(value)) {\n return undefined;\n }\n seen.add(value);\n\n if (isNativeChildNode(value) && sameRange(value.range, range)) {\n return value;\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n const match = findNodeByRange(item, range, seen);\n if (match) {\n return match;\n }\n }\n return undefined;\n }\n\n for (const [key, child] of Object.entries(value)) {\n if (isSkippedField(key)) {\n continue;\n }\n const match = findNodeByRange(child, range, seen);\n if (match) {\n return match;\n }\n }\n return undefined;\n}\n\nfunction nativeRuleMeta(ruleName: string): NativeLintRuleMeta {\n const meta = nativeRuleMetasByName.get(ruleName);\n if (!meta) {\n throw new Error(`corsa oxlint native Rust rule is not registered: ${ruleName}`);\n }\n return meta;\n}\n\nfunction includeTypeTextsOption(\n options: NativeRuleBridgeOptions,\n meta: NativeLintRuleMeta,\n): NodeMetadataOption {\n return options.includeTypeTexts ?? nodeMetadataDepthOption(meta.bridge.typeTexts, false);\n}\n\nfunction includePropertyNamesOption(\n options: NativeRuleBridgeOptions,\n meta: NativeLintRuleMeta,\n): NodeMetadataOption {\n return options.includePropertyNames ?? nodeMetadataDepthOption(meta.bridge.propertyNames, false);\n}\n\nfunction includeTextOption(\n options: NativeRuleBridgeOptions,\n meta: NativeLintRuleMeta,\n): NodeMetadataOption {\n return options.includeText ?? nodeMetadataDepthOption(meta.bridge.text, false);\n}\n\nfunction maxDepthOption(options: NativeRuleBridgeOptions, meta: NativeLintRuleMeta): number {\n return options.maxDepth ?? meta.bridge.maxDepth ?? MAX_NATIVE_NODE_DEPTH;\n}\n\nfunction nodeMetadataDepthOption(\n metadata: NativeNodeMetadataDepth | undefined,\n fallback: NodeMetadataOption,\n): NodeMetadataOption {\n if (!metadata) {\n return fallback;\n }\n return (_node, depth) => depth >= metadata.minDepth && depth <= metadata.maxDepth;\n}\n\nfunction includeMetadataForNode(\n option: NodeMetadataOption,\n node: RangedNode,\n depth: number,\n): boolean {\n return typeof option === \"function\" ? option(node, depth) : option;\n}\n\nfunction sourceTypeAnnotationText(\n context: ContextWithParserOptions,\n node: RangedNode,\n): string | undefined {\n const annotation = (node as any).typeAnnotation?.typeAnnotation ?? (node as any).typeAnnotation;\n if (!annotation) {\n return undefined;\n }\n const text = (context as any).sourceCode?.getText(annotation);\n return typeof text === \"string\" && text.length > 0 ? text : undefined;\n}\n\nfunction nativeRange(range: readonly [number, number]): NativeLintRange {\n return { start: range[0], end: range[1] };\n}\n\nfunction oxlintRange(range: NativeLintRange): [number, number] {\n return [range.start, range.end];\n}\n\nfunction sameRange(range: readonly [number, number], expected: NativeLintRange): boolean {\n return range[0] === expected.start && range[1] === expected.end;\n}\n\nfunction addHostInputs(\n context: ContextWithParserOptions,\n node: RangedNode,\n fields: Record<string, unknown>,\n): void {\n const current = node as any;\n const ancestors = ancestorFacts(context, current);\n if (ancestors.length > 0) {\n fields.__ancestorFacts = ancestors;\n }\n if (current.type === \"CallExpression\" || current.type === \"NewExpression\") {\n const callFacts = callFactsOfNode(context, current);\n if (Object.keys(callFacts).length > 0) {\n fields.__callFacts = callFacts;\n }\n }\n if (current.parent?.type) {\n fields.__parentKind = current.parent.type;\n }\n const symbolFacts = symbolFactsOfNode(context, current);\n if (Object.keys(symbolFacts).length > 0) {\n fields.__symbolFacts = symbolFacts;\n }\n const typeParameterFacts = typeParameterFactsOfNode(context, current);\n if (Object.keys(typeParameterFacts).length > 0) {\n fields.__typeParameterFacts = typeParameterFacts;\n }\n const returnTypeFacts = returnTypeFactsOfNode(context, current);\n if (Object.keys(returnTypeFacts).length > 0) {\n fields.__returnTypeFacts = returnTypeFacts;\n }\n}\n\nfunction callFactsOfNode(context: ContextWithParserOptions, node: any): Record<string, unknown> {\n const facts: Record<string, unknown> = {};\n const calleeName = identifierName(stripChainExpression(node.callee));\n if (calleeName) {\n facts.calleeName = calleeName;\n }\n const signatureFacts = callSignatureFactsOfNode(context, node);\n if (signatureFacts.expectedArgumentTypeTexts?.length) {\n facts.expectedArgumentTypeTexts = signatureFacts.expectedArgumentTypeTexts;\n }\n if (signatureFacts.explicitTypeArgumentsRequired !== undefined) {\n facts.explicitTypeArgumentsRequired = signatureFacts.explicitTypeArgumentsRequired;\n }\n const typeArgumentFacts = typeArgumentFactsOfCall(node, signatureFacts);\n for (const [key, value] of Object.entries(typeArgumentFacts)) {\n facts[key] = value;\n }\n return facts;\n}\n\nfunction symbolFactsOfNode(context: ContextWithParserOptions, node: any): Record<string, unknown> {\n if (node.type !== \"Identifier\" && node.type !== \"MemberExpression\") {\n return {};\n }\n const target = node.type === \"MemberExpression\" ? node.property : node;\n if (target?.type !== \"Identifier\") {\n return {};\n }\n const symbol = checkerFor(context).getSymbolAtLocation(target);\n const declarations = symbol?.declarations?.filter(\n (declaration): declaration is string => typeof declaration === \"string\",\n );\n if (!declarations || declarations.length === 0) {\n return {};\n }\n return {\n declarations,\n filename: context.filename,\n cwd: context.cwd,\n sourceText: context.sourceCode.text,\n };\n}\n\nfunction typeParameterFactsOfNode(\n context: ContextWithParserOptions,\n node: any,\n): Record<string, unknown> {\n if (node.type !== \"TSTypeParameterDeclaration\") {\n return {};\n }\n const params = Array.isArray(node.params) ? node.params : [];\n if (params.length !== 1) {\n return {};\n }\n const name = typeParameterName(params[0]);\n if (!name) {\n return {};\n }\n return {\n name,\n ownerText: node.parent\n ? context.sourceCode.getText(node.parent)\n : context.sourceCode.getText(node),\n };\n}\n\nfunction returnTypeFactsOfNode(\n context: ContextWithParserOptions,\n node: any,\n): Record<string, unknown> {\n const returnTypeTexts =\n node.type === \"ReturnStatement\"\n ? returnTypeTextsOfNearestFunction(context, node)\n : isFunctionLike(node) || node.type === \"ArrowFunctionExpression\"\n ? returnTypeTextsOfFunction(context, node)\n : [];\n return returnTypeTexts.length > 0 ? { texts: returnTypeTexts } : {};\n}\n\nfunction ancestorFacts(\n context: ContextWithParserOptions,\n node: any,\n): readonly Record<string, unknown>[] {\n const ancestors = (context.sourceCode as any)?.getAncestors?.(node) ?? [];\n return ancestors\n .filter((ancestor: any) => typeof ancestor?.type === \"string\")\n .map((ancestor: any) => {\n const fact: Record<string, unknown> = { kind: ancestor.type };\n if (isRange(ancestor.range)) {\n fact.start = ancestor.range[0];\n fact.end = ancestor.range[1];\n }\n if (typeof ancestor.async === \"boolean\") {\n fact.async = ancestor.async;\n }\n const className = ancestor.id?.name;\n if (\n (ancestor.type === \"ClassDeclaration\" || ancestor.type === \"ClassExpression\") &&\n typeof className === \"string\" &&\n className.length > 0\n ) {\n fact.className = className;\n }\n if (isFunctionLike(ancestor)) {\n const paramNames = Array.isArray(ancestor.params)\n ? ancestor.params\n .map(identifierName)\n .filter((name: string | undefined): name is string => name !== undefined)\n : [];\n if (paramNames.length > 0) {\n fact.paramNames = paramNames;\n }\n if (ancestor.parent?.type) {\n fact.parentKind = ancestor.parent.type;\n }\n const parentCalleeName = identifierName(stripChainExpression(ancestor.parent?.callee));\n if (parentCalleeName) {\n fact.parentCalleeName = parentCalleeName;\n }\n if (ancestor.parent?.parent?.type) {\n fact.parentParentKind = ancestor.parent.parent.type;\n }\n const parentParentCalleeName = identifierName(\n stripChainExpression(ancestor.parent?.parent?.callee),\n );\n if (parentParentCalleeName) {\n fact.parentParentCalleeName = parentParentCalleeName;\n }\n }\n return fact;\n });\n}\n\nfunction callSignatureFactsOfNode(\n context: ContextWithParserOptions,\n node: any,\n): CorsaCallSignatureFacts {\n const callee = stripChainExpression(node.callee);\n if (!callee) {\n return {};\n }\n const calleeType = typeAtNode(context, callee);\n if (!calleeType) {\n return {};\n }\n const args = Array.isArray(node.arguments) ? node.arguments : [];\n const explicitTypeArguments = typeArgumentNodes(node)\n .map((typeArgument) => context.sourceCode.getText(typeArgument))\n .filter((text: string): text is string => text.length > 0);\n return checkerFor(context).getCallSignatureFacts(\n calleeType,\n node.type === \"NewExpression\" ? 1 : 0,\n args.map((arg: unknown) => typeTextsAtNode(context, arg as never)),\n explicitTypeArguments,\n );\n}\n\nfunction typeArgumentNodes(node: any): readonly any[] {\n const candidates = [\n node.typeArguments?.params,\n node.typeParameters?.params,\n node.typeParameterInstantiation?.params,\n ];\n return candidates.find(Array.isArray) ?? [];\n}\n\nfunction typeArgumentFactsOfCall(\n node: any,\n signatureFacts: CorsaCallSignatureFacts,\n): Record<string, unknown> {\n const typeArguments = typeArgumentNodes(node);\n if (typeArguments.length === 0) {\n return {};\n }\n const facts: Record<string, unknown> = {\n typeArgumentRanges: typeArguments\n .map((typeArgument) => rangeObject(typeArgument.range))\n .filter((range): range is { start: number; end: number } => range !== undefined),\n };\n const listRange = typeArgumentListRange(node, typeArguments);\n if (listRange) {\n facts.typeArgumentListRange = listRange;\n }\n const parameterCount =\n signatureFacts.signature?.typeParameters?.length ??\n signatureFacts.signature?.typeParameterDefaultTexts?.length ??\n 0;\n if (parameterCount > 0) {\n facts.typeParameterCount = parameterCount;\n }\n const defaultTexts = signatureFacts.signature?.typeParameterDefaultTexts ?? [];\n const lastIndex = typeArguments.length - 1;\n const lastDefaultText = defaultTexts[lastIndex];\n if (lastDefaultText !== undefined) {\n const hasDefault = lastDefaultText.trim().length > 0;\n facts.lastTypeParameterHasDefault = hasDefault;\n if (hasDefault && signatureFacts.explicitTypeArgumentsRequired === false) {\n facts.lastTypeArgumentEqualsDefault = true;\n facts.lastTypeArgumentSameTypeFlagsAsDefault = true;\n facts.lastTypeArgumentIdenticalToDefault = true;\n }\n }\n return facts;\n}\n\nfunction typeArgumentListRange(\n node: any,\n typeArguments: readonly any[],\n): { start: number; end: number } | undefined {\n const candidates = [node.typeArguments, node.typeParameters, node.typeParameterInstantiation];\n const list = candidates.find((candidate) => Array.isArray(candidate?.params));\n const fromList = rangeObject(list?.range);\n if (fromList) {\n return fromList;\n }\n const first = rangeObject(typeArguments[0]?.range);\n const last = rangeObject(typeArguments[typeArguments.length - 1]?.range);\n if (!first || !last || first.start <= 0) {\n return undefined;\n }\n return { start: first.start - 1, end: last.end + 1 };\n}\n\nfunction rangeObject(range: unknown): { start: number; end: number } | undefined {\n return isRange(range) ? { start: range[0], end: range[1] } : undefined;\n}\n\nfunction typeParameterName(node: any): string | undefined {\n if (typeof node?.name === \"string\") {\n return node.name;\n }\n if (typeof node?.name?.name === \"string\") {\n return node.name.name;\n }\n return undefined;\n}\n\nfunction nearestFunctionAncestor(context: ContextWithParserOptions, node: any): any {\n const ancestors = (context.sourceCode as any)?.getAncestors?.(node) ?? [];\n return [...ancestors].reverse().find((ancestor: any) => ancestor.type?.includes(\"Function\"));\n}\n\nfunction isFunctionLike(node: any): boolean {\n return typeof node?.type === \"string\" && node.type.includes(\"Function\");\n}\n\nfunction returnTypeTextsOfNearestFunction(\n context: ContextWithParserOptions,\n node: any,\n): readonly string[] {\n const owner = nearestFunctionAncestor(context, node);\n return owner ? returnTypeTextsOfFunction(context, owner) : [];\n}\n\nfunction returnTypeTextsOfFunction(\n context: ContextWithParserOptions,\n node: any,\n): readonly string[] {\n const explicitAnnotation = node.returnType?.typeAnnotation ?? node.returnType;\n if (explicitAnnotation) {\n const text = context.sourceCode.getText(explicitAnnotation);\n if (text) {\n return [text];\n }\n }\n\n const checker = checkerFor(context);\n const type = typeAtNode(context, node);\n if (!type) {\n return [];\n }\n\n const texts = new Set<string>();\n for (const signature of checker.getSignaturesOfType(type, 0)) {\n const returnType = checker.getReturnTypeOfSignature(signature);\n if (!returnType) {\n continue;\n }\n for (const text of [...(returnType.texts ?? []), checker.typeToString(returnType)]) {\n if (text) {\n texts.add(text);\n }\n }\n }\n\n const resolved = [...texts];\n return resolved.every(isPermissiveTypeText) ? [] : resolved;\n}\n\nfunction isPermissiveTypeText(text: string): boolean {\n return text === \"any\" || text === \"unknown\" || text === \"never\";\n}\n\nfunction stripChainExpression(node: any): any {\n let current = node;\n while (current?.type === \"ChainExpression\") {\n current = current.expression;\n }\n return current;\n}\n\nfunction identifierName(node: any): string | undefined {\n const current = stripChainExpression(node);\n return current?.type === \"Identifier\" && typeof current.name === \"string\"\n ? current.name\n : undefined;\n}\n\nfunction isNativeChildNode(value: unknown): value is RangedNode {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { type?: unknown }).type === \"string\" &&\n isRange((value as { range?: unknown }).range)\n );\n}\n\nfunction isRange(value: unknown): value is readonly [number, number] {\n return (\n Array.isArray(value) &&\n value.length === 2 &&\n typeof value[0] === \"number\" &&\n typeof value[1] === \"number\"\n );\n}\n\nfunction isJsonPrimitive(value: unknown): value is string | number | boolean | null {\n return value === null || [\"boolean\", \"number\", \"string\"].includes(typeof value);\n}\n\nfunction isJsonValue(value: unknown): boolean {\n if (isJsonPrimitive(value)) {\n return true;\n }\n if (Array.isArray(value)) {\n return value.every(isJsonValue);\n }\n return typeof value === \"object\" && value !== null && Object.values(value).every(isJsonValue);\n}\n\nfunction isPrimitiveRecord(\n value: unknown,\n): value is Record<string, string | number | boolean | null> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value) &&\n Object.values(value).every(isJsonPrimitive)\n );\n}\n\nfunction isSkippedField(key: string): boolean {\n return key === \"type\" || key === \"range\" || key === \"loc\" || key === \"parent\";\n}\n"],"mappings":";;;;AA4BA,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB,IAAI,IAAI,oBAAoB,CAAC,CAAC,KAAK,SAAS,CAAC,KAAK,MAAM,IAAI,CAAC,CAAC;AAE5F,SAAgB,qBACd,UACA,gBAAyC,CAAC,GAC1C,gBAAyC,CAAC,GAC1C;CACA,MAAM,OAAO,eAAe,QAAQ;CACpC,OAAO,iBACL,UACA;EACE,MAAM,EACJ,aAAa,KAAK,gBACpB;EACA,gBAAgB,KAAK;EACrB,UAAU,KAAK;EACf,GAAG;CACL,IACC,YACC,OAAO,YACL,KAAK,UAAU,KAAK,aAAa,CAC/B,WACC,SAAqB;EACpB,IAAI,cAAc,YAAY,MAAM,OAAO,MAAM,OAC/C;EAEF,MAAM,mBAAmB,uBAAuB,eAAe,IAAI;EACnE,MAAM,cAAc,kBAAkB,eAAe,IAAI;EACzD,wBACE,SACA,MACA,kBACE,UACA,aACE,SACA,MACA,kBACA,eAAe,eAAe,IAAI,GAClC,MACA,2BAA2B,eAAe,IAAI,GAC9C,WACF,CACF,CACF;CACF,CACF,CAAC,CACH,CACJ;AACF;AAEA,SAAgB,aACd,SACA,MACA,mBAAuC,MACvC,WAAW,uBACX,qBAAqB,MACrB,uBAA2C,kBAC3C,cAAkC,OAClC,QAAQ,GACQ;CAChB,MAAM,SAAkC,CAAC;CACzC,MAAM,WAA2C,CAAC;CAClD,MAAM,aAA+C,CAAC;CAEtD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,IAAI,GAAG;EAC/C,IAAI,eAAe,GAAG,GACpB;EAEF,IAAI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