resultar-check 1.0.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/LICENSE +21 -0
- package/README.md +169 -0
- package/dist/cli.cjs +32 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +33 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +95 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +80 -0
- package/dist/index.js +95 -0
- package/dist/index.js.map +1 -0
- package/dist/lint-D-D2dmLi.cjs +1030 -0
- package/dist/lint-D-D2dmLi.cjs.map +1 -0
- package/dist/lint-FMWf8UEv.js +1001 -0
- package/dist/lint-FMWf8UEv.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-FMWf8UEv.js","names":["getUnionOrIntersectionTypes","getTokenPosOfNode","getNodeStart","getIdentifierText","getNodeWidth","getTypeName","createFinding","isRecord"],"sources":["../src/result-usage-core.ts","../src/rules-core.ts","../src/plugin-options.ts","../src/lint.ts"],"sourcesContent":["import type * as ts from \"typescript\";\n\nimport type { ResultarLintFinding } from \"./finding.js\";\n\ntype TypeScriptApi = typeof ts;\n\nexport type NoDiscardMode = \"direct\" | \"must-use\";\n\nexport interface NoDiscardRuleOptions {\n readonly mode?: NoDiscardMode;\n}\n\nexport type NoDiscardFinding = ResultarLintFinding & {\n readonly rule: \"no-discard\";\n readonly type: string;\n};\n\ninterface RuleContext {\n readonly checker: ts.TypeChecker;\n readonly sourceFile: ts.SourceFile;\n readonly tsApi: TypeScriptApi;\n}\n\ninterface TrackedResult {\n readonly declaration: ts.VariableDeclaration;\n readonly identifier: ts.Identifier;\n readonly name: string;\n readonly symbol: ts.Symbol;\n readonly typeName: string;\n hasDiscardedResultUse: boolean;\n handled: boolean;\n}\n\ninterface IdentifierText {\n readonly escapedText?: unknown;\n readonly text?: string;\n}\n\nconst resultTypeNames = new Set([\n \"DisposableResult\",\n \"DisposableResultAsync\",\n \"ErrResult\",\n \"OkResult\",\n \"Result\",\n \"ResultAsync\",\n \"StrictResult\",\n \"StrictResultAsync\",\n]);\n\nconst consumerMethods = new Set([\n \"_unsafeUnwrap\",\n \"_unsafeUnwrapErr\",\n \"isErr\",\n \"isOk\",\n \"match\",\n \"matchTags\",\n \"matchTagsPartial\",\n \"unwrapOr\",\n \"unwrapOrThrow\",\n]);\n\nconst consumerProperties = new Set([\"error\", \"value\"]);\n\nconst getUnionOrIntersectionTypes = (\n tsApi: TypeScriptApi,\n type: ts.Type,\n): readonly ts.Type[] | undefined =>\n (type.flags & (tsApi.TypeFlags.Union | tsApi.TypeFlags.Intersection)) === 0\n ? undefined\n : ((type as ts.UnionOrIntersectionType).types ?? []);\n\nconst getSymbolName = (symbol: ts.Symbol | undefined): string | undefined => {\n if (symbol === undefined) {\n return undefined;\n }\n\n if (typeof symbol.getName === \"function\") {\n return symbol.getName();\n }\n\n const { escapedName } = symbol;\n\n return typeof escapedName === \"string\" ? escapedName : undefined;\n};\n\nconst getTypeSymbolName = (type: ts.Type): string | undefined => {\n if (typeof type.getSymbol === \"function\") {\n return getSymbolName(type.getSymbol());\n }\n\n return getSymbolName(type.symbol);\n};\n\nconst getTokenPosOfNode = (\n tsApi: TypeScriptApi,\n node: ts.Node,\n sourceFile: ts.SourceFile,\n): number => {\n const getTokenPos = (\n tsApi as unknown as {\n readonly getTokenPosOfNode?: (node: ts.Node, sourceFile?: ts.SourceFile) => number;\n }\n ).getTokenPosOfNode;\n\n return getTokenPos === undefined ? node.pos : getTokenPos(node, sourceFile);\n};\n\nconst getNodeStart = (tsApi: TypeScriptApi, node: ts.Node, sourceFile: ts.SourceFile): number =>\n typeof node.getStart === \"function\"\n ? node.getStart(sourceFile)\n : getTokenPosOfNode(tsApi, node, sourceFile);\n\nconst getIdentifierText = (identifier: IdentifierText): string => {\n if (typeof identifier.text === \"string\") {\n return identifier.text;\n }\n\n return identifier.escapedText === undefined ? \"\" : String(identifier.escapedText);\n};\n\nconst getNodeWidth = (tsApi: TypeScriptApi, node: ts.Node, sourceFile: ts.SourceFile): number => {\n if (typeof node.getWidth === \"function\") {\n return node.getWidth(sourceFile);\n }\n\n const start = getNodeStart(tsApi, node, sourceFile);\n\n return node.end - start;\n};\n\nconst getEntityNameText = (tsApi: TypeScriptApi, name: ts.EntityName): string =>\n tsApi.isIdentifier(name)\n ? getIdentifierText(name)\n : `${getEntityNameText(tsApi, name.left)}.${getIdentifierText(name.right)}`;\n\nexport const normalizeNoDiscardMode = (mode: unknown): NoDiscardMode =>\n mode === \"direct\" ? \"direct\" : \"must-use\";\n\nexport const isResultLikeType = (\n tsApi: TypeScriptApi,\n checker: ts.TypeChecker,\n node: ts.Node,\n type: ts.Type,\n): boolean => {\n const unionOrIntersectionTypes = getUnionOrIntersectionTypes(tsApi, type);\n\n if (unionOrIntersectionTypes !== undefined) {\n return unionOrIntersectionTypes.some((innerType) =>\n isResultLikeType(tsApi, checker, node, innerType),\n );\n }\n\n const aliasName = getSymbolName(type.aliasSymbol);\n const symbolName = getTypeSymbolName(type);\n\n if (\n (aliasName !== undefined && resultTypeNames.has(aliasName)) ||\n (symbolName !== undefined && resultTypeNames.has(symbolName))\n ) {\n return true;\n }\n\n if (tsApi.isTypeReferenceNode(node)) {\n const typeName = getEntityNameText(tsApi, node.typeName);\n const unqualifiedName = typeName.includes(\".\") ? typeName.split(\".\").at(-1) : typeName;\n\n return unqualifiedName !== undefined && resultTypeNames.has(unqualifiedName);\n }\n\n void checker;\n return false;\n};\n\nexport const unwrapExpression = (\n tsApi: TypeScriptApi,\n expression: ts.Expression,\n): ts.Expression => {\n let current = expression;\n\n for (;;) {\n if (tsApi.isParenthesizedExpression(current)) {\n current = current.expression;\n } else if (tsApi.isAsExpression(current)) {\n current = current.expression;\n } else if (tsApi.isTypeAssertionExpression(current)) {\n current = current.expression;\n } else if (tsApi.isNonNullExpression(current)) {\n current = current.expression;\n } else if (tsApi.isSatisfiesExpression(current)) {\n current = current.expression;\n } else {\n return current;\n }\n }\n};\n\nexport const isExplicitDiscard = (tsApi: TypeScriptApi, expression: ts.Expression): boolean =>\n tsApi.isVoidExpression(unwrapExpression(tsApi, expression));\n\nexport const isCallLikeDiscard = (tsApi: TypeScriptApi, expression: ts.Expression): boolean => {\n const unwrapped = unwrapExpression(tsApi, expression);\n\n if (tsApi.isAwaitExpression(unwrapped)) {\n return isCallLikeDiscard(tsApi, unwrapped.expression);\n }\n\n if (tsApi.isCallExpression(unwrapped)) {\n return true;\n }\n\n if (tsApi.isConditionalExpression(unwrapped)) {\n return (\n isCallLikeDiscard(tsApi, unwrapped.whenTrue) || isCallLikeDiscard(tsApi, unwrapped.whenFalse)\n );\n }\n\n if (tsApi.isBinaryExpression(unwrapped)) {\n const { kind } = unwrapped.operatorToken;\n\n return (\n (kind === tsApi.SyntaxKind.AmpersandAmpersandToken ||\n kind === tsApi.SyntaxKind.BarBarToken ||\n kind === tsApi.SyntaxKind.QuestionQuestionToken) &&\n isCallLikeDiscard(tsApi, unwrapped.right)\n );\n }\n\n return false;\n};\n\nconst getTypeName = (context: RuleContext, node: ts.Node, type: ts.Type): string =>\n context.checker.typeToString(type, node, context.tsApi.TypeFormatFlags.NoTruncation);\n\nconst createFinding = (\n context: RuleContext,\n node: ts.Expression,\n typeName: string,\n message: string,\n): NoDiscardFinding => {\n const start = getNodeStart(context.tsApi, node, context.sourceFile);\n const position = context.tsApi.getLineAndCharacterOfPosition(context.sourceFile, start);\n\n return {\n column: position.character + 1,\n file: context.sourceFile.fileName,\n length: getNodeWidth(context.tsApi, node, context.sourceFile),\n line: position.line + 1,\n message,\n rule: \"no-discard\",\n severity: \"error\",\n start,\n type: typeName,\n };\n};\n\nconst createIgnoredFinding = (\n context: RuleContext,\n node: ts.Expression,\n typeName: string,\n): NoDiscardFinding =>\n createFinding(\n context,\n node,\n typeName,\n `Ignored ${typeName} value. Handle it or explicitly discard it with \\`void\\`.`,\n );\n\nconst createUnhandledFinding = (context: RuleContext, tracked: TrackedResult): NoDiscardFinding =>\n createFinding(\n context,\n tracked.identifier,\n tracked.typeName,\n `Unhandled ${tracked.typeName} value assigned to \\`${tracked.name}\\`. Handle it, return it, or explicitly discard it with \\`void\\`.`,\n );\n\nconst symbolsEqual = (left: ts.Symbol, right: ts.Symbol): boolean =>\n left === right || left.valueDeclaration === right.valueDeclaration;\n\nconst isWrapperParent = (tsApi: TypeScriptApi, parent: ts.Node, child: ts.Node): boolean =>\n (tsApi.isParenthesizedExpression(parent) && parent.expression === child) ||\n (tsApi.isAsExpression(parent) && parent.expression === child) ||\n (tsApi.isTypeAssertionExpression(parent) && parent.expression === child) ||\n (tsApi.isNonNullExpression(parent) && parent.expression === child) ||\n (tsApi.isSatisfiesExpression(parent) && parent.expression === child);\n\nconst isReturnValueContainerParent = (\n tsApi: TypeScriptApi,\n parent: ts.Node,\n child: ts.Node,\n): boolean =>\n isWrapperParent(tsApi, parent, child) ||\n (tsApi.isShorthandPropertyAssignment(parent) && parent.name === child) ||\n (tsApi.isPropertyAssignment(parent) && parent.initializer === child) ||\n (tsApi.isSpreadAssignment(parent) && parent.expression === child) ||\n (tsApi.isSpreadElement(parent) && parent.expression === child) ||\n (tsApi.isObjectLiteralExpression(parent) &&\n parent.properties.some((property) => property === child)) ||\n (tsApi.isArrayLiteralExpression(parent) &&\n parent.elements.some((element) => element === child)) ||\n (tsApi.isConditionalExpression(parent) &&\n (parent.whenTrue === child || parent.whenFalse === child));\n\nconst getReferenceChainRoot = (\n tsApi: TypeScriptApi,\n identifier: ts.Identifier,\n ancestors: readonly ts.Node[],\n): { readonly parent: ts.Node | undefined; readonly root: ts.Node } => {\n let current: ts.Node = identifier;\n let parentIndex = ancestors.length - 1;\n\n for (;;) {\n const parent = ancestors[parentIndex];\n\n if (parent === undefined) {\n return { parent: undefined, root: current };\n }\n\n if (isWrapperParent(tsApi, parent, current)) {\n current = parent;\n } else if (tsApi.isAwaitExpression(parent) && parent.expression === current) {\n current = parent;\n } else if (tsApi.isPropertyAccessExpression(parent) && parent.expression === current) {\n current = parent;\n } else if (tsApi.isCallExpression(parent) && parent.expression === current) {\n current = parent;\n } else {\n return { parent, root: current };\n }\n\n parentIndex -= 1;\n }\n};\n\nconst isReturnedReference = (\n tsApi: TypeScriptApi,\n identifier: ts.Identifier,\n ancestors: readonly ts.Node[],\n): boolean => {\n const { parent, root } = getReferenceChainRoot(tsApi, identifier, ancestors);\n\n if (\n (parent !== undefined && tsApi.isReturnStatement(parent) && parent.expression === root) ||\n (parent !== undefined && tsApi.isArrowFunction(parent) && parent.body === root)\n ) {\n return true;\n }\n\n let current: ts.Node = identifier;\n\n for (let parentIndex = ancestors.length - 1; parentIndex >= 0; parentIndex -= 1) {\n const containerParent = ancestors[parentIndex];\n\n if (containerParent === undefined) {\n return false;\n }\n\n if (isReturnValueContainerParent(tsApi, containerParent, current)) {\n current = containerParent;\n continue;\n }\n\n return (\n (tsApi.isReturnStatement(containerParent) && containerParent.expression === current) ||\n (tsApi.isArrowFunction(containerParent) && containerParent.body === current)\n );\n }\n\n return false;\n};\n\nconst isExplicitDiscardReference = (\n tsApi: TypeScriptApi,\n identifier: ts.Identifier,\n ancestors: readonly ts.Node[],\n): boolean => {\n const { parent, root } = getReferenceChainRoot(tsApi, identifier, ancestors);\n\n return parent !== undefined && tsApi.isVoidExpression(parent) && parent.expression === root;\n};\n\nconst isConsumedByReceiverChain = (\n tsApi: TypeScriptApi,\n identifier: ts.Identifier,\n ancestors: readonly ts.Node[],\n): boolean => {\n let current: ts.Node = identifier;\n let parentIndex = ancestors.length - 1;\n\n for (;;) {\n const parent = ancestors[parentIndex];\n\n if (parent === undefined) {\n return false;\n }\n\n if (isWrapperParent(tsApi, parent, current)) {\n current = parent;\n } else if (tsApi.isAwaitExpression(parent) && parent.expression === current) {\n current = parent;\n } else if (tsApi.isPropertyAccessExpression(parent) && parent.expression === current) {\n const methodOrPropertyName = getIdentifierText(parent.name);\n const nextParent = ancestors[parentIndex - 1];\n\n if (consumerProperties.has(methodOrPropertyName)) {\n return true;\n }\n\n if (\n consumerMethods.has(methodOrPropertyName) &&\n nextParent !== undefined &&\n tsApi.isCallExpression(nextParent) &&\n nextParent.expression === parent\n ) {\n return true;\n }\n\n current = parent;\n } else if (tsApi.isCallExpression(parent) && parent.expression === current) {\n current = parent;\n } else {\n return false;\n }\n\n parentIndex -= 1;\n }\n};\n\nconst isHandledReference = (\n tsApi: TypeScriptApi,\n identifier: ts.Identifier,\n ancestors: readonly ts.Node[],\n): boolean =>\n isReturnedReference(tsApi, identifier, ancestors) ||\n isExplicitDiscardReference(tsApi, identifier, ancestors) ||\n isConsumedByReceiverChain(tsApi, identifier, ancestors);\n\nconst isIdentifierInsideDiscardedResultExpression = (\n context: RuleContext,\n identifier: ts.Identifier,\n ancestors: readonly ts.Node[],\n): boolean => {\n let current: ts.Node = identifier;\n\n for (let index = ancestors.length - 1; index >= 0; index -= 1) {\n current = ancestors[index]!;\n\n if (context.tsApi.isExpressionStatement(current)) {\n if (\n isExplicitDiscard(context.tsApi, current.expression) ||\n !isCallLikeDiscard(context.tsApi, current.expression)\n ) {\n return false;\n }\n\n const type = context.checker.getTypeAtLocation(current.expression);\n\n return isResultLikeType(context.tsApi, context.checker, current.expression, type);\n }\n }\n\n return false;\n};\n\nconst getTrackedResult = (\n tsApi: TypeScriptApi,\n checker: ts.TypeChecker,\n trackedResults: readonly TrackedResult[],\n identifier: ts.Identifier,\n): TrackedResult | undefined => {\n const shorthandParent = identifier.parent;\n const symbol =\n shorthandParent !== undefined &&\n tsApi.isShorthandPropertyAssignment(shorthandParent) &&\n shorthandParent.name === identifier\n ? checker.getShorthandAssignmentValueSymbol(shorthandParent)\n : checker.getSymbolAtLocation(identifier);\n\n return symbol === undefined\n ? undefined\n : trackedResults.find((tracked) => symbolsEqual(tracked.symbol, symbol));\n};\n\nconst collectTrackedResults = (context: RuleContext): readonly TrackedResult[] => {\n const trackedResults: TrackedResult[] = [];\n\n const visit = (node: ts.Node): void => {\n if (\n context.tsApi.isVariableDeclaration(node) &&\n context.tsApi.isIdentifier(node.name) &&\n node.initializer !== undefined &&\n isCallLikeDiscard(context.tsApi, node.initializer)\n ) {\n const type = context.checker.getTypeAtLocation(node.initializer);\n\n if (isResultLikeType(context.tsApi, context.checker, node.initializer, type)) {\n const symbol = context.checker.getSymbolAtLocation(node.name);\n\n if (symbol !== undefined) {\n trackedResults.push({\n declaration: node,\n hasDiscardedResultUse: false,\n handled: false,\n identifier: node.name,\n name: getIdentifierText(node.name),\n symbol,\n typeName: getTypeName(context, node.initializer, type),\n });\n }\n }\n }\n\n context.tsApi.forEachChild(node, visit);\n };\n\n visit(context.sourceFile);\n\n return trackedResults;\n};\n\nconst markTrackedResultUses = (\n context: RuleContext,\n trackedResults: readonly TrackedResult[],\n): void => {\n const visit = (node: ts.Node, ancestors: readonly ts.Node[]): void => {\n if (context.tsApi.isIdentifier(node)) {\n const tracked = getTrackedResult(context.tsApi, context.checker, trackedResults, node);\n\n if (tracked !== undefined && node !== tracked.identifier) {\n if (isHandledReference(context.tsApi, node, ancestors)) {\n tracked.handled = true;\n }\n\n if (isIdentifierInsideDiscardedResultExpression(context, node, ancestors)) {\n tracked.hasDiscardedResultUse = true;\n }\n }\n }\n\n context.tsApi.forEachChild(node, (child) => visit(child, [...ancestors, node]));\n };\n\n visit(context.sourceFile, []);\n};\n\nconst getDirectFindings = (context: RuleContext): readonly NoDiscardFinding[] => {\n const findings: NoDiscardFinding[] = [];\n\n const visit = (node: ts.Node): void => {\n if (\n context.tsApi.isExpressionStatement(node) &&\n !isExplicitDiscard(context.tsApi, node.expression) &&\n isCallLikeDiscard(context.tsApi, node.expression)\n ) {\n const type = context.checker.getTypeAtLocation(node.expression);\n\n if (isResultLikeType(context.tsApi, context.checker, node.expression, type)) {\n findings.push(\n createIgnoredFinding(\n context,\n node.expression,\n getTypeName(context, node.expression, type),\n ),\n );\n }\n }\n\n context.tsApi.forEachChild(node, visit);\n };\n\n visit(context.sourceFile);\n\n return findings;\n};\n\nconst getMustUseFindings = (context: RuleContext): readonly NoDiscardFinding[] => {\n const trackedResults = collectTrackedResults(context);\n\n markTrackedResultUses(context, trackedResults);\n\n return trackedResults\n .filter((tracked) => !tracked.handled && !tracked.hasDiscardedResultUse)\n .map((tracked) => createUnhandledFinding(context, tracked));\n};\n\nexport const getSourceFileNoDiscardFindings = (\n tsApi: TypeScriptApi,\n checker: ts.TypeChecker,\n sourceFile: ts.SourceFile,\n options: NoDiscardRuleOptions = {},\n): readonly NoDiscardFinding[] => {\n const context: RuleContext = { checker, sourceFile, tsApi };\n const mode = normalizeNoDiscardMode(options.mode);\n const directFindings = getDirectFindings(context);\n\n return mode === \"must-use\" ? [...directFindings, ...getMustUseFindings(context)] : directFindings;\n};\n\nexport const getProgramNoDiscardFindings = (\n tsApi: TypeScriptApi,\n program: ts.Program,\n options: NoDiscardRuleOptions = {},\n): readonly NoDiscardFinding[] => {\n const checker = program.getTypeChecker();\n const findings: NoDiscardFinding[] = [];\n\n for (const sourceFile of program.getSourceFiles()) {\n if (\n !sourceFile.isDeclarationFile &&\n !sourceFile.fileName.includes(\"/node_modules/\") &&\n !sourceFile.fileName.includes(\"\\\\node_modules\\\\\")\n ) {\n findings.push(...getSourceFileNoDiscardFindings(tsApi, checker, sourceFile, options));\n }\n }\n\n return findings;\n};\n","import type * as ts from \"typescript\";\n\nimport type { ResultarLintFinding, ResultarRuleName, ResultarRuleSeverity } from \"./finding.js\";\nimport {\n type NoDiscardMode,\n getSourceFileNoDiscardFindings,\n isResultLikeType,\n normalizeNoDiscardMode,\n unwrapExpression,\n} from \"./result-usage-core.js\";\n\ntype TypeScriptApi = typeof ts;\n\ntype EnabledRuleSeverity = Exclude<ResultarRuleSeverity, \"off\">;\nexport type NoUnsafeAwaitMode = \"all\" | \"resultar-context\";\ntype ResultarRuleOptionName = Exclude<\n keyof ResultarRulesOptions,\n \"noDiscardMode\" | \"noUnsafeAwaitMode\"\n>;\ntype MutableResultarRulesOptions = {\n -readonly [Key in keyof ResultarRulesOptions]?: ResultarRulesOptions[Key];\n};\n\ninterface RuleContext {\n readonly checker: ts.TypeChecker;\n readonly sourceFile: ts.SourceFile;\n readonly tsApi: TypeScriptApi;\n}\n\ninterface ResultTypeParts {\n readonly error: ts.Type | undefined;\n readonly ok: ts.Type | undefined;\n}\n\ninterface IdentifierText {\n readonly escapedText?: unknown;\n readonly text?: string;\n}\n\ntype SafeTryBody =\n | ts.ArrowFunction\n | ts.FunctionDeclaration\n | ts.FunctionExpression\n | ts.MethodDeclaration;\n\nexport interface ResultarRulesOptions {\n readonly noDiscard: ResultarRuleSeverity;\n readonly noDiscardMode: NoDiscardMode;\n readonly noTaggedErrorConstructorOverride: ResultarRuleSeverity;\n readonly noTryCatchInSafeTry: ResultarRuleSeverity;\n readonly noUnsafeAwait: ResultarRuleSeverity;\n readonly noUnsafeAwaitMode: NoUnsafeAwaitMode;\n readonly noUselessRecovery: ResultarRuleSeverity;\n readonly preferAndThen: ResultarRuleSeverity;\n readonly preferMapErr: ResultarRuleSeverity;\n readonly preferTaggedError: ResultarRuleSeverity;\n readonly taggedErrorNameMatch: ResultarRuleSeverity;\n readonly typedCatchMapper: ResultarRuleSeverity;\n readonly unsafeResultTypeAssertion: ResultarRuleSeverity;\n readonly yieldStarInSafeTry: ResultarRuleSeverity;\n}\n\nexport const resultarRuleNames: readonly ResultarRuleName[] = [\n \"no-discard\",\n \"prefer-map-err\",\n \"prefer-and-then\",\n \"typed-catch-mapper\",\n \"no-unsafe-await\",\n \"no-try-catch-in-safe-try\",\n \"yield-star-in-safe-try\",\n \"unsafe-result-type-assertion\",\n \"prefer-tagged-error\",\n \"tagged-error-name-match\",\n \"no-tagged-error-constructor-override\",\n \"no-useless-recovery\",\n];\n\nexport const ruleOptionNameByRule: Record<ResultarRuleName, ResultarRuleOptionName> = {\n \"no-discard\": \"noDiscard\",\n \"no-tagged-error-constructor-override\": \"noTaggedErrorConstructorOverride\",\n \"no-try-catch-in-safe-try\": \"noTryCatchInSafeTry\",\n \"no-unsafe-await\": \"noUnsafeAwait\",\n \"no-useless-recovery\": \"noUselessRecovery\",\n \"prefer-and-then\": \"preferAndThen\",\n \"prefer-map-err\": \"preferMapErr\",\n \"prefer-tagged-error\": \"preferTaggedError\",\n \"tagged-error-name-match\": \"taggedErrorNameMatch\",\n \"typed-catch-mapper\": \"typedCatchMapper\",\n \"unsafe-result-type-assertion\": \"unsafeResultTypeAssertion\",\n \"yield-star-in-safe-try\": \"yieldStarInSafeTry\",\n};\n\nexport const defaultResultarRulesOptions: ResultarRulesOptions = {\n noDiscard: \"error\",\n noDiscardMode: \"must-use\",\n noTaggedErrorConstructorOverride: \"warning\",\n noTryCatchInSafeTry: \"warning\",\n noUnsafeAwait: \"off\",\n noUnsafeAwaitMode: \"resultar-context\",\n noUselessRecovery: \"warning\",\n preferAndThen: \"warning\",\n preferMapErr: \"warning\",\n preferTaggedError: \"warning\",\n taggedErrorNameMatch: \"warning\",\n typedCatchMapper: \"warning\",\n unsafeResultTypeAssertion: \"warning\",\n yieldStarInSafeTry: \"warning\",\n};\n\nconst ruleNamesWithoutNoDiscard = resultarRuleNames.filter(\n (ruleName): ruleName is Exclude<ResultarRuleName, \"no-discard\"> => ruleName !== \"no-discard\",\n);\n\nconst recoveryMethods = new Set([\n \"catchReason\",\n \"catchReasons\",\n \"catchTag\",\n \"catchTags\",\n \"mapErr\",\n \"orElse\",\n \"unwrapReason\",\n]);\n\nconst tryMapperCallNames = new Set([\n \"fromThrowable\",\n \"fromThrowableAsync\",\n \"tryCatch\",\n \"tryCatchAsync\",\n \"tryResult\",\n \"tryResultAsync\",\n \"tryAsync\",\n]);\n\nconst asyncAwaitBoundaryCallNames = new Set([\n \"fromThrowableAsync\",\n \"tryCatchAsync\",\n \"tryResultAsync\",\n \"tryAsync\",\n]);\n\nexport const normalizeRuleSeverity = (\n value: unknown,\n fallback: ResultarRuleSeverity,\n): ResultarRuleSeverity =>\n value === \"error\" ||\n value === \"message\" ||\n value === \"off\" ||\n value === \"suggestion\" ||\n value === \"warning\"\n ? value\n : fallback;\n\nexport const normalizeNoUnsafeAwaitMode = (\n value: unknown,\n fallback: NoUnsafeAwaitMode = defaultResultarRulesOptions.noUnsafeAwaitMode,\n): NoUnsafeAwaitMode => (value === \"all\" || value === \"resultar-context\" ? value : fallback);\n\nexport const normalizeResultarRulesOptions = (\n options: Partial<ResultarRulesOptions> = {},\n): ResultarRulesOptions => ({\n noDiscard: normalizeRuleSeverity(options.noDiscard, defaultResultarRulesOptions.noDiscard),\n noDiscardMode: normalizeNoDiscardMode(options.noDiscardMode),\n noTaggedErrorConstructorOverride: normalizeRuleSeverity(\n options.noTaggedErrorConstructorOverride,\n defaultResultarRulesOptions.noTaggedErrorConstructorOverride,\n ),\n noTryCatchInSafeTry: normalizeRuleSeverity(\n options.noTryCatchInSafeTry,\n defaultResultarRulesOptions.noTryCatchInSafeTry,\n ),\n noUnsafeAwait: normalizeRuleSeverity(\n options.noUnsafeAwait,\n defaultResultarRulesOptions.noUnsafeAwait,\n ),\n noUnsafeAwaitMode: normalizeNoUnsafeAwaitMode(options.noUnsafeAwaitMode),\n noUselessRecovery: normalizeRuleSeverity(\n options.noUselessRecovery,\n defaultResultarRulesOptions.noUselessRecovery,\n ),\n preferAndThen: normalizeRuleSeverity(\n options.preferAndThen,\n defaultResultarRulesOptions.preferAndThen,\n ),\n preferMapErr: normalizeRuleSeverity(\n options.preferMapErr,\n defaultResultarRulesOptions.preferMapErr,\n ),\n preferTaggedError: normalizeRuleSeverity(\n options.preferTaggedError,\n defaultResultarRulesOptions.preferTaggedError,\n ),\n taggedErrorNameMatch: normalizeRuleSeverity(\n options.taggedErrorNameMatch,\n defaultResultarRulesOptions.taggedErrorNameMatch,\n ),\n typedCatchMapper: normalizeRuleSeverity(\n options.typedCatchMapper,\n defaultResultarRulesOptions.typedCatchMapper,\n ),\n unsafeResultTypeAssertion: normalizeRuleSeverity(\n options.unsafeResultTypeAssertion,\n defaultResultarRulesOptions.unsafeResultTypeAssertion,\n ),\n yieldStarInSafeTry: normalizeRuleSeverity(\n options.yieldStarInSafeTry,\n defaultResultarRulesOptions.yieldStarInSafeTry,\n ),\n});\n\nexport const onlyResultarRule = (\n ruleName: ResultarRuleName,\n severity: ResultarRuleSeverity = \"error\",\n): Partial<ResultarRulesOptions> => {\n const options: MutableResultarRulesOptions = { noDiscard: \"off\" };\n\n for (const name of ruleNamesWithoutNoDiscard) {\n options[ruleOptionNameByRule[name]] = \"off\";\n }\n\n options[ruleOptionNameByRule[ruleName]] = severity;\n\n return options;\n};\n\nconst getRuleSeverity = (\n options: ResultarRulesOptions,\n rule: ResultarRuleName,\n): EnabledRuleSeverity | undefined => {\n const severity = options[ruleOptionNameByRule[rule]];\n\n return severity === \"off\" ? undefined : severity;\n};\n\nconst getTokenPosOfNode = (context: RuleContext, node: ts.Node): number => {\n const getTokenPos = (\n context.tsApi as unknown as {\n readonly getTokenPosOfNode?: (node: ts.Node, sourceFile?: ts.SourceFile) => number;\n }\n ).getTokenPosOfNode;\n\n return getTokenPos === undefined ? node.pos : getTokenPos(node, context.sourceFile);\n};\n\nconst getNodeStart = (context: RuleContext, node: ts.Node): number =>\n typeof node.getStart === \"function\"\n ? node.getStart(context.sourceFile)\n : getTokenPosOfNode(context, node);\n\nconst getIdentifierText = (identifier: IdentifierText): string => {\n if (typeof identifier.text === \"string\") {\n return identifier.text;\n }\n\n return identifier.escapedText === undefined ? \"\" : String(identifier.escapedText);\n};\n\nconst getNodeWidth = (context: RuleContext, node: ts.Node): number => {\n if (typeof node.getWidth === \"function\") {\n return node.getWidth(context.sourceFile);\n }\n\n const start = getNodeStart(context, node);\n\n return node.end - start;\n};\n\nconst createFinding = (\n context: RuleContext,\n node: ts.Node,\n rule: ResultarRuleName,\n severity: EnabledRuleSeverity,\n message: string,\n type?: string,\n): ResultarLintFinding => {\n const start = getNodeStart(context, node);\n const position = context.tsApi.getLineAndCharacterOfPosition(context.sourceFile, start);\n const base = {\n column: position.character + 1,\n file: context.sourceFile.fileName,\n length: getNodeWidth(context, node),\n line: position.line + 1,\n message,\n rule,\n severity,\n start,\n };\n\n return type === undefined ? base : { ...base, type };\n};\n\nconst visitSourceFile = (context: RuleContext, visitor: (node: ts.Node) => void): void => {\n const visit = (node: ts.Node): void => {\n visitor(node);\n context.tsApi.forEachChild(node, visit);\n };\n\n visit(context.sourceFile);\n};\n\nconst getPropertyNameText = (tsApi: TypeScriptApi, name: ts.PropertyName): string | undefined => {\n if (tsApi.isIdentifier(name)) {\n return getIdentifierText(name);\n }\n\n if (tsApi.isStringLiteral(name) || tsApi.isNumericLiteral(name)) {\n return name.text;\n }\n\n return undefined;\n};\n\nconst getExpressionName = (tsApi: TypeScriptApi, expression: ts.Expression): string | undefined => {\n const unwrapped = unwrapExpression(tsApi, expression);\n\n if (tsApi.isIdentifier(unwrapped)) {\n return getIdentifierText(unwrapped);\n }\n\n if (tsApi.isPropertyAccessExpression(unwrapped)) {\n return getIdentifierText(unwrapped.name);\n }\n\n return undefined;\n};\n\nconst getMethodCall = (\n tsApi: TypeScriptApi,\n node: ts.Node,\n):\n | {\n readonly methodName: string;\n readonly nameNode: ts.Identifier;\n readonly receiver: ts.Expression;\n }\n | undefined => {\n if (!tsApi.isCallExpression(node)) {\n return undefined;\n }\n\n const expression = unwrapExpression(tsApi, node.expression);\n\n if (!tsApi.isPropertyAccessExpression(expression)) {\n return undefined;\n }\n\n if (!tsApi.isIdentifier(expression.name)) {\n return undefined;\n }\n\n return {\n methodName: getIdentifierText(expression.name),\n nameNode: expression.name,\n receiver: expression.expression,\n };\n};\n\nconst getTypeName = (context: RuleContext, node: ts.Node, type: ts.Type): string =>\n context.checker.typeToString(type, node, context.tsApi.TypeFormatFlags.NoTruncation);\n\nconst getUnionOrIntersectionTypes = (\n context: RuleContext,\n type: ts.Type,\n): readonly ts.Type[] | undefined =>\n (type.flags & (context.tsApi.TypeFlags.Union | context.tsApi.TypeFlags.Intersection)) === 0\n ? undefined\n : ((type as ts.UnionOrIntersectionType).types ?? []);\n\nconst getTypeArguments = (context: RuleContext, type: ts.Type): readonly ts.Type[] => {\n const { aliasTypeArguments } = type;\n\n if (aliasTypeArguments !== undefined && aliasTypeArguments.length > 0) {\n return aliasTypeArguments;\n }\n\n const reference = type as ts.TypeReference;\n\n return reference.target === undefined ? [] : context.checker.getTypeArguments(reference);\n};\n\nconst getResultTypeParts = (\n context: RuleContext,\n node: ts.Node,\n type: ts.Type,\n): readonly ResultTypeParts[] => {\n const unionOrIntersectionTypes = getUnionOrIntersectionTypes(context, type);\n\n if (unionOrIntersectionTypes !== undefined) {\n return unionOrIntersectionTypes.flatMap((innerType) =>\n getResultTypeParts(context, node, innerType),\n );\n }\n\n if (!isResultLikeType(context.tsApi, context.checker, node, type)) {\n return [];\n }\n\n const [okType, errorType] = getTypeArguments(context, type);\n\n return [{ error: errorType, ok: okType }];\n};\n\nconst isResultAsyncLikeType = (context: RuleContext, node: ts.Node, type: ts.Type): boolean => {\n const unionOrIntersectionTypes = getUnionOrIntersectionTypes(context, type);\n\n if (unionOrIntersectionTypes !== undefined) {\n return unionOrIntersectionTypes.some((innerType) =>\n isResultAsyncLikeType(context, node, innerType),\n );\n }\n\n return /\\b(?:DisposableResultAsync|ResultAsync|StrictResultAsync)\\b/.test(\n getTypeName(context, node, type),\n );\n};\n\nconst isResultLikeExpression = (context: RuleContext, expression: ts.Expression): boolean => {\n const type = context.checker.getTypeAtLocation(expression);\n\n return isResultLikeType(context.tsApi, context.checker, expression, type);\n};\n\nconst getUnionTypes = (context: RuleContext, type: ts.Type): readonly ts.Type[] | undefined =>\n (type.flags & context.tsApi.TypeFlags.Union) === 0\n ? undefined\n : ((type as ts.UnionType).types ?? []);\n\nconst everyUnionPart = (\n context: RuleContext,\n type: ts.Type,\n predicate: (type: ts.Type) => boolean,\n): boolean => {\n const unionTypes = getUnionTypes(context, type);\n\n return unionTypes === undefined\n ? predicate(type)\n : unionTypes.every((innerType) => predicate(innerType));\n};\n\nconst isResultAsyncLikeAwaitType = (context: RuleContext, node: ts.Node, type: ts.Type): boolean =>\n everyUnionPart(context, type, (innerType) => isResultAsyncLikeType(context, node, innerType));\n\nconst isResultLikeAwaitedType = (context: RuleContext, node: ts.Node, type: ts.Type): boolean =>\n everyUnionPart(context, type, (innerType) =>\n isResultLikeType(context.tsApi, context.checker, node, innerType),\n );\n\nconst getPromisedTypeOfPromise = (\n context: RuleContext,\n node: ts.Node,\n type: ts.Type,\n): ts.Type | undefined => {\n const checker = context.checker as ts.TypeChecker & {\n readonly getPromisedTypeOfPromise?: (type: ts.Type, errorNode?: ts.Node) => ts.Type | undefined;\n };\n\n return checker.getPromisedTypeOfPromise?.(type, node);\n};\n\nconst isSafeAwaitExpression = (context: RuleContext, expression: ts.Expression): boolean => {\n const expressionType = context.checker.getTypeAtLocation(expression);\n\n if (isResultAsyncLikeAwaitType(context, expression, expressionType)) {\n return true;\n }\n\n const promisedType = getPromisedTypeOfPromise(context, expression, expressionType);\n\n if (promisedType === undefined) {\n return true;\n }\n\n const awaitedType = context.checker.getAwaitedType(expressionType) ?? promisedType;\n\n return isResultLikeAwaitedType(context, expression, awaitedType);\n};\n\nconst isPromiseOfResultLikeType = (context: RuleContext, node: ts.Node, type: ts.Type): boolean => {\n const unionOrIntersectionTypes = getUnionOrIntersectionTypes(context, type);\n\n if (unionOrIntersectionTypes !== undefined) {\n return unionOrIntersectionTypes.some((innerType) =>\n isPromiseOfResultLikeType(context, node, innerType),\n );\n }\n\n const promisedType = getPromisedTypeOfPromise(context, node, type);\n\n if (promisedType === undefined) {\n return false;\n }\n\n const awaitedType = context.checker.getAwaitedType(type) ?? promisedType;\n\n return isResultLikeAwaitedType(context, node, awaitedType);\n};\n\nconst isResultarAsyncContextReturnType = (\n context: RuleContext,\n node: ts.Node,\n type: ts.Type,\n): boolean =>\n isResultAsyncLikeType(context, node, type) || isPromiseOfResultLikeType(context, node, type);\n\nconst getFunctionLikeReturnType = (context: RuleContext, node: ts.Node): ts.Type | undefined => {\n const signature = context.checker.getSignatureFromDeclaration(node as ts.SignatureDeclaration);\n\n if (signature !== undefined) {\n return signature.getReturnType();\n }\n\n const functionType = context.checker.getTypeAtLocation(node);\n const [callSignature] = functionType.getCallSignatures();\n\n return callSignature?.getReturnType();\n};\n\nconst isResultarAsyncFunctionContext = (context: RuleContext, node: ts.Node): boolean => {\n if (!isFunctionLike(context.tsApi, node)) {\n return false;\n }\n\n const returnType = getFunctionLikeReturnType(context, node);\n\n return returnType !== undefined && isResultarAsyncContextReturnType(context, node, returnType);\n};\n\nconst isUnknownOrAnyType = (tsApi: TypeScriptApi, type: ts.Type | undefined): boolean =>\n type !== undefined &&\n (Boolean(type.flags & tsApi.TypeFlags.Unknown) || Boolean(type.flags & tsApi.TypeFlags.Any));\n\nconst isNeverType = (tsApi: TypeScriptApi, type: ts.Type | undefined): boolean =>\n type !== undefined && Boolean(type.flags & tsApi.TypeFlags.Never);\n\nconst getReturnedExpressions = (\n tsApi: TypeScriptApi,\n callback: ts.Expression,\n): readonly ts.Expression[] => {\n const expressions: ts.Expression[] = [];\n\n if (!tsApi.isArrowFunction(callback) && !tsApi.isFunctionExpression(callback)) {\n return expressions;\n }\n\n if (tsApi.isArrowFunction(callback) && !tsApi.isBlock(callback.body)) {\n return [callback.body];\n }\n\n const { body } = callback;\n const visit = (node: ts.Node): void => {\n if (node !== body && isFunctionLike(tsApi, node)) {\n return;\n }\n\n if (tsApi.isReturnStatement(node) && node.expression !== undefined) {\n expressions.push(node.expression);\n return;\n }\n\n tsApi.forEachChild(node, visit);\n };\n\n visit(body);\n\n return expressions;\n};\n\nconst isFunctionLike = (tsApi: TypeScriptApi, node: ts.Node): boolean =>\n tsApi.isArrowFunction(node) ||\n tsApi.isFunctionDeclaration(node) ||\n tsApi.isFunctionExpression(node) ||\n tsApi.isMethodDeclaration(node);\n\nconst isErrConstructorCall = (tsApi: TypeScriptApi, expression: ts.Expression): boolean => {\n const unwrapped = unwrapExpression(tsApi, expression);\n\n if (!tsApi.isCallExpression(unwrapped)) {\n return false;\n }\n\n return getExpressionName(tsApi, unwrapped.expression) === \"err\";\n};\n\nconst hasObjectCatchProperty = (tsApi: TypeScriptApi, expression: ts.Expression): boolean => {\n const unwrapped = unwrapExpression(tsApi, expression);\n\n if (!tsApi.isObjectLiteralExpression(unwrapped)) {\n return false;\n }\n\n return unwrapped.properties.some((property) => {\n if (tsApi.isPropertyAssignment(property) || tsApi.isMethodDeclaration(property)) {\n return getPropertyNameText(tsApi, property.name) === \"catch\";\n }\n\n return false;\n });\n};\n\nconst hasMapperArgument = (tsApi: TypeScriptApi, call: ts.CallExpression): boolean => {\n const [firstArgument, secondArgument] = call.arguments;\n\n return (\n secondArgument !== undefined ||\n (firstArgument !== undefined && hasObjectCatchProperty(tsApi, firstArgument))\n );\n};\n\nconst getObjectTryBody = (\n tsApi: TypeScriptApi,\n objectLiteral: ts.ObjectLiteralExpression,\n): SafeTryBody | undefined => {\n for (const property of objectLiteral.properties) {\n if (\n tsApi.isMethodDeclaration(property) &&\n getPropertyNameText(tsApi, property.name) === \"try\"\n ) {\n return property;\n }\n\n if (\n tsApi.isPropertyAssignment(property) &&\n getPropertyNameText(tsApi, property.name) === \"try\" &&\n (tsApi.isArrowFunction(property.initializer) ||\n tsApi.isFunctionExpression(property.initializer))\n ) {\n return property.initializer;\n }\n }\n\n return undefined;\n};\n\nconst getSafeTryBody = (tsApi: TypeScriptApi, call: ts.CallExpression): SafeTryBody | undefined => {\n if (getExpressionName(tsApi, call.expression) !== \"safeTry\") {\n return undefined;\n }\n\n const [firstArgument] = call.arguments;\n\n if (firstArgument === undefined) {\n return undefined;\n }\n\n const unwrapped = unwrapExpression(tsApi, firstArgument);\n\n if (tsApi.isArrowFunction(unwrapped) || tsApi.isFunctionExpression(unwrapped)) {\n return unwrapped;\n }\n\n if (!tsApi.isObjectLiteralExpression(unwrapped)) {\n return undefined;\n }\n\n return getObjectTryBody(tsApi, unwrapped);\n};\n\nconst getResultarAwaitBoundaryBody = (\n tsApi: TypeScriptApi,\n call: ts.CallExpression,\n): SafeTryBody | undefined => {\n const callName = getExpressionName(tsApi, call.expression);\n\n if (callName === undefined || !asyncAwaitBoundaryCallNames.has(callName)) {\n return undefined;\n }\n\n const [firstArgument] = call.arguments;\n\n if (firstArgument === undefined) {\n return undefined;\n }\n\n const unwrapped = unwrapExpression(tsApi, firstArgument);\n\n if (tsApi.isArrowFunction(unwrapped) || tsApi.isFunctionExpression(unwrapped)) {\n return unwrapped;\n }\n\n if (tsApi.isObjectLiteralExpression(unwrapped)) {\n return getObjectTryBody(tsApi, unwrapped);\n }\n\n return undefined;\n};\n\nconst getResultarAwaitContextBody = (\n tsApi: TypeScriptApi,\n call: ts.CallExpression,\n): SafeTryBody | undefined =>\n getSafeTryBody(tsApi, call) ?? getResultarAwaitBoundaryBody(tsApi, call);\n\nconst visitSafeTryBody = (\n tsApi: TypeScriptApi,\n body: SafeTryBody,\n visitor: (node: ts.Node) => void,\n): void => {\n const root = body.body;\n\n if (root === undefined) {\n return;\n }\n\n const visit = (node: ts.Node): void => {\n if (node !== root && isFunctionLike(tsApi, node)) {\n return;\n }\n\n visitor(node);\n tsApi.forEachChild(node, visit);\n };\n\n visit(root);\n};\n\nconst getCreateTaggedErrorOptions = (\n tsApi: TypeScriptApi,\n node: ts.ClassDeclaration,\n): ts.ObjectLiteralExpression | undefined => {\n for (const heritageClause of node.heritageClauses ?? []) {\n if (heritageClause.token !== tsApi.SyntaxKind.ExtendsKeyword) {\n continue;\n }\n\n for (const heritageType of heritageClause.types) {\n const { expression } = heritageType;\n\n if (\n tsApi.isCallExpression(expression) &&\n getExpressionName(tsApi, expression.expression) === \"createTaggedError\"\n ) {\n const [options] = expression.arguments;\n\n return options !== undefined && tsApi.isObjectLiteralExpression(options)\n ? options\n : undefined;\n }\n }\n }\n\n return undefined;\n};\n\nconst getTaggedErrorName = (\n tsApi: TypeScriptApi,\n options: ts.ObjectLiteralExpression,\n): ts.StringLiteral | ts.NoSubstitutionTemplateLiteral | undefined => {\n for (const property of options.properties) {\n if (\n tsApi.isPropertyAssignment(property) &&\n getPropertyNameText(tsApi, property.name) === \"name\" &&\n (tsApi.isStringLiteral(property.initializer) ||\n tsApi.isNoSubstitutionTemplateLiteral(property.initializer))\n ) {\n return property.initializer;\n }\n }\n\n return undefined;\n};\n\nconst classExtendsNativeError = (tsApi: TypeScriptApi, node: ts.ClassDeclaration): boolean =>\n (node.heritageClauses ?? []).some(\n (heritageClause) =>\n heritageClause.token === tsApi.SyntaxKind.ExtendsKeyword &&\n heritageClause.types.some(\n (heritageType) => getExpressionName(tsApi, heritageType.expression) === \"Error\",\n ),\n );\n\nconst getFirstResultErrorTypes = (\n context: RuleContext,\n node: ts.Node,\n type: ts.Type,\n): readonly ts.Type[] =>\n getResultTypeParts(context, node, type)\n .map((part) => part.error)\n .filter((errorType): errorType is ts.Type => errorType !== undefined);\n\nconst getPreferMapErrFindings = (\n context: RuleContext,\n severity: EnabledRuleSeverity,\n): readonly ResultarLintFinding[] => {\n const findings: ResultarLintFinding[] = [];\n\n visitSourceFile(context, (node) => {\n const call = context.tsApi.isCallExpression(node) ? node : undefined;\n const methodCall = getMethodCall(context.tsApi, node);\n\n if (call === undefined || methodCall?.methodName !== \"orElse\") {\n return;\n }\n\n if (!isResultLikeExpression(context, methodCall.receiver)) {\n return;\n }\n\n const [callback] = call.arguments;\n const returnedExpressions =\n callback === undefined ? [] : getReturnedExpressions(context.tsApi, callback);\n\n if (\n returnedExpressions.length === 0 ||\n !returnedExpressions.every(\n (expression) =>\n isErrConstructorCall(context.tsApi, expression) &&\n isResultLikeExpression(context, expression),\n )\n ) {\n return;\n }\n\n findings.push(\n createFinding(\n context,\n methodCall.nameNode,\n \"prefer-map-err\",\n severity,\n \"`orElse` only replaces the failure with another Err. Use `mapErr` when the Ok value cannot recover.\",\n ),\n );\n });\n\n return findings;\n};\n\nconst getPreferAndThenFindings = (\n context: RuleContext,\n severity: EnabledRuleSeverity,\n): readonly ResultarLintFinding[] => {\n const findings: ResultarLintFinding[] = [];\n\n visitSourceFile(context, (node) => {\n const call = context.tsApi.isCallExpression(node) ? node : undefined;\n const methodCall = getMethodCall(context.tsApi, node);\n\n if (call === undefined || methodCall?.methodName !== \"map\") {\n return;\n }\n\n const receiverType = context.checker.getTypeAtLocation(methodCall.receiver);\n\n if (!isResultLikeType(context.tsApi, context.checker, methodCall.receiver, receiverType)) {\n return;\n }\n\n const [callback] = call.arguments;\n const returnedExpressions =\n callback === undefined ? [] : getReturnedExpressions(context.tsApi, callback);\n const returnedResult = returnedExpressions.find((expression) =>\n isResultLikeExpression(context, expression),\n );\n\n if (returnedResult === undefined) {\n return;\n }\n\n const returnedType = context.checker.getTypeAtLocation(returnedResult);\n const methodName =\n !isResultAsyncLikeType(context, methodCall.receiver, receiverType) &&\n isResultAsyncLikeType(context, returnedResult, returnedType)\n ? \"asyncAndThen\"\n : \"andThen\";\n\n findings.push(\n createFinding(\n context,\n methodCall.nameNode,\n \"prefer-and-then\",\n severity,\n `\\`map\\` creates a nested Result when its callback returns ${getTypeName(\n context,\n returnedResult,\n returnedType,\n )}. Use \\`${methodName}\\` for fallible composition.`,\n ),\n );\n });\n\n return findings;\n};\n\nconst getTypedCatchMapperFindings = (\n context: RuleContext,\n severity: EnabledRuleSeverity,\n): readonly ResultarLintFinding[] => {\n const findings: ResultarLintFinding[] = [];\n\n visitSourceFile(context, (node) => {\n if (!context.tsApi.isCallExpression(node)) {\n return;\n }\n\n const callName = getExpressionName(context.tsApi, node.expression);\n\n if (\n callName === undefined ||\n !tryMapperCallNames.has(callName) ||\n hasMapperArgument(context.tsApi, node)\n ) {\n return;\n }\n\n if (callName !== \"fromThrowable\" && callName !== \"fromThrowableAsync\") {\n const returnType = context.checker.getTypeAtLocation(node);\n const errorTypes = getFirstResultErrorTypes(context, node, returnType);\n\n if (\n errorTypes.length > 0 &&\n errorTypes.every((errorType) => !isUnknownOrAnyType(context.tsApi, errorType))\n ) {\n return;\n }\n }\n\n findings.push(\n createFinding(\n context,\n node.expression,\n \"typed-catch-mapper\",\n severity,\n `\\`${callName}\\` without a catch mapper leaves the error channel as \\`unknown\\`. Map the caught value to a specific Resultar error.`,\n ),\n );\n });\n\n return findings;\n};\n\nconst collectResultarAwaitBoundaryBodies = (context: RuleContext): ReadonlySet<ts.Node> => {\n const bodies = new Set<ts.Node>();\n\n visitSourceFile(context, (node) => {\n if (!context.tsApi.isCallExpression(node)) {\n return;\n }\n\n const body = getResultarAwaitBoundaryBody(context.tsApi, node);\n\n if (body !== undefined) {\n bodies.add(body);\n }\n });\n\n return bodies;\n};\n\nconst collectResultarAwaitContextBodies = (context: RuleContext): ReadonlySet<ts.Node> => {\n const bodies = new Set<ts.Node>();\n\n visitSourceFile(context, (node) => {\n if (!context.tsApi.isCallExpression(node)) {\n return;\n }\n\n const body = getResultarAwaitContextBody(context.tsApi, node);\n\n if (body !== undefined) {\n bodies.add(body);\n }\n });\n\n return bodies;\n};\n\nconst getNoUnsafeAwaitFindings = (\n context: RuleContext,\n severity: EnabledRuleSeverity,\n mode: NoUnsafeAwaitMode,\n): readonly ResultarLintFinding[] => {\n const findings: ResultarLintFinding[] = [];\n const boundaryBodies = collectResultarAwaitBoundaryBodies(context);\n const contextBodies = collectResultarAwaitContextBodies(context);\n\n const visit = (\n node: ts.Node,\n insideResultarBoundary: boolean,\n insideResultarContext: boolean,\n ): void => {\n const startsResultarBoundary = boundaryBodies.has(node);\n const currentInsideBoundary = insideResultarBoundary || startsResultarBoundary;\n const startsResultarContext =\n contextBodies.has(node) || isResultarAsyncFunctionContext(context, node);\n const currentInsideContext = insideResultarContext || startsResultarContext;\n const shouldCheckAwait = mode === \"all\" || currentInsideContext;\n\n if (\n shouldCheckAwait &&\n context.tsApi.isAwaitExpression(node) &&\n !currentInsideBoundary &&\n !isSafeAwaitExpression(context, node.expression)\n ) {\n findings.push(\n createFinding(\n context,\n node,\n \"no-unsafe-await\",\n severity,\n \"Wrap this awaited Promise in tryAsync, tryResultAsync, tryCatchAsync, or fromThrowableAsync so rejections stay in the Resultar error channel.\",\n ),\n );\n }\n\n if (node !== context.sourceFile && isFunctionLike(context.tsApi, node)) {\n context.tsApi.forEachChild(node, (child) =>\n visit(child, startsResultarBoundary, startsResultarContext),\n );\n return;\n }\n\n context.tsApi.forEachChild(node, (child) =>\n visit(child, currentInsideBoundary, currentInsideContext),\n );\n };\n\n visit(context.sourceFile, false, false);\n\n return findings;\n};\n\nconst getNoTryCatchInSafeTryFindings = (\n context: RuleContext,\n severity: EnabledRuleSeverity,\n): readonly ResultarLintFinding[] => {\n const findings: ResultarLintFinding[] = [];\n\n visitSourceFile(context, (node) => {\n if (!context.tsApi.isCallExpression(node)) {\n return;\n }\n\n const safeTryBody = getSafeTryBody(context.tsApi, node);\n\n if (safeTryBody === undefined) {\n return;\n }\n\n visitSafeTryBody(context.tsApi, safeTryBody, (bodyNode) => {\n if (context.tsApi.isTryStatement(bodyNode)) {\n findings.push(\n createFinding(\n context,\n bodyNode,\n \"no-try-catch-in-safe-try\",\n severity,\n \"Avoid raw try/catch inside `safeTry`. Use `safeTry({ try, catch })`, `tryResult`, or `tryResultAsync` to keep failures typed.\",\n ),\n );\n }\n });\n });\n\n return findings;\n};\n\nconst getYieldStarInSafeTryFindings = (\n context: RuleContext,\n severity: EnabledRuleSeverity,\n): readonly ResultarLintFinding[] => {\n const findings: ResultarLintFinding[] = [];\n\n visitSourceFile(context, (node) => {\n if (!context.tsApi.isCallExpression(node)) {\n return;\n }\n\n const safeTryBody = getSafeTryBody(context.tsApi, node);\n\n if (safeTryBody === undefined) {\n return;\n }\n\n visitSafeTryBody(context.tsApi, safeTryBody, (bodyNode) => {\n if (\n context.tsApi.isYieldExpression(bodyNode) &&\n bodyNode.asteriskToken === undefined &&\n bodyNode.expression !== undefined &&\n isResultLikeExpression(context, bodyNode.expression)\n ) {\n findings.push(\n createFinding(\n context,\n bodyNode,\n \"yield-star-in-safe-try\",\n severity,\n \"Use `yield*` when unwrapping Resultar values inside `safeTry`.\",\n ),\n );\n }\n });\n });\n\n return findings;\n};\n\nconst getUnsafeResultTypeAssertionFindings = (\n context: RuleContext,\n severity: EnabledRuleSeverity,\n): readonly ResultarLintFinding[] => {\n const findings: ResultarLintFinding[] = [];\n\n visitSourceFile(context, (node) => {\n if (!context.tsApi.isAsExpression(node) && !context.tsApi.isTypeAssertionExpression(node)) {\n return;\n }\n\n const { expression } = node;\n const originalType = context.checker.getTypeAtLocation(expression);\n const assertedType = context.checker.getTypeAtLocation(node);\n const originalParts = getResultTypeParts(context, expression, originalType);\n const assertedParts = getResultTypeParts(context, node, assertedType);\n\n if (originalParts.length === 0 || assertedParts.length === 0) {\n return;\n }\n\n const narrowedErrors = originalParts.flatMap((originalPart) =>\n assertedParts\n .filter(\n (assertedPart) =>\n originalPart.error !== undefined &&\n assertedPart.error !== undefined &&\n !isUnknownOrAnyType(context.tsApi, originalPart.error) &&\n !context.checker.isTypeAssignableTo(originalPart.error, assertedPart.error),\n )\n .map((assertedPart) => ({ asserted: assertedPart.error!, original: originalPart.error! })),\n );\n\n if (narrowedErrors.length === 0) {\n return;\n }\n\n const details = narrowedErrors\n .map(\n ({ asserted, original }) =>\n `\\`${getTypeName(context, expression, original)}\\` to \\`${getTypeName(context, node, asserted)}\\``,\n )\n .join(\", \");\n\n findings.push(\n createFinding(\n context,\n node,\n \"unsafe-result-type-assertion\",\n severity,\n `This assertion narrows the Resultar error channel unsafely (${details}). Prefer a real recovery or mapping step.`,\n ),\n );\n });\n\n return findings;\n};\n\nconst getPreferTaggedErrorFindings = (\n context: RuleContext,\n severity: EnabledRuleSeverity,\n): readonly ResultarLintFinding[] => {\n const findings: ResultarLintFinding[] = [];\n\n visitSourceFile(context, (node) => {\n if (context.tsApi.isClassDeclaration(node) && classExtendsNativeError(context.tsApi, node)) {\n findings.push(\n createFinding(\n context,\n node.name ?? node,\n \"prefer-tagged-error\",\n severity,\n \"Prefer `createTaggedError` for Resultar domain errors so failures keep a stable tag and typed metadata.\",\n ),\n );\n return;\n }\n\n if (\n !context.tsApi.isCallExpression(node) ||\n getExpressionName(context.tsApi, node.expression) !== \"err\"\n ) {\n return;\n }\n\n const [errorArgument] = node.arguments;\n\n if (errorArgument === undefined) {\n return;\n }\n\n const unwrappedErrorArgument = unwrapExpression(context.tsApi, errorArgument);\n\n if (\n context.tsApi.isNewExpression(unwrappedErrorArgument) &&\n getExpressionName(context.tsApi, unwrappedErrorArgument.expression) === \"Error\"\n ) {\n findings.push(\n createFinding(\n context,\n errorArgument,\n \"prefer-tagged-error\",\n severity,\n \"Prefer a `createTaggedError` instance over `new Error(...)` in Resultar error channels.\",\n ),\n );\n }\n });\n\n return findings;\n};\n\nconst getTaggedErrorNameMatchFindings = (\n context: RuleContext,\n severity: EnabledRuleSeverity,\n): readonly ResultarLintFinding[] => {\n const findings: ResultarLintFinding[] = [];\n\n visitSourceFile(context, (node) => {\n if (!context.tsApi.isClassDeclaration(node) || node.name === undefined) {\n return;\n }\n\n const options = getCreateTaggedErrorOptions(context.tsApi, node);\n const nameInitializer =\n options === undefined ? undefined : getTaggedErrorName(context.tsApi, options);\n const className = getIdentifierText(node.name);\n\n if (nameInitializer === undefined || nameInitializer.text === className) {\n return;\n }\n\n findings.push(\n createFinding(\n context,\n nameInitializer,\n \"tagged-error-name-match\",\n severity,\n `Tagged error name \\`${nameInitializer.text}\\` should match class name \\`${className}\\`.`,\n ),\n );\n });\n\n return findings;\n};\n\nconst getNoTaggedErrorConstructorOverrideFindings = (\n context: RuleContext,\n severity: EnabledRuleSeverity,\n): readonly ResultarLintFinding[] => {\n const findings: ResultarLintFinding[] = [];\n\n visitSourceFile(context, (node) => {\n if (\n !context.tsApi.isClassDeclaration(node) ||\n getCreateTaggedErrorOptions(context.tsApi, node) === undefined\n ) {\n return;\n }\n\n for (const member of node.members) {\n if (context.tsApi.isConstructorDeclaration(member)) {\n findings.push(\n createFinding(\n context,\n member,\n \"no-tagged-error-constructor-override\",\n severity,\n \"Do not override the constructor generated by `createTaggedError`; it owns template props, cause, and serialization behavior.\",\n ),\n );\n }\n }\n });\n\n return findings;\n};\n\nconst getNoUselessRecoveryFindings = (\n context: RuleContext,\n severity: EnabledRuleSeverity,\n): readonly ResultarLintFinding[] => {\n const findings: ResultarLintFinding[] = [];\n\n visitSourceFile(context, (node) => {\n const methodCall = getMethodCall(context.tsApi, node);\n\n if (methodCall === undefined || !recoveryMethods.has(methodCall.methodName)) {\n return;\n }\n\n const receiverType = context.checker.getTypeAtLocation(methodCall.receiver);\n const errorTypes = getFirstResultErrorTypes(context, methodCall.receiver, receiverType);\n\n if (\n errorTypes.length === 0 ||\n !errorTypes.every((errorType) => isNeverType(context.tsApi, errorType))\n ) {\n return;\n }\n\n findings.push(\n createFinding(\n context,\n methodCall.nameNode,\n \"no-useless-recovery\",\n severity,\n `\\`${methodCall.methodName}\\` cannot run because this Resultar value has \\`never\\` in the error channel.`,\n ),\n );\n });\n\n return findings;\n};\n\nexport const getSourceFileResultarFindings = (\n tsApi: TypeScriptApi,\n checker: ts.TypeChecker,\n sourceFile: ts.SourceFile,\n options: Partial<ResultarRulesOptions> = {},\n): readonly ResultarLintFinding[] => {\n const normalizedOptions = normalizeResultarRulesOptions(options);\n const context: RuleContext = { checker, sourceFile, tsApi };\n const findings: ResultarLintFinding[] = [];\n const noDiscardSeverity = getRuleSeverity(normalizedOptions, \"no-discard\");\n\n if (noDiscardSeverity !== undefined) {\n findings.push(\n ...getSourceFileNoDiscardFindings(tsApi, checker, sourceFile, {\n mode: normalizedOptions.noDiscardMode,\n }).map((finding) => ({ ...finding, severity: noDiscardSeverity })),\n );\n }\n\n const noUnsafeAwaitSeverity = getRuleSeverity(normalizedOptions, \"no-unsafe-await\");\n\n if (noUnsafeAwaitSeverity !== undefined) {\n findings.push(\n ...getNoUnsafeAwaitFindings(\n context,\n noUnsafeAwaitSeverity,\n normalizedOptions.noUnsafeAwaitMode,\n ),\n );\n }\n\n const ruleFns: readonly (readonly [\n Exclude<ResultarRuleName, \"no-discard\" | \"no-unsafe-await\">,\n (context: RuleContext, severity: EnabledRuleSeverity) => readonly ResultarLintFinding[],\n ])[] = [\n [\"prefer-map-err\", getPreferMapErrFindings],\n [\"prefer-and-then\", getPreferAndThenFindings],\n [\"typed-catch-mapper\", getTypedCatchMapperFindings],\n [\"no-try-catch-in-safe-try\", getNoTryCatchInSafeTryFindings],\n [\"yield-star-in-safe-try\", getYieldStarInSafeTryFindings],\n [\"unsafe-result-type-assertion\", getUnsafeResultTypeAssertionFindings],\n [\"prefer-tagged-error\", getPreferTaggedErrorFindings],\n [\"tagged-error-name-match\", getTaggedErrorNameMatchFindings],\n [\"no-tagged-error-constructor-override\", getNoTaggedErrorConstructorOverrideFindings],\n [\"no-useless-recovery\", getNoUselessRecoveryFindings],\n ];\n\n for (const [ruleName, ruleFn] of ruleFns) {\n const severity = getRuleSeverity(normalizedOptions, ruleName);\n\n if (severity !== undefined) {\n findings.push(...ruleFn(context, severity));\n }\n }\n\n return findings.toSorted(\n (left, right) => left.start - right.start || left.rule.localeCompare(right.rule),\n );\n};\n\nexport const getProgramResultarFindings = (\n tsApi: TypeScriptApi,\n program: ts.Program,\n options: Partial<ResultarRulesOptions> = {},\n): readonly ResultarLintFinding[] => {\n const checker = program.getTypeChecker();\n const findings: ResultarLintFinding[] = [];\n\n for (const sourceFile of program.getSourceFiles()) {\n if (\n !sourceFile.isDeclarationFile &&\n !sourceFile.fileName.includes(\"/node_modules/\") &&\n !sourceFile.fileName.includes(\"\\\\node_modules\\\\\")\n ) {\n findings.push(...getSourceFileResultarFindings(tsApi, checker, sourceFile, options));\n }\n }\n\n return findings;\n};\n","import { normalizeNoDiscardMode } from \"./result-usage-core.js\";\nimport {\n type ResultarRulesOptions,\n defaultResultarRulesOptions,\n normalizeNoUnsafeAwaitMode,\n normalizeRuleSeverity,\n} from \"./rules-core.js\";\n\nexport type ResultarLanguageServiceOptions = ResultarRulesOptions;\n\nconst isRecord = (value: unknown): value is Record<PropertyKey, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst isResultarPluginName = (value: unknown): boolean =>\n value === \"resultar-check\" || value === \"resultar-lint\";\n\nexport const parsePluginOptions = (config: unknown): ResultarLanguageServiceOptions => {\n if (!isRecord(config)) {\n return defaultResultarRulesOptions;\n }\n\n return {\n noDiscard: normalizeRuleSeverity(config.noDiscard, defaultResultarRulesOptions.noDiscard),\n noDiscardMode: normalizeNoDiscardMode(config.noDiscardMode),\n noTaggedErrorConstructorOverride: normalizeRuleSeverity(\n config.noTaggedErrorConstructorOverride,\n defaultResultarRulesOptions.noTaggedErrorConstructorOverride,\n ),\n noTryCatchInSafeTry: normalizeRuleSeverity(\n config.noTryCatchInSafeTry,\n defaultResultarRulesOptions.noTryCatchInSafeTry,\n ),\n noUnsafeAwait: normalizeRuleSeverity(\n config.noUnsafeAwait,\n defaultResultarRulesOptions.noUnsafeAwait,\n ),\n noUnsafeAwaitMode: normalizeNoUnsafeAwaitMode(config.noUnsafeAwaitMode),\n noUselessRecovery: normalizeRuleSeverity(\n config.noUselessRecovery,\n defaultResultarRulesOptions.noUselessRecovery,\n ),\n preferAndThen: normalizeRuleSeverity(\n config.preferAndThen,\n defaultResultarRulesOptions.preferAndThen,\n ),\n preferMapErr: normalizeRuleSeverity(\n config.preferMapErr,\n defaultResultarRulesOptions.preferMapErr,\n ),\n preferTaggedError: normalizeRuleSeverity(\n config.preferTaggedError,\n defaultResultarRulesOptions.preferTaggedError,\n ),\n taggedErrorNameMatch: normalizeRuleSeverity(\n config.taggedErrorNameMatch,\n defaultResultarRulesOptions.taggedErrorNameMatch,\n ),\n typedCatchMapper: normalizeRuleSeverity(\n config.typedCatchMapper,\n defaultResultarRulesOptions.typedCatchMapper,\n ),\n unsafeResultTypeAssertion: normalizeRuleSeverity(\n config.unsafeResultTypeAssertion,\n defaultResultarRulesOptions.unsafeResultTypeAssertion,\n ),\n yieldStarInSafeTry: normalizeRuleSeverity(\n config.yieldStarInSafeTry,\n defaultResultarRulesOptions.yieldStarInSafeTry,\n ),\n };\n};\n\nexport const findResultarPluginConfig = (\n plugins: readonly unknown[] | undefined,\n): ResultarLanguageServiceOptions | undefined => {\n const plugin = plugins?.find((entry) => isRecord(entry) && isResultarPluginName(entry.name));\n\n return plugin === undefined ? undefined : parsePluginOptions(plugin);\n};\n","import { spawnSync } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, relative, resolve } from \"node:path\";\n\nimport type * as ts from \"typescript\";\n\nimport type { ResultarLintFinding } from \"./finding.js\";\nimport {\n getProgramNoDiscardFindings,\n type NoDiscardFinding as ResultarNoDiscardFinding,\n type NoDiscardMode as ResultarNoDiscardMode,\n normalizeNoDiscardMode,\n} from \"./result-usage-core.js\";\nimport { type ResultarRulesOptions, getProgramResultarFindings } from \"./rules-core.js\";\nimport { findResultarPluginConfig } from \"./plugin-options.js\";\n\nexport interface NoDiscardOptions {\n readonly mode?: ResultarNoDiscardMode;\n readonly project?: string;\n readonly rootDir?: string;\n}\n\nexport type { NoDiscardFinding, NoDiscardMode } from \"./result-usage-core.js\";\n\ntype TypeScriptApi = typeof ts;\n\ntype NoDiscardFailure = { readonly error: Error; readonly ok: false };\n\nexport type NoDiscardResult =\n | NoDiscardFailure\n | { readonly findings: readonly ResultarNoDiscardFinding[]; readonly ok: true };\n\nexport interface ResultarLintOptions extends NoDiscardOptions {\n readonly rules?: Partial<ResultarRulesOptions>;\n}\n\nexport type ResultarLintResult =\n | NoDiscardFailure\n | { readonly findings: readonly ResultarLintFinding[]; readonly ok: true };\n\ninterface CliOptions extends NoDiscardOptions {\n readonly help: boolean;\n}\n\ninterface ResultarCheckCliOptions extends CliOptions {\n readonly tscArgs: readonly string[];\n}\n\nconst usage = `Usage: resultar-check -p tsconfig.json --noEmit\n\nFlags:\n --mode <direct|must-use> Check mode. Defaults to tsconfig plugin noDiscardMode or must-use.\n -p, --project <path> TypeScript project file to inspect. Defaults to tsconfig.json.\n -h, --help Show this help message.\n\nRuns TypeScript 7 first, then all enabled Resultar rules from tsconfig plugin options.\n`;\n\nconst failure = (error: Error): NoDiscardFailure => ({ error, ok: false });\nconst success = <Finding extends ResultarLintFinding>(\n findings: readonly Finding[],\n): { readonly findings: readonly Finding[]; readonly ok: true } => ({ findings, ok: true });\n\nconst cliError = (message: string): NoDiscardFailure => failure(new Error(message));\nconst requireFromPackage = createRequire(import.meta.url);\n\nconst isTypeScript7Version = (version: string): boolean => version.startsWith(\"7.\");\n\nconst resolvePackageFromRoot = (rootDir: string, specifier: string): string => {\n const requireFromRoot = createRequire(resolve(rootDir, \"package.json\"));\n\n try {\n return requireFromRoot.resolve(specifier);\n } catch {\n return requireFromPackage.resolve(specifier);\n }\n};\n\nconst readPackageVersion = (packageJson: string): string => {\n const parsed = JSON.parse(readFileSync(packageJson, \"utf8\")) as unknown;\n\n if (!isRecord(parsed) || typeof parsed.version !== \"string\") {\n throw new TypeError(`Unable to read package version from ${packageJson}`);\n }\n\n return parsed.version;\n};\n\nconst resolveOptionalPackage = (rootDir: string, specifier: string): string | undefined => {\n try {\n return resolvePackageFromRoot(rootDir, specifier);\n } catch {\n return undefined;\n }\n};\n\nconst resolveTypeScript7PackageJson = (\n rootDir: string,\n): NoDiscardFailure | { readonly ok: true; readonly packageJson: string } => {\n const candidates = [\"typescript/package.json\", \"typescript-7/package.json\"];\n\n for (const candidate of candidates) {\n const packageJson = resolveOptionalPackage(rootDir, candidate);\n\n if (packageJson !== undefined && isTypeScript7Version(readPackageVersion(packageJson))) {\n return { ok: true, packageJson };\n }\n }\n\n return failure(\n new Error(\n \"Unable to resolve TypeScript 7. Install typescript@rc or typescript-7@npm:typescript@rc in this project.\",\n ),\n );\n};\n\nconst parseArgs = (\n args: readonly string[],\n): NoDiscardFailure | { readonly ok: true; readonly options: CliOptions } => {\n let mode: ResultarNoDiscardMode | undefined = undefined;\n let project: string | undefined = undefined;\n let help = false;\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index];\n\n if (arg === \"--help\" || arg === \"-h\") {\n help = true;\n } else if (arg === \"--project\" || arg === \"-p\") {\n const nextArg = args[index + 1];\n\n if (nextArg === undefined || nextArg === \"\") {\n return cliError(`${arg} requires a path`);\n }\n\n project = nextArg;\n index += 1;\n } else if (arg !== undefined && arg.startsWith(\"--project=\")) {\n project = arg.slice(\"--project=\".length);\n } else if (arg === \"--mode\") {\n const nextArg = args[index + 1];\n\n if (nextArg === undefined || nextArg === \"\") {\n return cliError(\"--mode requires direct or must-use\");\n }\n\n if (nextArg !== \"direct\" && nextArg !== \"must-use\") {\n return cliError(`Unknown --mode value: ${nextArg}`);\n }\n\n mode = nextArg;\n index += 1;\n } else if (arg !== undefined && arg.startsWith(\"--mode=\")) {\n const nextMode = arg.slice(\"--mode=\".length);\n\n if (nextMode !== \"direct\" && nextMode !== \"must-use\") {\n return cliError(`Unknown --mode value: ${nextMode}`);\n }\n\n mode = nextMode;\n } else if (arg !== undefined && arg !== \"\") {\n return cliError(`Unknown argument: ${arg}`);\n }\n }\n\n if (project === \"\") {\n return cliError(\"--project requires a path\");\n }\n\n return project === undefined\n ? { ok: true, options: mode === undefined ? { help } : { help, mode } }\n : { ok: true, options: mode === undefined ? { help, project } : { help, mode, project } };\n};\n\nconst parseCheckArgs = (\n args: readonly string[],\n): NoDiscardFailure | { readonly ok: true; readonly options: ResultarCheckCliOptions } => {\n let mode: ResultarNoDiscardMode | undefined = undefined;\n let project: string | undefined = undefined;\n let help = false;\n const tscArgs: string[] = [];\n\n for (let index = 0; index < args.length; index += 1) {\n const arg = args[index];\n\n if (arg === undefined || arg === \"\") {\n continue;\n }\n\n if (arg === \"--help\" || arg === \"-h\") {\n help = true;\n continue;\n }\n\n if (arg === \"--mode\") {\n const nextArg = args[index + 1];\n\n if (nextArg === undefined || nextArg === \"\") {\n return cliError(\"--mode requires direct or must-use\");\n }\n\n if (nextArg !== \"direct\" && nextArg !== \"must-use\") {\n return cliError(`Unknown --mode value: ${nextArg}`);\n }\n\n mode = nextArg;\n index += 1;\n continue;\n }\n\n if (arg.startsWith(\"--mode=\")) {\n const nextMode = arg.slice(\"--mode=\".length);\n\n if (nextMode !== \"direct\" && nextMode !== \"must-use\") {\n return cliError(`Unknown --mode value: ${nextMode}`);\n }\n\n mode = nextMode;\n continue;\n }\n\n if (arg === \"--project\" || arg === \"-p\") {\n const nextArg = args[index + 1];\n\n if (nextArg === undefined || nextArg === \"\") {\n return cliError(`${arg} requires a path`);\n }\n\n project = nextArg;\n tscArgs.push(arg, nextArg);\n index += 1;\n continue;\n }\n\n if (arg.startsWith(\"--project=\")) {\n project = arg.slice(\"--project=\".length);\n }\n\n tscArgs.push(arg);\n }\n\n if (project === \"\") {\n return cliError(\"--project requires a path\");\n }\n\n if (project === undefined) {\n return { ok: true, options: mode === undefined ? { help, tscArgs } : { help, mode, tscArgs } };\n }\n\n return {\n ok: true,\n options: mode === undefined ? { help, project, tscArgs } : { help, mode, project, tscArgs },\n };\n};\n\nconst readProject = (\n tsApi: TypeScriptApi,\n projectPath: string,\n):\n | NoDiscardFailure\n | { readonly config: unknown; readonly ok: true; readonly parsed: ts.ParsedCommandLine } => {\n const formatHost: ts.FormatDiagnosticsHost = {\n getCanonicalFileName: (fileName) => fileName,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => \"\\n\",\n };\n const config = tsApi.readConfigFile(projectPath, (fileName) => tsApi.sys.readFile(fileName));\n\n if (config.error) {\n return failure(\n new Error(tsApi.formatDiagnosticsWithColorAndContext([config.error], formatHost)),\n );\n }\n\n const parsed = tsApi.parseJsonConfigFileContent(\n config.config,\n tsApi.sys,\n resolve(projectPath, \"..\"),\n undefined,\n projectPath,\n );\n\n if (parsed.errors.length > 0) {\n return failure(\n new Error(tsApi.formatDiagnosticsWithColorAndContext(parsed.errors, formatHost)),\n );\n }\n\n return { config: config.config, ok: true, parsed };\n};\n\nconst isRecord = (value: unknown): value is Record<PropertyKey, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst getProjectNoDiscardMode = (config: unknown): ResultarNoDiscardMode | undefined => {\n if (!isRecord(config) || !isRecord(config.compilerOptions)) {\n return undefined;\n }\n\n const { plugins } = config.compilerOptions;\n\n if (!Array.isArray(plugins)) {\n return undefined;\n }\n\n return findResultarPluginConfig(plugins)?.noDiscardMode;\n};\n\nconst getProjectRuleOptions = (config: unknown): Partial<ResultarRulesOptions> | undefined => {\n if (!isRecord(config) || !isRecord(config.compilerOptions)) {\n return undefined;\n }\n\n const { plugins } = config.compilerOptions;\n\n if (!Array.isArray(plugins)) {\n return undefined;\n }\n\n return findResultarPluginConfig(plugins);\n};\n\nconst resolveTypeScriptApi = (\n _rootDir: string,\n): NoDiscardFailure | { readonly ok: true; readonly tsApi: TypeScriptApi } => {\n try {\n return { ok: true, tsApi: requireFromPackage(\"typescript\") as TypeScriptApi };\n } catch {\n return failure(\n new Error(\n \"Unable to resolve the internal TypeScript diagnostics API bundled with resultar-check.\",\n ),\n );\n }\n};\n\nexport const findDiscardedResults = (options: NoDiscardOptions = {}): NoDiscardResult => {\n const rootDir = resolve(options.rootDir ?? process.cwd());\n const projectPath = resolve(rootDir, options.project ?? \"tsconfig.json\");\n const resolvedTypeScript = resolveTypeScriptApi(rootDir);\n\n if (!resolvedTypeScript.ok) {\n return resolvedTypeScript;\n }\n\n const { tsApi } = resolvedTypeScript;\n const project = readProject(tsApi, projectPath);\n\n if (!project.ok) {\n return project;\n }\n\n const program = tsApi.createProgram(project.parsed.fileNames, project.parsed.options);\n const findings = getProgramNoDiscardFindings(tsApi, program, {\n mode: normalizeNoDiscardMode(options.mode ?? getProjectNoDiscardMode(project.config)),\n });\n\n return success(findings);\n};\n\nexport const findResultarLintFindings = (options: ResultarLintOptions = {}): ResultarLintResult => {\n const rootDir = resolve(options.rootDir ?? process.cwd());\n const projectPath = resolve(rootDir, options.project ?? \"tsconfig.json\");\n const resolvedTypeScript = resolveTypeScriptApi(rootDir);\n\n if (!resolvedTypeScript.ok) {\n return resolvedTypeScript;\n }\n\n const { tsApi } = resolvedTypeScript;\n const project = readProject(tsApi, projectPath);\n\n if (!project.ok) {\n return project;\n }\n\n const projectRuleOptions = getProjectRuleOptions(project.config);\n const program = tsApi.createProgram(project.parsed.fileNames, project.parsed.options);\n const findings = getProgramResultarFindings(tsApi, program, {\n ...projectRuleOptions,\n ...options.rules,\n noDiscardMode: normalizeNoDiscardMode(\n options.mode ?? options.rules?.noDiscardMode ?? projectRuleOptions?.noDiscardMode,\n ),\n });\n\n return success(findings);\n};\n\nconst formatFinding = (finding: ResultarLintFinding, rootDir: string): string => {\n const file = relative(rootDir, finding.file);\n\n return [\n `${file}:${finding.line}:${finding.column} resultar/${finding.rule}`,\n finding.message,\n ].join(\" - \");\n};\n\nexport const runResultarLintCli = (args: readonly string[] = process.argv.slice(2)): number => {\n const rootDir = process.cwd();\n const parsedArgs = parseArgs(args);\n\n if (!parsedArgs.ok) {\n process.stderr.write(`${parsedArgs.error.message}\\n`);\n return 1;\n }\n\n if (parsedArgs.options.help) {\n process.stdout.write(usage);\n return 0;\n }\n\n const result =\n parsedArgs.options.project === undefined\n ? findResultarLintFindings({ mode: parsedArgs.options.mode, rootDir })\n : findResultarLintFindings({\n mode: parsedArgs.options.mode,\n project: parsedArgs.options.project,\n rootDir,\n });\n\n if (!result.ok) {\n process.stderr.write(`${result.error.message}\\n`);\n return 1;\n }\n\n if (result.findings.length === 0) {\n return 0;\n }\n\n process.stderr.write(\n `${result.findings.map((finding) => formatFinding(finding, rootDir)).join(\"\\n\")}\\n`,\n );\n\n return 1;\n};\n\nconst passthroughArgs = new Set([\"--version\", \"-v\"]);\n\nconst shouldSkipResultarDiagnostics = (args: readonly string[]): boolean =>\n args.some((arg) => passthroughArgs.has(arg));\n\nconst runNode = (script: string, args: readonly string[]): number => {\n const result = spawnSync(process.execPath, [script, ...args], { stdio: \"inherit\" });\n\n if (result.error !== undefined) {\n throw result.error;\n }\n\n return result.status ?? 1;\n};\n\nexport const runResultarCheckCli = (args: readonly string[] = process.argv.slice(2)): number => {\n const rootDir = process.cwd();\n const parsedArgs = parseCheckArgs(args);\n\n if (!parsedArgs.ok) {\n process.stderr.write(`${parsedArgs.error.message}\\n`);\n return 1;\n }\n\n if (parsedArgs.options.help) {\n process.stdout.write(usage);\n return 0;\n }\n\n const resolvedTypeScript = resolveTypeScript7PackageJson(rootDir);\n\n if (!resolvedTypeScript.ok) {\n process.stderr.write(`${resolvedTypeScript.error.message}\\n`);\n return 1;\n }\n\n const tscStatus = runNode(join(dirname(resolvedTypeScript.packageJson), \"bin/tsc\"), [\n ...parsedArgs.options.tscArgs,\n ]);\n\n if (tscStatus !== 0 || shouldSkipResultarDiagnostics(args)) {\n return tscStatus;\n }\n\n const result =\n parsedArgs.options.project === undefined\n ? findResultarLintFindings({ mode: parsedArgs.options.mode, rootDir })\n : findResultarLintFindings({\n mode: parsedArgs.options.mode,\n project: parsedArgs.options.project,\n rootDir,\n });\n\n if (!result.ok) {\n process.stderr.write(`${result.error.message}\\n`);\n return 1;\n }\n\n if (result.findings.length === 0) {\n return 0;\n }\n\n process.stderr.write(\n `${result.findings.map((finding) => formatFinding(finding, rootDir)).join(\"\\n\")}\\n`,\n );\n\n return 1;\n};\n"],"mappings":";;;;;AAsCA,MAAM,kBAAkB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,kBAAkB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,qBAAqB,IAAI,IAAI,CAAC,SAAS,OAAO,CAAC;AAErD,MAAMA,iCACJ,OACA,UAEC,KAAK,SAAS,MAAM,UAAU,QAAQ,MAAM,UAAU,mBAAmB,IACtE,KAAA,IACE,KAAoC,SAAS,CAAC;AAEtD,MAAM,iBAAiB,WAAsD;CAC3E,IAAI,WAAW,KAAA,GACb;CAGF,IAAI,OAAO,OAAO,YAAY,YAC5B,OAAO,OAAO,QAAQ;CAGxB,MAAM,EAAE,gBAAgB;CAExB,OAAO,OAAO,gBAAgB,WAAW,cAAc,K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G,WAAW,MAAM,QAAQ,GAAG;EACpD,OAAO;CACT;CAEA,IAAI,WAAW,QAAQ,MAAM;EAC3B,QAAQ,OAAO,MAAM,KAAK;EAC1B,OAAO;CACT;CAEA,MAAM,qBAAqB,8BAA8B,OAAO;CAEhE,IAAI,CAAC,mBAAmB,IAAI;EAC1B,QAAQ,OAAO,MAAM,GAAG,mBAAmB,MAAM,QAAQ,GAAG;EAC5D,OAAO;CACT;CAEA,MAAM,YAAY,QAAQ,KAAK,QAAQ,mBAAmB,WAAW,GAAG,SAAS,GAAG,CAClF,GAAG,WAAW,QAAQ,OACxB,CAAC;CAED,IAAI,cAAc,KAAK,8BAA8B,IAAI,GACvD,OAAO;CAGT,MAAM,SACJ,WAAW,QAAQ,YAAY,KAAA,IAC3B,yBAAyB;EAAE,MAAM,WAAW,QAAQ;EAAM;CAAQ,CAAC,IACnE,yBAAyB;EACvB,MAAM,WAAW,QAAQ;EACzB,SAAS,WAAW,QAAQ;EAC5B;CACF,CAAC;CAEP,IAAI,CAAC,OAAO,IAAI;EACd,QAAQ,OAAO,MAAM,GAAG,OAAO,MAAM,QAAQ,GAAG;EAChD,OAAO;CACT;CAEA,IAAI,OAAO,SAAS,WAAW,GAC7B,OAAO;CAGT,QAAQ,OAAO,MACb,GAAG,OAAO,SAAS,KAAK,YAAY,cAAc,SAAS,OAAO,CAAC,EAAE,KAAK,IAAI,EAAE,GAClF;CAEA,OAAO;AACT"}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "resultar-check",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript 7 diagnostics for Resultar",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"lint",
|
|
7
|
+
"no-discard",
|
|
8
|
+
"resultar",
|
|
9
|
+
"typescript"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/inaiat/resultar",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/inaiat/resultar/issues"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "inaiat@gmail.com",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/inaiat/resultar.git",
|
|
20
|
+
"directory": "packages/resultar-check"
|
|
21
|
+
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"resultar-check": "./dist/cli.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"type": "module",
|
|
31
|
+
"main": "dist/index.cjs",
|
|
32
|
+
"module": "dist/index.js",
|
|
33
|
+
"types": "dist/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"import": "./dist/index.js",
|
|
38
|
+
"require": "./dist/index.cjs",
|
|
39
|
+
"default": "./dist/index.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"typescript": "^6.0.3"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/node": "25.9.3",
|
|
47
|
+
"@vitest/coverage-v8": "4.1.9",
|
|
48
|
+
"@vitest/ui": "4.1.9",
|
|
49
|
+
"tsx": "4.22.4",
|
|
50
|
+
"typescript-7": "npm:typescript@rc",
|
|
51
|
+
"vite-plus": "0.1.24"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=24"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "vp pack",
|
|
58
|
+
"check": "vp check",
|
|
59
|
+
"check:full": "pnpm run build && pnpm run check && pnpm run test:cov",
|
|
60
|
+
"fmt": "vp fmt",
|
|
61
|
+
"fmt:check": "vp fmt --check",
|
|
62
|
+
"smoke:package": "pnpm run build && tsx scripts/smoke-package.ts",
|
|
63
|
+
"test": "pnpm run build && vp test run",
|
|
64
|
+
"test:cov": "pnpm run build && vp test run --coverage",
|
|
65
|
+
"test:ui": "pnpm run build && vp test --ui --watch",
|
|
66
|
+
"test:watch": "pnpm run build && vp test watch"
|
|
67
|
+
}
|
|
68
|
+
}
|