@imapps/oxc-config 0.0.0-stage → 7.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.
Files changed (43) hide show
  1. package/README.md +65 -2
  2. package/anti-slop/LICENSE +21 -0
  3. package/anti-slop/UPSTREAM-IMAPPS.md +11 -0
  4. package/anti-slop/index.ts +47 -0
  5. package/anti-slop/rules/no-array-filter-map.ts +28 -0
  6. package/anti-slop/rules/no-chained-type-assertions.ts +77 -0
  7. package/anti-slop/rules/no-conditional-empty-object-spread.ts +49 -0
  8. package/anti-slop/rules/no-known-value-widening.ts +415 -0
  9. package/anti-slop/rules/no-module-mocking.ts +80 -0
  10. package/anti-slop/rules/no-object-parameters.ts +83 -0
  11. package/anti-slop/rules/no-reduce-accumulator-copy.ts +109 -0
  12. package/anti-slop/rules/no-reflect-apply.ts +28 -0
  13. package/anti-slop/rules/no-reflect-get.ts +28 -0
  14. package/anti-slop/rules/no-runtime-typeof.ts +77 -0
  15. package/anti-slop/rules/no-shape-in-symbol-names.ts +46 -0
  16. package/anti-slop/rules/no-unknown-parameters.ts +69 -0
  17. package/anti-slop/rules/no-unknown-returns.ts +82 -0
  18. package/anti-slop/rules/no-unknown-type-aliases.ts +54 -0
  19. package/anti-slop/rules/no-unsafe-dictionary-type.ts +154 -0
  20. package/anti-slop/rules/no-widen-then-assert.ts +366 -0
  21. package/anti-slop/rules/require-readable-spacing.ts +80 -0
  22. package/anti-slop/rules/require-safety-comment-for-type-assertion.ts +131 -0
  23. package/anti-slop/shared/array-method.ts +94 -0
  24. package/anti-slop/shared/dictionary-types.ts +515 -0
  25. package/anti-slop/shared/function-parameters.ts +49 -0
  26. package/anti-slop/shared/lexical-type-parameters.ts +61 -0
  27. package/anti-slop/shared/reflect-method.ts +24 -0
  28. package/anti-slop/shared/scope.ts +15 -0
  29. package/anti-slop/shared/type-alias-resolution.ts +250 -0
  30. package/anti-slop/vendor/eslint-stylistic/LICENSE +22 -0
  31. package/anti-slop/vendor/eslint-stylistic/UPSTREAM.md +28 -0
  32. package/anti-slop/vendor/eslint-stylistic/padding-line-ast.ts +51 -0
  33. package/anti-slop/vendor/eslint-stylistic/padding-line-between-statements.ts +929 -0
  34. package/anti-slop/vendor/eslint-stylistic/padding-line-options.d.ts +87 -0
  35. package/build/anti-slop.js +2569 -0
  36. package/build/anti-slop.js.map +1 -0
  37. package/build/oxfmt.d.ts +24 -0
  38. package/build/oxfmt.js +37 -0
  39. package/build/oxfmt.js.map +1 -0
  40. package/build/oxlint.d.ts +44 -0
  41. package/build/oxlint.js +57 -0
  42. package/build/oxlint.js.map +1 -0
  43. package/package.json +52 -4
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../anti-slop/index.ts","../anti-slop/rules/no-array-filter-map.ts","../anti-slop/shared/array-method.ts","../anti-slop/rules/no-reduce-accumulator-copy.ts","../anti-slop/rules/no-chained-type-assertions.ts","../anti-slop/rules/no-conditional-empty-object-spread.ts","../anti-slop/rules/no-known-value-widening.ts","../anti-slop/shared/lexical-type-parameters.ts","../anti-slop/shared/type-alias-resolution.ts","../anti-slop/shared/dictionary-types.ts","../anti-slop/shared/function-parameters.ts","../anti-slop/shared/scope.ts","../anti-slop/rules/no-module-mocking.ts","../anti-slop/rules/no-object-parameters.ts","../anti-slop/rules/no-reflect-apply.ts","../anti-slop/shared/reflect-method.ts","../anti-slop/rules/no-reflect-get.ts","../anti-slop/rules/no-runtime-typeof.ts","../anti-slop/rules/no-shape-in-symbol-names.ts","../anti-slop/rules/no-unknown-parameters.ts","../anti-slop/rules/no-unknown-returns.ts","../anti-slop/rules/no-unknown-type-aliases.ts","../anti-slop/rules/no-unsafe-dictionary-type.ts","../anti-slop/rules/no-widen-then-assert.ts","../anti-slop/vendor/eslint-stylistic/padding-line-ast.ts","../anti-slop/vendor/eslint-stylistic/padding-line-between-statements.ts","../anti-slop/rules/require-readable-spacing.ts","../anti-slop/rules/require-safety-comment-for-type-assertion.ts"],"sourcesContent":["import { eslintCompatPlugin } from \"@oxlint/plugins\";\n\nimport { noArrayFilterMapRule } from \"./rules/no-array-filter-map.ts\";\nimport { noReduceAccumulatorCopyRule } from \"./rules/no-reduce-accumulator-copy.ts\";\nimport { noChainedTypeAssertionsRule } from \"./rules/no-chained-type-assertions.ts\";\nimport { noConditionalEmptyObjectSpreadRule } from \"./rules/no-conditional-empty-object-spread.ts\";\nimport { noKnownValueWideningRule } from \"./rules/no-known-value-widening.ts\";\nimport { noModuleMockingRule } from \"./rules/no-module-mocking.ts\";\nimport { noObjectParametersRule } from \"./rules/no-object-parameters.ts\";\nimport { noReflectApplyRule } from \"./rules/no-reflect-apply.ts\";\nimport { noReflectGetRule } from \"./rules/no-reflect-get.ts\";\nimport { noRuntimeTypeofRule } from \"./rules/no-runtime-typeof.ts\";\nimport { noForbiddenTermInSymbolNamesRule } from \"./rules/no-shape-in-symbol-names.ts\";\nimport { noUnknownParametersRule } from \"./rules/no-unknown-parameters.ts\";\nimport { noUnknownReturnsRule } from \"./rules/no-unknown-returns.ts\";\nimport { noUnknownTypeAliasesRule } from \"./rules/no-unknown-type-aliases.ts\";\nimport { noUnsafeDictionaryTypeRule } from \"./rules/no-unsafe-dictionary-type.ts\";\nimport { noWidenThenAssertRule } from \"./rules/no-widen-then-assert.ts\";\nimport { requireReadableSpacingRule } from \"./rules/require-readable-spacing.ts\";\nimport { requireSafetyCommentForTypeAssertionRule } from \"./rules/require-safety-comment-for-type-assertion.ts\";\n\n/** Generic Oxlint rules that reject low-evidence and low-signal implementation patterns. */\nconst antiSlopPlugin = eslintCompatPlugin({\n\tmeta: { name: \"anti-slop\" },\n\trules: {\n\t\t\"no-array-filter-map\": noArrayFilterMapRule,\n\t\t\"no-reduce-accumulator-copy\": noReduceAccumulatorCopyRule,\n\t\t\"no-chained-type-assertions\": noChainedTypeAssertionsRule,\n\t\t\"no-conditional-empty-object-spread\": noConditionalEmptyObjectSpreadRule,\n\t\t\"no-known-value-widening\": noKnownValueWideningRule,\n\t\t\"no-module-mocking\": noModuleMockingRule,\n\t\t\"no-object-parameters\": noObjectParametersRule,\n\t\t\"no-reflect-apply\": noReflectApplyRule,\n\t\t\"no-reflect-get\": noReflectGetRule,\n\t\t\"no-runtime-typeof\": noRuntimeTypeofRule,\n\t\t\"no-unsafe-dictionary-type\": noUnsafeDictionaryTypeRule,\n\t\t\"no-shape-in-symbol-names\": noForbiddenTermInSymbolNamesRule,\n\t\t\"no-unknown-parameters\": noUnknownParametersRule,\n\t\t\"no-unknown-returns\": noUnknownReturnsRule,\n\t\t\"no-unknown-type-aliases\": noUnknownTypeAliasesRule,\n\t\t\"no-widen-then-assert\": noWidenThenAssertRule,\n\t\t\"require-readable-spacing\": requireReadableSpacingRule,\n\t\t\"require-safety-comment-for-type-assertion\": requireSafetyCommentForTypeAssertionRule,\n\t},\n});\n\nexport default antiSlopPlugin;\n","import { defineRule } from \"@oxlint/plugins\";\n\nimport { arrayMethodTarget, isKnownArrayExpression, unwrapArrayExpression } from \"../shared/array-method.ts\";\n\n/** Reject eager array filter/map pipelines; lazy iterator helpers remain allowed. */\nexport const noArrayFilterMapRule = defineRule({\n meta: {\n type: \"suggestion\",\n docs: { description: \"Disallow adjacent array filter/map passes in favor of lazy iterator helpers or a single transformation.\" },\n messages: {\n arrayFilterMap: \"Avoid consecutive array `{{first}}` and `{{second}}` passes. Prefer `.values().{{first}}(...).{{second}}(...).toArray()` where iterator helpers are supported, or a single `flatMap`/mutating reducer. Preserve callback ordering, indexes, and filtering semantics.\",\n },\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n const outer = arrayMethodTarget(node.callee);\n if (outer === null || (outer.name !== \"map\" && outer.name !== \"filter\")) return;\n const innerCall = unwrapArrayExpression(outer.object);\n if (innerCall.type !== \"CallExpression\") return;\n const inner = arrayMethodTarget(innerCall.callee);\n if (inner === null || inner.name !== (outer.name === \"map\" ? \"filter\" : \"map\")) return;\n if (!isKnownArrayExpression(context.sourceCode, inner.object)) return;\n context.report({ node, messageId: \"arrayFilterMap\", data: { first: inner.name, second: outer.name } });\n },\n };\n },\n});\n","import type { ESTree, Scope, SourceCode, Variable } from \"@oxlint/plugins\";\n\n/** Unwrap syntax-only wrappers when inspecting array methods and accumulator references. */\nexport function unwrapArrayExpression(node: ESTree.Node): ESTree.Node {\n while (\n node.type === \"ParenthesizedExpression\" ||\n node.type === \"ChainExpression\" ||\n node.type === \"TSAsExpression\" ||\n node.type === \"TSTypeAssertion\" ||\n node.type === \"TSNonNullExpression\" ||\n node.type === \"TSSatisfiesExpression\"\n ) {\n node = node.expression;\n }\n return node;\n}\n\n/** Resolve a local binding by scope, not by identifier spelling. */\nexport function resolveArrayBinding(sourceCode: SourceCode, node: ESTree.Node): Variable | null {\n node = unwrapArrayExpression(node);\n if (node.type !== \"Identifier\") return null;\n let scope: Scope | null = sourceCode.getScope(node);\n while (scope !== null) {\n const variable = scope.set.get(node.name);\n if (variable !== undefined) return variable;\n scope = scope.upper;\n }\n return null;\n}\n\n/** Read static method names, including computed string literals, without evaluating expressions. */\nexport function arrayMethodTarget(\n node: ESTree.Node,\n): { readonly name: string; readonly object: ESTree.Node } | null {\n node = unwrapArrayExpression(node);\n if (node.type !== \"MemberExpression\") return null;\n const property = node.property;\n if (!node.computed && property.type === \"Identifier\") {\n return { name: property.name, object: node.object };\n }\n if (node.computed && property.type === \"Literal\" && typeof property.value === \"string\") {\n return { name: property.value, object: node.object };\n }\n return null;\n}\n\nfunction isArrayAnnotation(type: ESTree.TSType): boolean {\n if (type.type === \"TSArrayType\" || type.type === \"TSTupleType\") return true;\n if (type.type === \"TSParenthesizedType\") return isArrayAnnotation(type.typeAnnotation);\n if (type.type === \"TSTypeOperator\" && type.operator === \"readonly\") {\n return isArrayAnnotation(type.typeAnnotation);\n }\n return (\n type.type === \"TSTypeReference\" && type.typeName.type === \"Identifier\" &&\n (type.typeName.name === \"Array\" || type.typeName.name === \"ReadonlyArray\")\n );\n}\n\n/** Recognize local array evidence; unknown receivers and iterator pipelines are deliberately excluded. */\nexport function isKnownArrayExpression(\n sourceCode: SourceCode,\n node: ESTree.Node,\n visited = new Set<Variable>(),\n): boolean {\n node = unwrapArrayExpression(node);\n if (node.type === \"ArrayExpression\") return true;\n if (node.type === \"CallExpression\") {\n const method = arrayMethodTarget(node.callee);\n return (\n method !== null &&\n [\"map\", \"filter\", \"flatMap\", \"slice\", \"concat\", \"toSorted\", \"toReversed\", \"toSpliced\"].includes(method.name) &&\n isKnownArrayExpression(sourceCode, method.object, visited)\n );\n }\n if (node.type !== \"Identifier\") return false;\n const variable = resolveArrayBinding(sourceCode, node);\n if (variable === null || visited.has(variable)) return false;\n visited.add(variable);\n if (variable.references.some(reference => reference.isWrite() && !reference.init)) return false;\n for (const identifier of variable.identifiers) {\n const annotation = identifier.typeAnnotation?.typeAnnotation;\n if (annotation !== undefined) return isArrayAnnotation(annotation);\n }\n for (const definition of variable.defs) {\n if (\n definition.type === \"Variable\" && definition.node.type === \"VariableDeclarator\" &&\n definition.node.id.type === \"Identifier\" && definition.node.init !== null &&\n definition.node.parent.type === \"VariableDeclaration\" && definition.node.parent.kind === \"const\"\n ) {\n return isKnownArrayExpression(sourceCode, definition.node.init, visited);\n }\n }\n return false;\n}\n","import { defineRule } from \"@oxlint/plugins\";\nimport type { ESTree, SourceCode, Variable } from \"@oxlint/plugins\";\n\nimport {\n arrayMethodTarget,\n isKnownArrayExpression,\n resolveArrayBinding,\n unwrapArrayExpression,\n} from \"../shared/array-method.ts\";\n\nfunction enclosingReducer(node: ESTree.Node) {\n let parent = node.parent;\n while (parent !== null) {\n if (parent.type === \"FunctionDeclaration\") return null;\n if (parent.type === \"ArrowFunctionExpression\" || parent.type === \"FunctionExpression\") {\n const callback = parent;\n let owner: ESTree.Node | null = callback.parent;\n while (owner !== null && unwrapArrayExpression(owner) === callback) owner = owner.parent;\n if (owner?.type !== \"CallExpression\") return null;\n const method = arrayMethodTarget(owner.callee);\n const firstArgument = owner.arguments[0];\n if (\n method === null || (method.name !== \"reduce\" && method.name !== \"reduceRight\") ||\n owner.arguments.length > 2 || firstArgument === undefined ||\n unwrapArrayExpression(firstArgument) !== callback\n ) return null;\n const firstParameter = callback.params[0];\n const accumulator = firstParameter?.type === \"AssignmentPattern\" ? firstParameter.left : firstParameter;\n if (accumulator?.type !== \"Identifier\") return null;\n return { callback, accumulator, initialValue: owner.arguments[1] };\n }\n parent = parent.parent;\n }\n return null;\n}\n\nfunction referencesAccumulator(\n sourceCode: SourceCode,\n node: ESTree.Node,\n accumulator: Variable,\n visited = new Set<Variable>(),\n): boolean {\n const variable = resolveArrayBinding(sourceCode, node);\n if (variable === null || visited.has(variable)) return false;\n if (variable === accumulator) return true;\n visited.add(variable);\n if (variable.references.some(reference => reference.isWrite() && !reference.init)) return false;\n for (const definition of variable.defs) {\n if (\n definition.type === \"Variable\" && definition.node.type === \"VariableDeclarator\" &&\n definition.node.id.type === \"Identifier\" && definition.node.init !== null &&\n definition.node.parent.type === \"VariableDeclaration\" && definition.node.parent.kind === \"const\"\n ) {\n return referencesAccumulator(sourceCode, definition.node.init, accumulator, visited);\n }\n }\n return false;\n}\n\nfunction isGlobalCopyOwner(sourceCode: SourceCode, node: ESTree.Node, name: string): boolean {\n node = unwrapArrayExpression(node);\n if (node.type !== \"Identifier\" || node.name !== name) return false;\n const variable = resolveArrayBinding(sourceCode, node);\n return variable === null || variable.defs.length === 0;\n}\n\n/** Reject non-spread copies of reducer accumulators; pair with oxc/no-accumulating-spread. */\nexport const noReduceAccumulatorCopyRule = defineRule({\n meta: {\n type: \"problem\",\n docs: { description: \"Disallow copying growing reducer accumulators with Object.assign, Array.from, or array copy methods.\" },\n messages: {\n accumulatorCopy: \"Do not copy the reducer accumulator on every iteration; growing copies can cause quadratic work. Mutate a fresh, locally owned accumulator and return it, or use an iterator pipeline/flatMap.\",\n },\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n const method = arrayMethodTarget(node.callee);\n if (method === null) return;\n const reducer = enclosingReducer(node);\n if (reducer === null) return;\n const accumulator = context.sourceCode.getDeclaredVariables(reducer.callback).find(variable =>\n variable.identifiers.some(identifier => identifier.start === reducer.accumulator.start),\n );\n if (accumulator === undefined) return;\n const isAccumulator = (expression: ESTree.Node) =>\n referencesAccumulator(context.sourceCode, expression, accumulator);\n let copiesAccumulator = false;\n if (method.name === \"assign\" && isGlobalCopyOwner(context.sourceCode, method.object, \"Object\")) {\n const target = node.arguments[0];\n copiesAccumulator = (\n target !== undefined && unwrapArrayExpression(target).type === \"ObjectExpression\" &&\n node.arguments.slice(1).some(isAccumulator)\n );\n } else if (method.name === \"from\" && isGlobalCopyOwner(context.sourceCode, method.object, \"Array\")) {\n const source = node.arguments[0];\n copiesAccumulator = source !== undefined && isAccumulator(source);\n } else if ([\"concat\", \"slice\", \"toSpliced\", \"toSorted\", \"toReversed\", \"with\"].includes(method.name)) {\n const initialValue = reducer.initialValue;\n const arrayAccumulator = initialValue !== undefined &&\n isKnownArrayExpression(context.sourceCode, initialValue);\n copiesAccumulator = arrayAccumulator && isAccumulator(method.object);\n }\n if (copiesAccumulator) context.report({ node, messageId: \"accumulatorCopy\" });\n },\n };\n },\n});\n","import { defineRule } from \"@oxlint/plugins\";\nimport type { ESTree } from \"@oxlint/plugins\";\n\ntype TypeAssertionExpression = ESTree.TSAsExpression | ESTree.TSTypeAssertion;\n\nfunction isTypeAssertionExpression(node: ESTree.Node): node is TypeAssertionExpression {\n return node.type === \"TSAsExpression\" || node.type === \"TSTypeAssertion\";\n}\n\nfunction unwrapParenthesizedExpression(expression: ESTree.Expression): ESTree.Expression {\n let current = expression;\n while (current.type === \"ParenthesizedExpression\") {\n current = current.expression;\n }\n return current;\n}\n\nfunction isConstAssertion(node: TypeAssertionExpression): boolean {\n const { typeAnnotation } = node;\n return (\n typeAnnotation.type === \"TSTypeReference\" &&\n typeAnnotation.typeName.type === \"Identifier\" &&\n typeAnnotation.typeName.name === \"const\"\n );\n}\n\nfunction isOutermostAssertionInChain(node: TypeAssertionExpression): boolean {\n let current: ESTree.Expression = node;\n let parent = node.parent;\n\n while (parent.type === \"ParenthesizedExpression\" && parent.expression === current) {\n current = parent;\n parent = parent.parent;\n }\n\n return !isTypeAssertionExpression(parent) || parent.expression !== current;\n}\n\nfunction isForbiddenAssertionChain(node: TypeAssertionExpression): boolean {\n let assertionCount = 0;\n let hasNonConstAssertion = false;\n let current: ESTree.Expression = node;\n\n while (isTypeAssertionExpression(current)) {\n assertionCount += 1;\n hasNonConstAssertion ||= !isConstAssertion(current);\n current = unwrapParenthesizedExpression(current.expression);\n }\n\n return assertionCount > 1 && hasNonConstAssertion;\n}\n\n/** Disallow nested TypeScript type assertions, while permitting chains made only of const assertions. */\nexport const noChainedTypeAssertionsRule = defineRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow chained TypeScript as and angle-bracket assertions, including parenthesized chains.\",\n },\n messages: {\n chained:\n \"This assertion chain discards type evidence. Keep the original precise type, or parse untrusted input at its boundary before narrowing it.\",\n },\n },\n createOnce(context) {\n const checkTypeAssertion = (node: TypeAssertionExpression) => {\n if (!isOutermostAssertionInChain(node) || !isForbiddenAssertionChain(node)) return;\n context.report({ node, messageId: \"chained\" });\n };\n\n return {\n TSAsExpression: checkTypeAssertion,\n TSTypeAssertion: checkTypeAssertion,\n };\n },\n});\n","import { defineRule } from \"@oxlint/plugins\";\nimport type { ESTree } from \"@oxlint/plugins\";\n\nfunction unwrapParentheses(node: ESTree.Expression): ESTree.Expression {\n let current = node;\n while (current.type === \"ParenthesizedExpression\") {\n current = current.expression;\n }\n return current;\n}\n\nfunction isEmptyObjectExpression(node: ESTree.Expression): boolean {\n return node.type === \"ObjectExpression\" && node.properties.length === 0;\n}\n\nfunction isConditionalEmptyObjectSpread(node: ESTree.Expression): boolean {\n const conditional = unwrapParentheses(node);\n return (\n conditional.type === \"ConditionalExpression\" &&\n (isEmptyObjectExpression(conditional.consequent) ||\n isEmptyObjectExpression(conditional.alternate))\n );\n}\n\n/** Ban conditional empty-object spreads without changing their omission semantics. */\nexport const noConditionalEmptyObjectSpreadRule = defineRule({\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Disallow object spreads that conditionally spread an empty object to omit fields.\",\n },\n messages: {\n avoid:\n \"This conditional spread hides property omission behind an empty object. Build the object in separate statements and add the property only when present.\",\n },\n },\n createOnce(context) {\n return {\n SpreadElement(node) {\n if (node.parent.type !== \"ObjectExpression\") return;\n\n if (isConditionalEmptyObjectSpread(node.argument)) {\n context.report({ node, messageId: \"avoid\" });\n }\n },\n };\n },\n});\n","import { defineRule } from \"@oxlint/plugins\";\n\nimport {\n\tclassifyUnsafeDictionaryValue,\n\tclassifyWideningTarget,\n\tcreateTypeEnvironment,\n\tisKnownEvidenceExpression,\n\ttype TypeEnvironment,\n\ttype WideningTarget,\n} from \"../shared/dictionary-types.ts\";\nimport {\n\tcontainsUnknownType,\n\tfunctionParameterBindingName,\n\tfunctionParameterTypeAnnotation,\n} from \"../shared/function-parameters.ts\";\nimport { resolveVariable } from \"../shared/scope.ts\";\n\nimport type { ESTree, SourceCode, Variable } from \"@oxlint/plugins\";\n\ntype FunctionExpression = ESTree.ArrowFunctionExpression | ESTree.Function;\n\nfunction unwrapExpression(expression: ESTree.Expression): ESTree.Expression {\n\tlet current = expression;\n\twhile (\n\t\tcurrent.type === \"ParenthesizedExpression\" ||\n\t\tcurrent.type === \"TSAsExpression\" ||\n\t\tcurrent.type === \"TSSatisfiesExpression\" ||\n\t\tcurrent.type === \"TSTypeAssertion\" ||\n\t\tcurrent.type === \"TSNonNullExpression\"\n\t) {\n\t\tcurrent = current.expression;\n\t}\n\treturn current;\n}\n\nfunction variableDeclarator(variable: Variable): ESTree.VariableDeclarator | null {\n\tif (variable.defs.length !== 1) return null;\n\tconst [definition] = variable.defs;\n\treturn definition?.type === \"Variable\" && definition.node.type === \"VariableDeclarator\"\n\t\t? definition.node\n\t\t: null;\n}\n\nfunction isStableConstVariable(variable: Variable, declarator: ESTree.VariableDeclarator): boolean {\n\treturn (\n\t\tdeclarator.parent.type === \"VariableDeclaration\" &&\n\t\tdeclarator.parent.kind === \"const\" &&\n\t\tvariable.references.every((reference) => reference.init || !reference.isWrite())\n\t);\n}\n\nfunction hasKnownEvidence(\n\tsourceCode: SourceCode,\n\texpression: ESTree.Expression,\n\tvisitedVariables = new Set<Variable>(),\n): boolean {\n\tif (isKnownEvidenceExpression(expression)) return true;\n\tconst unwrapped = unwrapExpression(expression);\n\tif (unwrapped.type !== \"Identifier\") return false;\n\tconst variable = resolveVariable(sourceCode, unwrapped);\n\tif (variable === null || visitedVariables.has(variable)) return false;\n\tconst declarator = variableDeclarator(variable);\n\tif (\n\t\tdeclarator === null ||\n\t\tdeclarator.init === null ||\n\t\t!isStableConstVariable(variable, declarator)\n\t) {\n\t\treturn false;\n\t}\n\tvisitedVariables.add(variable);\n\treturn hasKnownEvidence(sourceCode, declarator.init, visitedVariables);\n}\n\nfunction isFunctionExpression(node: ESTree.Node): node is FunctionExpression {\n\treturn (\n\t\tnode.type === \"ArrowFunctionExpression\" ||\n\t\tnode.type === \"FunctionDeclaration\" ||\n\t\tnode.type === \"FunctionExpression\" ||\n\t\tnode.type === \"TSDeclareFunction\" ||\n\t\tnode.type === \"TSEmptyBodyFunctionExpression\"\n\t);\n}\n\nfunction localFunctionForCall(\n\tsourceCode: SourceCode,\n\tcallee: ESTree.Expression,\n): FunctionExpression | null {\n\tconst unwrapped = unwrapExpression(callee);\n\tif (isFunctionExpression(unwrapped)) return unwrapped;\n\tif (unwrapped.type !== \"Identifier\") return null;\n\tconst variable = resolveVariable(sourceCode, unwrapped);\n\tif (variable === null || variable.defs.length !== 1) return null;\n\tconst [definition] = variable.defs;\n\tif (definition === undefined) return null;\n\tif (definition.type === \"FunctionName\" && isFunctionExpression(definition.node)) {\n\t\treturn definition.node;\n\t}\n\tif (definition.type !== \"Variable\" || definition.node.type !== \"VariableDeclarator\") {\n\t\treturn null;\n\t}\n\tconst initializer = definition.node.init;\n\tif (initializer === null) return null;\n\tconst unwrappedInitializer = unwrapExpression(initializer);\n\treturn isFunctionExpression(unwrappedInitializer) ? unwrappedInitializer : null;\n}\n\nfunction variableTypeAnnotation(\n\tsourceCode: SourceCode,\n\tvariable: Variable,\n): ESTree.TSTypeAnnotation | null {\n\tif (variable.defs.length !== 1) return null;\n\tconst [definition] = variable.defs;\n\tif (definition === undefined) return null;\n\tif (\n\t\tdefinition.type === \"Variable\" &&\n\t\tdefinition.node.type === \"VariableDeclarator\" &&\n\t\tdefinition.node.id.type === \"Identifier\"\n\t) {\n\t\treturn definition.node.id.typeAnnotation ?? null;\n\t}\n\tif (definition.type !== \"Parameter\" || !isFunctionExpression(definition.node)) {\n\t\treturn null;\n\t}\n\tconst parameter = definition.node.params.find(\n\t\t(candidate) =>\n\t\t\tfunctionParameterBindingName(candidate, sourceCode) === variable.name,\n\t);\n\treturn parameter === undefined ? null : (functionParameterTypeAnnotation(parameter) ?? null);\n}\n\nfunction hasInformativeType(\n\ttype: ESTree.TSType,\n\tenvironment: TypeEnvironment,\n): boolean {\n\treturn classifyUnsafeDictionaryValue(type, environment) === null;\n}\n\nfunction hasKnownCallArgumentEvidence(\n\tsourceCode: SourceCode,\n\texpression: ESTree.Expression,\n\tenvironment: TypeEnvironment,\n\tvisitedVariables = new Set<Variable>(),\n): boolean {\n\tif (expression.type === \"ParenthesizedExpression\" || expression.type === \"TSNonNullExpression\") {\n\t\treturn hasKnownCallArgumentEvidence(\n\t\t\tsourceCode,\n\t\t\texpression.expression,\n\t\t\tenvironment,\n\t\t\tvisitedVariables,\n\t\t);\n\t}\n\tif (expression.type === \"TSAsExpression\" || expression.type === \"TSTypeAssertion\") {\n\t\treturn hasInformativeType(expression.typeAnnotation, environment);\n\t}\n\tif (expression.type === \"TSSatisfiesExpression\") {\n\t\treturn hasKnownCallArgumentEvidence(\n\t\t\tsourceCode,\n\t\t\texpression.expression,\n\t\t\tenvironment,\n\t\t\tvisitedVariables,\n\t\t);\n\t}\n\tif (expression.type === \"CallExpression\") {\n\t\tconst owner = localFunctionForCall(sourceCode, expression.callee);\n\t\tconst returnType = owner?.returnType?.typeAnnotation;\n\t\treturn returnType !== undefined && hasInformativeType(returnType, environment);\n\t}\n\tif (expression.type !== \"Identifier\") return isKnownEvidenceExpression(expression);\n\tconst variable = resolveVariable(sourceCode, expression);\n\tif (variable === null || visitedVariables.has(variable)) return false;\n\tconst annotation = variableTypeAnnotation(sourceCode, variable);\n\tif (annotation !== null) {\n\t\treturn hasInformativeType(annotation.typeAnnotation, environment);\n\t}\n\tconst declarator = variableDeclarator(variable);\n\tif (\n\t\tdeclarator === null ||\n\t\tdeclarator.init === null ||\n\t\t!isStableConstVariable(variable, declarator)\n\t) {\n\t\treturn false;\n\t}\n\tvisitedVariables.add(variable);\n\treturn hasKnownCallArgumentEvidence(\n\t\tsourceCode,\n\t\tdeclarator.init,\n\t\tenvironment,\n\t\tvisitedVariables,\n\t);\n}\n\nfunction typePredicateSubjectIndex(\n\tsourceCode: SourceCode,\n\towner: FunctionExpression,\n): number | null {\n\tconst predicate = owner.returnType?.typeAnnotation;\n\tif (predicate?.type !== \"TSTypePredicate\" || predicate.parameterName.type !== \"Identifier\") {\n\t\treturn null;\n\t}\n\tconst predicateParameterName = predicate.parameterName.name;\n\tconst index = owner.params.findIndex(\n\t\t(parameter) =>\n\t\t\tfunctionParameterBindingName(parameter, sourceCode) === predicateParameterName,\n\t);\n\treturn index === -1 ? null : index;\n}\n\nfunction annotationTarget(\n\tannotation: ESTree.TSTypeAnnotation | null | undefined,\n\tenvironment: TypeEnvironment,\n): WideningTarget | null {\n\treturn annotation === null || annotation === undefined\n\t\t? null\n\t\t: classifyWideningTarget(annotation.typeAnnotation, environment);\n}\n\nfunction enclosingFunction(node: ESTree.Node): FunctionExpression | null {\n\tlet current: ESTree.Node | null = node.parent;\n\twhile (current !== null && current.type !== \"Program\") {\n\t\tif (\n\t\t\tcurrent.type === \"ArrowFunctionExpression\" ||\n\t\t\tcurrent.type === \"FunctionDeclaration\" ||\n\t\t\tcurrent.type === \"FunctionExpression\"\n\t\t) {\n\t\t\treturn current;\n\t\t}\n\t\tcurrent = current.parent;\n\t}\n\treturn null;\n}\n\nfunction sourceKeyName(sourceCode: SourceCode, key: ESTree.PropertyKey): string {\n\tif (key.type === \"Identifier\" || key.type === \"PrivateIdentifier\") return key.name;\n\tif (key.type === \"Literal\") return String(key.value);\n\treturn sourceCode.getText(key);\n}\n\nfunction functionName(sourceCode: SourceCode, owner: FunctionExpression | null): string {\n\tif (owner === null) return \"anonymous function\";\n\tif (owner.id !== null) return owner.id.name;\n\tconst parent = owner.parent;\n\tif (parent.type === \"VariableDeclarator\" && parent.id.type === \"Identifier\")\n\t\treturn parent.id.name;\n\tif (parent.type === \"MethodDefinition\") return sourceKeyName(sourceCode, parent.key);\n\treturn \"anonymous function\";\n}\n\nfunction isEmptyObjectExpression(expression: ESTree.Expression): boolean {\n\tconst unwrapped = unwrapExpression(expression);\n\treturn unwrapped.type === \"ObjectExpression\" && unwrapped.properties.length === 0;\n}\n\nfunction isDictionaryAccumulatorTarget(destination: WideningTarget): boolean {\n\treturn destination.kind === \"open dictionary\" || destination.kind === \"generic container\";\n}\n\nfunction hasParentAssertion(node: ESTree.Node): boolean {\n\treturn node.parent?.type === \"TSAsExpression\" || node.parent?.type === \"TSTypeAssertion\";\n}\n\n/** Detect sound syntactic cases where a known value is explicitly widened and loses evidence. */\nexport const noKnownValueWideningRule = defineRule({\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow syntactically established values from flowing into explicitly broad or anonymous target types that discard useful evidence.\",\n\t\t},\n\t\tmessages: {\n\t\t\twidening:\n\t\t\t\t\"The explicit {{target}} type on {{subject}} discards known type evidence. Keep inference, validate with `satisfies`, or use a named owner contract.\",\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tlet environment: TypeEnvironment | null = null;\n\n\t\tconst reportFlow = (\n\t\t\texpression: ESTree.Expression,\n\t\t\tdestination: WideningTarget | null,\n\t\t\tsubject: string,\n\t\t) => {\n\t\t\tif (destination === null) return;\n\t\t\tif (\n\t\t\t\tisDictionaryAccumulatorTarget(destination) &&\n\t\t\t\tisEmptyObjectExpression(expression)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!hasKnownEvidence(context.sourceCode, expression)) return;\n\t\t\tcontext.report({\n\t\t\t\tnode: expression,\n\t\t\t\tmessageId: \"widening\",\n\t\t\t\tdata: { subject, target: destination.kind },\n\t\t\t});\n\t\t};\n\n\t\tconst targetFromAnnotation = (annotation: ESTree.TSTypeAnnotation | null | undefined) =>\n\t\t\tenvironment === null ? null : annotationTarget(annotation, environment);\n\n\t\treturn {\n\t\t\tProgram(node) {\n\t\t\t\tenvironment = createTypeEnvironment(\n\t\t\t\t\tnode,\n\t\t\t\t\tcontext.sourceCode.visitorKeys,\n\t\t\t\t);\n\t\t\t},\n\t\t\tVariableDeclarator(node) {\n\t\t\t\tif (node.init === null || node.id.type !== \"Identifier\") return;\n\t\t\t\treportFlow(\n\t\t\t\t\tnode.init,\n\t\t\t\t\ttargetFromAnnotation(node.id.typeAnnotation),\n\t\t\t\t\t`binding \\`${node.id.name}\\``,\n\t\t\t\t);\n\t\t\t},\n\t\t\tPropertyDefinition(node) {\n\t\t\t\tif (node.value === null) return;\n\t\t\t\treportFlow(\n\t\t\t\t\tnode.value,\n\t\t\t\t\ttargetFromAnnotation(node.typeAnnotation),\n\t\t\t\t\t`property \\`${sourceKeyName(context.sourceCode, node.key)}\\``,\n\t\t\t\t);\n\t\t\t},\n\t\t\tAccessorProperty(node) {\n\t\t\t\tif (node.value === null) return;\n\t\t\t\treportFlow(\n\t\t\t\t\tnode.value,\n\t\t\t\t\ttargetFromAnnotation(node.typeAnnotation),\n\t\t\t\t\t`property \\`${sourceKeyName(context.sourceCode, node.key)}\\``,\n\t\t\t\t);\n\t\t\t},\n\t\t\tAssignmentExpression(node) {\n\t\t\t\tif (node.operator !== \"=\" || node.left.type !== \"Identifier\") return;\n\t\t\t\tconst variable = resolveVariable(context.sourceCode, node.left);\n\t\t\t\tif (variable === null) return;\n\t\t\t\tconst declarator = variableDeclarator(variable);\n\t\t\t\tif (declarator === null || declarator.id.type !== \"Identifier\") return;\n\t\t\t\treportFlow(\n\t\t\t\t\tnode.right,\n\t\t\t\t\ttargetFromAnnotation(declarator.id.typeAnnotation),\n\t\t\t\t\t`binding \\`${declarator.id.name}\\``,\n\t\t\t\t);\n\t\t\t},\n\t\t\tCallExpression(node) {\n\t\t\t\tif (environment === null) return;\n\t\t\t\tconst owner = localFunctionForCall(context.sourceCode, node.callee);\n\t\t\t\tif (owner === null) return;\n\t\t\t\tconst parameterIndex = typePredicateSubjectIndex(context.sourceCode, owner);\n\t\t\t\tif (parameterIndex === null) return;\n\t\t\t\tconst parameter = owner.params[parameterIndex];\n\t\t\t\tconst argument = node.arguments[parameterIndex];\n\t\t\t\tif (parameter === undefined || argument === undefined || argument.type === \"SpreadElement\") {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst parameterAnnotation = functionParameterTypeAnnotation(parameter);\n\t\t\t\tif (\n\t\t\t\t\tparameterAnnotation === null ||\n\t\t\t\t\tparameterAnnotation === undefined ||\n\t\t\t\t\t!containsUnknownType(parameterAnnotation.typeAnnotation)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\t!hasKnownCallArgumentEvidence(\n\t\t\t\t\t\tcontext.sourceCode,\n\t\t\t\t\t\targument,\n\t\t\t\t\t\tenvironment,\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: argument,\n\t\t\t\t\tmessageId: \"widening\",\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tsubject: `argument for parameter \\`${functionParameterBindingName(parameter, context.sourceCode)}\\` of \\`${functionName(context.sourceCode, owner)}\\``,\n\t\t\t\t\t\ttarget: \"unknown\",\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t},\n\t\t\tReturnStatement(node) {\n\t\t\t\tif (node.argument === null) return;\n\t\t\t\tconst owner = enclosingFunction(node);\n\t\t\t\treportFlow(\n\t\t\t\t\tnode.argument,\n\t\t\t\t\ttargetFromAnnotation(owner?.returnType),\n\t\t\t\t\t`return value of \\`${functionName(context.sourceCode, owner)}\\``,\n\t\t\t\t);\n\t\t\t},\n\t\t\tArrowFunctionExpression(node) {\n\t\t\t\tif (node.body.type === \"BlockStatement\") return;\n\t\t\t\treportFlow(\n\t\t\t\t\tnode.body,\n\t\t\t\t\ttargetFromAnnotation(node.returnType),\n\t\t\t\t\t`return value of \\`${functionName(context.sourceCode, node)}\\``,\n\t\t\t\t);\n\t\t\t},\n\t\t\tTSAsExpression(node) {\n\t\t\t\tif (environment === null || hasParentAssertion(node)) return;\n\t\t\t\treportFlow(\n\t\t\t\t\tnode.expression,\n\t\t\t\t\tclassifyWideningTarget(node.typeAnnotation, environment),\n\t\t\t\t\t\"assertion\",\n\t\t\t\t);\n\t\t\t},\n\t\t\tTSTypeAssertion(node) {\n\t\t\t\tif (environment === null || hasParentAssertion(node)) return;\n\t\t\t\treportFlow(\n\t\t\t\t\tnode.expression,\n\t\t\t\t\tclassifyWideningTarget(node.typeAnnotation, environment),\n\t\t\t\t\t\"assertion\",\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t},\n});\n","import type { ESTree } from \"@oxlint/plugins\";\n\ntype VisitorKeys = Readonly<Record<string, readonly string[]>>;\n\nfunction isNode(value: unknown): value is ESTree.Node {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"type\" in value &&\n\t\ttypeof value.type === \"string\"\n\t);\n}\n\nfunction collectInferTypeParameterNames(\n\tnode: ESTree.Node,\n\tvisitorKeys: VisitorKeys,\n\tnames: Set<string>,\n): void {\n\tif (node.type === \"TSInferType\") names.add(node.typeParameter.name.name);\n\tconst record = node as unknown as Readonly<Record<string, unknown>>;\n\tfor (const key of visitorKeys[node.type] ?? []) {\n\t\tconst value = record[key];\n\t\tif (isNode(value)) {\n\t\t\tcollectInferTypeParameterNames(value, visitorKeys, names);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!Array.isArray(value)) continue;\n\t\tfor (const child of value) {\n\t\t\tif (isNode(child)) collectInferTypeParameterNames(child, visitorKeys, names);\n\t\t}\n\t}\n}\n\n/** Collect type binders that are in scope at a node and can shadow module aliases. */\nexport function lexicalTypeParameterNames(\n\tnode: ESTree.Node,\n\tvisitorKeys: VisitorKeys,\n): ReadonlySet<string> {\n\tconst names = new Set<string>();\n\tlet descendant: ESTree.Node = node;\n\tlet current: ESTree.Node | null = node;\n\twhile (current !== null && current.type !== \"Program\") {\n\t\tif (\"typeParameters\" in current) {\n\t\t\tfor (const parameter of current.typeParameters?.params ?? []) {\n\t\t\t\tnames.add(parameter.name.name);\n\t\t\t}\n\t\t}\n\t\tif (\n\t\t\tcurrent.type === \"TSMappedType\" &&\n\t\t\t(descendant === current.nameType || descendant === current.typeAnnotation)\n\t\t) {\n\t\t\tnames.add(current.key.name);\n\t\t}\n\t\tif (current.type === \"TSConditionalType\" && descendant === current.trueType) {\n\t\t\tcollectInferTypeParameterNames(current.extendsType, visitorKeys, names);\n\t\t}\n\t\tdescendant = current;\n\t\tcurrent = current.parent;\n\t}\n\treturn names;\n}\n","import type { ESTree } from \"@oxlint/plugins\";\n\nimport { lexicalTypeParameterNames } from \"./lexical-type-parameters.ts\";\n\ntype VisitorKeys = Readonly<Record<string, readonly string[]>>;\ntype TypeScope = ESTree.Node;\n\ntype TypeBinding = {\n\treadonly alias: ESTree.TSTypeAliasDeclaration | null;\n\treadonly name: string;\n\treadonly scope: TypeScope;\n};\n\ntype Substitution = {\n\treadonly substitutions: Substitutions;\n\treadonly type: ESTree.TSType;\n};\n\ntype Substitutions = ReadonlyMap<string, Substitution>;\n\nexport type TypeAliasEnvironment = {\n\treadonly aliases: readonly ESTree.TSTypeAliasDeclaration[];\n\treadonly bindingsByName: ReadonlyMap<string, readonly TypeBinding[]>;\n\treadonly visitorKeys: VisitorKeys;\n};\n\nexport type ResolvedTypeMatcher = (\n\ttype: ESTree.TSType,\n\tmatches: (child: ESTree.TSType) => boolean,\n) => boolean;\n\nconst environmentsByProgram = new WeakMap<ESTree.Program, TypeAliasEnvironment>();\n\nfunction isNode(value: unknown): value is ESTree.Node {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"type\" in value &&\n\t\ttypeof value.type === \"string\"\n\t);\n}\n\nfunction enclosingTypeScope(node: ESTree.Node): TypeScope {\n\tlet current: ESTree.Node | null = node.parent;\n\twhile (current !== null) {\n\t\tif (\n\t\t\tcurrent.type === \"Program\" ||\n\t\t\tcurrent.type === \"BlockStatement\" ||\n\t\t\tcurrent.type === \"TSModuleBlock\" ||\n\t\t\tcurrent.type === \"StaticBlock\" ||\n\t\t\tcurrent.type === \"SwitchStatement\"\n\t\t) {\n\t\t\treturn current;\n\t\t}\n\t\tcurrent = current.parent;\n\t}\n\treturn node;\n}\n\nfunction declaredTypeBinding(node: ESTree.Node): {\n\treadonly alias: ESTree.TSTypeAliasDeclaration | null;\n\treadonly name: string;\n} | null {\n\tif (node.type === \"TSTypeAliasDeclaration\") {\n\t\treturn { alias: node, name: node.id.name };\n\t}\n\tif (\n\t\tnode.type === \"TSInterfaceDeclaration\" ||\n\t\tnode.type === \"TSEnumDeclaration\" ||\n\t\tnode.type === \"ClassDeclaration\" ||\n\t\tnode.type === \"ClassExpression\"\n\t) {\n\t\treturn node.id === null ? null : { alias: null, name: node.id.name };\n\t}\n\tif (\n\t\tnode.type === \"ImportSpecifier\" ||\n\t\tnode.type === \"ImportDefaultSpecifier\" ||\n\t\tnode.type === \"ImportNamespaceSpecifier\"\n\t) {\n\t\treturn { alias: null, name: node.local.name };\n\t}\n\treturn null;\n}\n\nfunction collectTypeBindings(\n\tnode: ESTree.Node,\n\tvisitorKeys: VisitorKeys,\n\tbindingsByName: Map<string, TypeBinding[]>,\n\taliases: ESTree.TSTypeAliasDeclaration[],\n): void {\n\tconst declared = declaredTypeBinding(node);\n\tif (declared !== null) {\n\t\tconst bindings = bindingsByName.get(declared.name) ?? [];\n\t\tbindings.push({ ...declared, scope: enclosingTypeScope(node) });\n\t\tbindingsByName.set(declared.name, bindings);\n\t\tif (declared.alias !== null) aliases.push(declared.alias);\n\t}\n\n\t// SAFETY: Oxlint's visitor keys identify only ESTree child-node properties.\n\tconst fields = node as unknown as Readonly<Record<string, unknown>>;\n\tfor (const key of visitorKeys[node.type] ?? []) {\n\t\tconst value = fields[key];\n\t\tif (isNode(value)) {\n\t\t\tcollectTypeBindings(value, visitorKeys, bindingsByName, aliases);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!Array.isArray(value)) continue;\n\t\tfor (const child of value) {\n\t\t\tif (isNode(child)) {\n\t\t\t\tcollectTypeBindings(child, visitorKeys, bindingsByName, aliases);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** Collect every lexical type alias and competing type binding in a program. */\nexport function createTypeAliasEnvironment(\n\tprogram: ESTree.Program,\n\tvisitorKeys: VisitorKeys,\n): TypeAliasEnvironment {\n\tconst cached = environmentsByProgram.get(program);\n\tif (cached !== undefined) return cached;\n\tconst bindingsByName = new Map<string, TypeBinding[]>();\n\tconst aliases: ESTree.TSTypeAliasDeclaration[] = [];\n\tcollectTypeBindings(program, visitorKeys, bindingsByName, aliases);\n\tconst environment = { aliases, bindingsByName, visitorKeys };\n\tenvironmentsByProgram.set(program, environment);\n\treturn environment;\n}\n\nfunction ancestorDistance(ancestor: ESTree.Node, node: ESTree.Node): number | null {\n\tlet current: ESTree.Node | null = node;\n\tlet distance = 0;\n\twhile (current !== null) {\n\t\tif (current === ancestor) return distance;\n\t\tcurrent = current.parent;\n\t\tdistance += 1;\n\t}\n\treturn null;\n}\n\nfunction nearestTypeBindings(\n\tname: string,\n\tuse: ESTree.Node,\n\tenvironment: TypeAliasEnvironment,\n): readonly TypeBinding[] {\n\tconst candidates = environment.bindingsByName.get(name) ?? [];\n\tlet nearestDistance = Number.POSITIVE_INFINITY;\n\tlet nearest: TypeBinding[] = [];\n\tfor (const candidate of candidates) {\n\t\tconst distance = ancestorDistance(candidate.scope, use);\n\t\tif (distance === null || distance > nearestDistance) continue;\n\t\tif (distance === nearestDistance) {\n\t\t\tnearest.push(candidate);\n\t\t\tcontinue;\n\t\t}\n\t\tnearestDistance = distance;\n\t\tnearest = [candidate];\n\t}\n\treturn nearest;\n}\n\n/** Resolve the nearest visible alias with this name, respecting lexical shadowing. */\nexport function visibleTypeAlias(\n\tname: string,\n\tuse: ESTree.Node,\n\tenvironment: TypeAliasEnvironment,\n): ESTree.TSTypeAliasDeclaration | null {\n\tif (lexicalTypeParameterNames(use, environment.visitorKeys).has(name)) return null;\n\tconst bindings = nearestTypeBindings(name, use, environment);\n\treturn bindings.length === 1 ? (bindings[0]?.alias ?? null) : null;\n}\n\n/** Return whether a local declaration shadows a built-in type at this use. */\nexport function hasVisibleTypeBinding(\n\tname: string,\n\tuse: ESTree.Node,\n\tenvironment: TypeAliasEnvironment,\n): boolean {\n\treturn (\n\t\tlexicalTypeParameterNames(use, environment.visitorKeys).has(name) ||\n\t\tnearestTypeBindings(name, use, environment).length > 0\n\t);\n}\n\nfunction typeReferenceName(type: ESTree.TSTypeReference): string | null {\n\treturn type.typeName.type === \"Identifier\" ? type.typeName.name : null;\n}\n\nfunction aliasSubstitutions(\n\talias: ESTree.TSTypeAliasDeclaration,\n\treference: ESTree.TSTypeReference,\n\tbase: Substitutions,\n): Substitutions | null {\n\tconst parameters = alias.typeParameters?.params ?? [];\n\tconst arguments_ = reference.typeArguments?.params ?? [];\n\tconst next = new Map(base);\n\tfor (const [index, parameter] of parameters.entries()) {\n\t\tconst explicitArgument = arguments_[index];\n\t\tconst argument = explicitArgument ?? parameter.default;\n\t\tif (argument === null || argument === undefined) return null;\n\t\tconst argumentSubstitutions = explicitArgument === undefined ? next : base;\n\t\tnext.set(parameter.name.name, {\n\t\t\ttype: argument,\n\t\t\tsubstitutions: new Map(argumentSubstitutions),\n\t\t});\n\t}\n\treturn next;\n}\n\n/** Match a type after resolving visible aliases and substituting their type parameters. */\nexport function resolvedTypeMatches(\n\ttype: ESTree.TSType,\n\tenvironment: TypeAliasEnvironment,\n\tmatcher: ResolvedTypeMatcher,\n): boolean {\n\tconst evaluate = (\n\t\tcurrent: ESTree.TSType,\n\t\tsubstitutions: Substitutions,\n\t\tresolvingAliases: ReadonlySet<ESTree.TSTypeAliasDeclaration>,\n\t): boolean => {\n\t\tif (current.type === \"TSTypeReference\") {\n\t\t\tconst name = typeReferenceName(current);\n\t\t\tif (name !== null) {\n\t\t\t\tconst substitution = substitutions.get(name);\n\t\t\t\tif (substitution !== undefined && !current.typeArguments?.params.length) {\n\t\t\t\t\treturn evaluate(\n\t\t\t\t\t\tsubstitution.type,\n\t\t\t\t\t\tsubstitution.substitutions,\n\t\t\t\t\t\tresolvingAliases,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst alias = visibleTypeAlias(name, current, environment);\n\t\t\t\tif (alias !== null && !resolvingAliases.has(alias)) {\n\t\t\t\t\tconst nextSubstitutions = aliasSubstitutions(alias, current, substitutions);\n\t\t\t\t\tif (nextSubstitutions !== null) {\n\t\t\t\t\t\tconst nextResolving = new Set(resolvingAliases);\n\t\t\t\t\t\tnextResolving.add(alias);\n\t\t\t\t\t\treturn evaluate(alias.typeAnnotation, nextSubstitutions, nextResolving);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn matcher(current, (child) =>\n\t\t\tevaluate(child, substitutions, resolvingAliases),\n\t\t);\n\t};\n\n\treturn evaluate(type, new Map(), new Set());\n}\n","import type { ESTree } from \"@oxlint/plugins\";\n\nimport {\n\tcreateTypeAliasEnvironment,\n\thasVisibleTypeBinding,\n\tvisibleTypeAlias,\n\ttype TypeAliasEnvironment as LexicalTypeAliasEnvironment,\n} from \"./type-alias-resolution.ts\";\n\nconst BUILT_INS = new Set([\n\t\"Record\",\n\t\"Readonly\",\n\t\"Partial\",\n\t\"Required\",\n\t\"Pick\",\n\t\"Omit\",\n\t\"PropertyKey\",\n\t\"NonNullable\",\n]);\nconst TRANSPARENT_WRAPPERS = new Set([\"Readonly\", \"Partial\", \"Required\", \"NonNullable\"]);\n\ntype TypeAliasEnvironment = ReadonlyMap<string, ESTree.TSType>;\n\ntype ResolvedType = {\n\treadonly type: ESTree.TSType;\n\treadonly substitutions: TypeAliasEnvironment;\n};\n\nexport type UnsafeDictionary = {\n\treadonly kind: \"unsafe-dictionary\";\n\treadonly unsafeValue: \"any\" | \"empty-object\" | \"object\" | \"union\" | \"unknown\";\n};\n\nexport type WideningTargetKind =\n\t| \"anonymous object\"\n\t| \"generic container\"\n\t| \"object\"\n\t| \"open dictionary\"\n\t| \"unknown\";\n\nexport type WideningTarget = {\n\treadonly kind: WideningTargetKind;\n};\n\nexport type TypeEnvironment = {\n\treadonly interfaces: ReadonlyMap<string, readonly ESTree.TSInterfaceDeclaration[]>;\n\treadonly typeAliases: LexicalTypeAliasEnvironment;\n};\n\nfunction declaredStatement(statement: ESTree.Statement): ESTree.Node | null {\n\treturn statement.type === \"ExportNamedDeclaration\" ||\n\t\tstatement.type === \"ExportDefaultDeclaration\"\n\t\t? (statement.declaration ?? null)\n\t\t: statement;\n}\n\nexport function createTypeEnvironment(\n\tprogram: ESTree.Program,\n\tvisitorKeys: Readonly<Record<string, readonly string[]>>,\n): TypeEnvironment {\n\tconst interfaces = new Map<string, ESTree.TSInterfaceDeclaration[]>();\n\n\tfor (const statement of program.body) {\n\t\tconst declaration = declaredStatement(statement);\n\t\tif (declaration?.type !== \"TSInterfaceDeclaration\") continue;\n\t\tconst declarations = interfaces.get(declaration.id.name) ?? [];\n\t\tdeclarations.push(declaration);\n\t\tinterfaces.set(declaration.id.name, declarations);\n\t}\n\n\treturn {\n\t\tinterfaces,\n\t\ttypeAliases: createTypeAliasEnvironment(program, visitorKeys),\n\t};\n}\n\nfunction typeReferenceName(type: ESTree.TSTypeReference): string | null {\n\treturn type.typeName.type === \"Identifier\" ? type.typeName.name : null;\n}\n\nfunction isBuiltIn(\n\tname: string,\n\tuse: ESTree.Node,\n\tenvironment: TypeEnvironment,\n): boolean {\n\treturn (\n\t\tBUILT_INS.has(name) &&\n\t\t!hasVisibleTypeBinding(name, use, environment.typeAliases)\n\t);\n}\n\nfunction isUnappliedReferenceTo(type: ESTree.TSType, name: string): boolean {\n\tconst unwrapped = unwrapTransparentType(type);\n\treturn (\n\t\tunwrapped.type === \"TSTypeReference\" &&\n\t\ttypeReferenceName(unwrapped) === name &&\n\t\t(unwrapped.typeArguments === null ||\n\t\t\tunwrapped.typeArguments === undefined ||\n\t\t\tunwrapped.typeArguments.params.length === 0)\n\t);\n}\n\nfunction unwrapTransparentType(type: ESTree.TSType): ESTree.TSType {\n\tlet current = type;\n\twhile (\n\t\tcurrent.type === \"TSParenthesizedType\" ||\n\t\t(current.type === \"TSTypeOperator\" && current.operator === \"readonly\")\n\t) {\n\t\tcurrent = current.typeAnnotation;\n\t}\n\treturn current;\n}\n\nfunction isNeverType(type: ESTree.TSType): boolean {\n\treturn unwrapTransparentType(type).type === \"TSNeverKeyword\";\n}\n\nfunction isEffectivelyEmptyMember(member: ESTree.TSSignature): boolean {\n\treturn (\n\t\tmember.type === \"TSPropertySignature\" &&\n\t\tmember.optional === true &&\n\t\tmember.typeAnnotation !== null &&\n\t\tmember.typeAnnotation !== undefined &&\n\t\tisNeverType(member.typeAnnotation.typeAnnotation)\n\t);\n}\n\nfunction isEffectivelyEmptyTypeLiteral(type: ESTree.TSTypeLiteral): boolean {\n\treturn type.members.length === 0 || type.members.every(isEffectivelyEmptyMember);\n}\n\nfunction isEffectivelyEmptyInterface(\n\tdeclarations: readonly ESTree.TSInterfaceDeclaration[],\n): boolean {\n\tif (declarations.length !== 1) return false;\n\tconst [type] = declarations;\n\treturn (\n\t\ttype !== undefined &&\n\t\ttype.extends.length === 0 &&\n\t\t(type.body.body.length === 0 || type.body.body.every(isEffectivelyEmptyMember))\n\t);\n}\n\nfunction resolvedSubstitutionArgument(\n\ttype: ESTree.TSType,\n\tbase: TypeAliasEnvironment,\n\tresolving: ReadonlySet<string> = new Set(),\n): ESTree.TSType {\n\tconst unwrapped = unwrapTransparentType(type);\n\tif (unwrapped.type !== \"TSTypeReference\") return type;\n\tconst name = typeReferenceName(unwrapped);\n\tif (name === null || resolving.has(name)) return type;\n\tconst substitution = base.get(name);\n\tif (substitution === undefined) return type;\n\tconst nextResolving = new Set(resolving);\n\tnextResolving.add(name);\n\treturn resolvedSubstitutionArgument(substitution, base, nextResolving);\n}\n\nfunction aliasSubstitution(\n\talias: ESTree.TSTypeAliasDeclaration,\n\ttype: ESTree.TSTypeReference,\n\tbase: TypeAliasEnvironment,\n): TypeAliasEnvironment | null {\n\tconst parameters = alias.typeParameters?.params ?? [];\n\tconst arguments_ = type.typeArguments?.params ?? [];\n\tconst next = new Map(base);\n\tfor (const [index, parameter] of parameters.entries()) {\n\t\tconst argument = arguments_[index] ?? parameter.default;\n\t\tif (argument === null || argument === undefined) return null;\n\t\tnext.set(parameter.name.name, resolvedSubstitutionArgument(argument, next));\n\t}\n\treturn next;\n}\n\nfunction unsafeDirectValue(\n\ttype: ESTree.TSType,\n\tenvironment: TypeEnvironment,\n\tsubstitutions: TypeAliasEnvironment,\n\tresolvingAliases: ReadonlySet<string>,\n): UnsafeDictionary[\"unsafeValue\"] | null {\n\tconst unwrapped = unwrapTransparentType(type);\n\tif (unwrapped.type === \"TSUnknownKeyword\") return \"unknown\";\n\tif (unwrapped.type === \"TSAnyKeyword\") return \"any\";\n\tif (unwrapped.type === \"TSObjectKeyword\") return \"object\";\n\tif (unwrapped.type === \"TSTypeLiteral\" && isEffectivelyEmptyTypeLiteral(unwrapped))\n\t\treturn \"empty-object\";\n\tif (unwrapped.type === \"TSUnionType\") {\n\t\treturn unwrapped.types.some(\n\t\t\t(member) => unsafeDirectValue(member, environment, substitutions, resolvingAliases) !== null,\n\t\t)\n\t\t\t? \"union\"\n\t\t\t: null;\n\t}\n\tif (unwrapped.type === \"TSIntersectionType\") {\n\t\tconst unsafeMembers = unwrapped.types.map((member) =>\n\t\t\tunsafeDirectValue(member, environment, substitutions, resolvingAliases),\n\t\t);\n\t\tif (unsafeMembers.includes(\"any\")) return \"any\";\n\t\treturn unsafeMembers.length > 0 && unsafeMembers.every((member) => member !== null)\n\t\t\t? unsafeMembers[0]\n\t\t\t: null;\n\t}\n\tif (unwrapped.type !== \"TSTypeReference\") return null;\n\tconst name = typeReferenceName(unwrapped);\n\tif (name === null) return null;\n\tif (TRANSPARENT_WRAPPERS.has(name) && isBuiltIn(name, unwrapped, environment)) {\n\t\tconst wrapped = unwrapped.typeArguments?.params[0];\n\t\treturn wrapped === undefined\n\t\t\t? null\n\t\t\t: unsafeDirectValue(wrapped, environment, substitutions, resolvingAliases);\n\t}\n\tconst substitution = substitutions.get(name);\n\tif (substitution !== undefined) {\n\t\treturn isUnappliedReferenceTo(substitution, name)\n\t\t\t? null\n\t\t\t: unsafeDirectValue(substitution, environment, substitutions, resolvingAliases);\n\t}\n\tconst interfaceDeclarations = environment.interfaces.get(name);\n\tif (interfaceDeclarations !== undefined) {\n\t\treturn isEffectivelyEmptyInterface(interfaceDeclarations) ? \"empty-object\" : null;\n\t}\n\tconst alias = visibleTypeAlias(name, unwrapped, environment.typeAliases);\n\tif (alias === null || resolvingAliases.has(name)) return null;\n\tconst nextSubstitutions = aliasSubstitution(alias, unwrapped, substitutions);\n\tif (nextSubstitutions === null) return null;\n\tconst nextResolving = new Set(resolvingAliases);\n\tnextResolving.add(name);\n\treturn unsafeDirectValue(alias.typeAnnotation, environment, nextSubstitutions, nextResolving);\n}\n\nfunction dictionaryValueTypes(\n\ttype: ESTree.TSType,\n\tenvironment: TypeEnvironment,\n\tsubstitutions: TypeAliasEnvironment,\n\tresolvingAliases: ReadonlySet<string>,\n): readonly ResolvedType[] {\n\tconst unwrapped = unwrapTransparentType(type);\n\n\tif (unwrapped.type === \"TSTypeLiteral\") {\n\t\treturn unwrapped.members.flatMap((member): readonly ResolvedType[] =>\n\t\t\tmember.type === \"TSIndexSignature\" && member.typeAnnotation !== null\n\t\t\t\t? [{ type: member.typeAnnotation.typeAnnotation, substitutions }]\n\t\t\t\t: [],\n\t\t);\n\t}\n\n\tif (unwrapped.type === \"TSMappedType\") {\n\t\treturn unwrapped.typeAnnotation === null\n\t\t\t? []\n\t\t\t: [{ type: unwrapped.typeAnnotation, substitutions }];\n\t}\n\n\tif (unwrapped.type !== \"TSTypeReference\") return [];\n\tconst name = typeReferenceName(unwrapped);\n\tif (name === null) return [];\n\n\tconst substitution = substitutions.get(name);\n\tif (substitution !== undefined) {\n\t\treturn isUnappliedReferenceTo(substitution, name)\n\t\t\t? []\n\t\t\t: dictionaryValueTypes(substitution, environment, substitutions, resolvingAliases);\n\t}\n\n\tif (TRANSPARENT_WRAPPERS.has(name) && isBuiltIn(name, unwrapped, environment)) {\n\t\tconst wrapped = unwrapped.typeArguments?.params[0];\n\t\treturn wrapped === undefined\n\t\t\t? []\n\t\t\t: dictionaryValueTypes(wrapped, environment, substitutions, resolvingAliases);\n\t}\n\n\tif (name === \"Record\" && isBuiltIn(name, unwrapped, environment)) {\n\t\tconst value = unwrapped.typeArguments?.params[1] ?? null;\n\t\treturn value === null ? [] : [{ type: value, substitutions }];\n\t}\n\n\tif (\n\t\t(name === \"Pick\" || name === \"Omit\") &&\n\t\tisBuiltIn(name, unwrapped, environment)\n\t) {\n\t\tconst source = unwrapped.typeArguments?.params[0];\n\t\treturn source === undefined\n\t\t\t? []\n\t\t\t: dictionaryValueTypes(source, environment, substitutions, resolvingAliases);\n\t}\n\n\tconst alias = visibleTypeAlias(name, unwrapped, environment.typeAliases);\n\tif (alias === null || resolvingAliases.has(name)) return [];\n\tconst nextSubstitutions = aliasSubstitution(alias, unwrapped, substitutions);\n\tif (nextSubstitutions === null) return [];\n\tconst nextResolving = new Set(resolvingAliases);\n\tnextResolving.add(name);\n\treturn dictionaryValueTypes(alias.typeAnnotation, environment, nextSubstitutions, nextResolving);\n}\n\nexport function classifyUnsafeDictionaryValue(\n\tvalueType: ESTree.TSType,\n\tenvironment: TypeEnvironment,\n): UnsafeDictionary | null {\n\tconst unsafeValue = unsafeDirectValue(valueType, environment, new Map(), new Set());\n\treturn unsafeValue === null ? null : { kind: \"unsafe-dictionary\", unsafeValue };\n}\n\nexport function classifyUnsafeDictionary(\n\ttype: ESTree.TSType,\n\tenvironment: TypeEnvironment,\n): UnsafeDictionary | null {\n\tfor (const valueType of dictionaryValueTypes(type, environment, new Map(), new Set())) {\n\t\tconst unsafeValue = unsafeDirectValue(\n\t\t\tvalueType.type,\n\t\t\tenvironment,\n\t\t\tvalueType.substitutions,\n\t\t\tnew Set(),\n\t\t);\n\t\tif (unsafeValue !== null) return { kind: \"unsafe-dictionary\", unsafeValue };\n\t}\n\treturn null;\n}\n\nexport function classifyWideningTarget(\n\ttype: ESTree.TSType,\n\tenvironment: TypeEnvironment,\n): WideningTarget | null {\n\tconst unwrapped = unwrapTransparentType(type);\n\tif (unwrapped.type === \"TSUnknownKeyword\") return { kind: \"unknown\" };\n\tif (unwrapped.type === \"TSObjectKeyword\") return { kind: \"object\" };\n\tif (unwrapped.type === \"TSTypeLiteral\") {\n\t\treturn unwrapped.members.some((member) => member.type === \"TSIndexSignature\")\n\t\t\t? { kind: \"open dictionary\" }\n\t\t\t: unwrapped.members.length > 0\n\t\t\t\t? { kind: \"anonymous object\" }\n\t\t\t\t: null;\n\t}\n\tif (unwrapped.type === \"TSMappedType\") return { kind: \"open dictionary\" };\n\tif (unwrapped.type !== \"TSTypeReference\") return null;\n\tconst name = typeReferenceName(unwrapped);\n\tif (name === null) return null;\n\tif (TRANSPARENT_WRAPPERS.has(name) && isBuiltIn(name, unwrapped, environment)) {\n\t\tconst wrapped = unwrapped.typeArguments?.params[0];\n\t\treturn wrapped === undefined ? null : classifyWideningTarget(wrapped, environment);\n\t}\n\tif (name === \"Record\" && isBuiltIn(name, unwrapped, environment)) {\n\t\treturn hasBroadRecordKey(unwrapped, environment, new Map())\n\t\t\t? { kind: \"open dictionary\" }\n\t\t\t: null;\n\t}\n\tconst alias = visibleTypeAlias(name, unwrapped, environment.typeAliases);\n\tif (alias === null) return null;\n\tif ((alias.typeParameters?.params.length ?? 0) > 0) {\n\t\tconst substitutions = aliasSubstitution(alias, unwrapped, new Map());\n\t\tconst resolved =\n\t\t\tsubstitutions === null\n\t\t\t\t? null\n\t\t\t\t: classifyAliasBroadTarget(\n\t\t\t\t\t\talias.typeAnnotation,\n\t\t\t\t\t\tenvironment,\n\t\t\t\t\t\tsubstitutions,\n\t\t\t\t\t\tnew Set([name]),\n\t\t\t\t\t);\n\t\treturn resolved?.kind === \"open dictionary\" ? { kind: \"generic container\" } : null;\n\t}\n\tconst substitutions = aliasSubstitution(alias, unwrapped, new Map());\n\tif (substitutions === null) return null;\n\tconst resolved = classifyAliasBroadTarget(\n\t\talias.typeAnnotation,\n\t\tenvironment,\n\t\tsubstitutions,\n\t\tnew Set([name]),\n\t);\n\treturn resolved;\n}\n\nfunction hasBroadRecordKey(\n\ttype: ESTree.TSTypeReference,\n\tenvironment: TypeEnvironment,\n\tsubstitutions: TypeAliasEnvironment,\n): boolean {\n\tconst key = type.typeArguments?.params[0];\n\treturn key === undefined || isBroadMappedKey(key, environment, substitutions);\n}\n\nfunction isBroadMappedKey(\n\ttype: ESTree.TSType,\n\tenvironment: TypeEnvironment,\n\tsubstitutions: TypeAliasEnvironment,\n\tvisitedAliases: ReadonlySet<string> = new Set(),\n): boolean {\n\tconst unwrapped = unwrapTransparentType(type);\n\tif (\n\t\tunwrapped.type === \"TSStringKeyword\" ||\n\t\tunwrapped.type === \"TSNumberKeyword\" ||\n\t\tunwrapped.type === \"TSSymbolKeyword\"\n\t) {\n\t\treturn true;\n\t}\n\tif (unwrapped.type === \"TSUnionType\") {\n\t\treturn unwrapped.types.some((member) =>\n\t\t\tisBroadMappedKey(member, environment, substitutions, visitedAliases),\n\t\t);\n\t}\n\tif (unwrapped.type !== \"TSTypeReference\") return false;\n\tconst name = typeReferenceName(unwrapped);\n\tif (name === null) return false;\n\tconst substitution = substitutions.get(name);\n\tif (substitution !== undefined && !isUnappliedReferenceTo(substitution, name)) {\n\t\treturn isBroadMappedKey(substitution, environment, substitutions, visitedAliases);\n\t}\n\tif (name === \"PropertyKey\" && isBuiltIn(name, unwrapped, environment)) return true;\n\tconst alias = visibleTypeAlias(name, unwrapped, environment.typeAliases);\n\tif (\n\t\talias === null ||\n\t\t(alias.typeParameters?.params.length ?? 0) > 0 ||\n\t\tvisitedAliases.has(name)\n\t) {\n\t\treturn false;\n\t}\n\tconst nextVisited = new Set(visitedAliases);\n\tnextVisited.add(name);\n\treturn isBroadMappedKey(alias.typeAnnotation, environment, substitutions, nextVisited);\n}\n\nfunction classifyAliasBroadTarget(\n\ttype: ESTree.TSType,\n\tenvironment: TypeEnvironment,\n\tsubstitutions: TypeAliasEnvironment,\n\tresolvingAliases: ReadonlySet<string>,\n): WideningTarget | null {\n\tconst unwrapped = unwrapTransparentType(type);\n\tif (unwrapped.type === \"TSUnknownKeyword\") return { kind: \"unknown\" };\n\tif (unwrapped.type === \"TSObjectKeyword\") return { kind: \"object\" };\n\tif (unwrapped.type === \"TSTypeLiteral\") {\n\t\treturn unwrapped.members.some((member) => member.type === \"TSIndexSignature\")\n\t\t\t? { kind: \"open dictionary\" }\n\t\t\t: null;\n\t}\n\tif (unwrapped.type === \"TSMappedType\") {\n\t\treturn isBroadMappedKey(unwrapped.constraint, environment, substitutions)\n\t\t\t? { kind: \"open dictionary\" }\n\t\t\t: null;\n\t}\n\tif (unwrapped.type !== \"TSTypeReference\") return null;\n\tconst name = typeReferenceName(unwrapped);\n\tif (name === null) return null;\n\tconst substitution = substitutions.get(name);\n\tif (substitution !== undefined) {\n\t\treturn isUnappliedReferenceTo(substitution, name)\n\t\t\t? null\n\t\t\t: classifyAliasBroadTarget(\n\t\t\t\t\tsubstitution,\n\t\t\t\t\tenvironment,\n\t\t\t\t\tsubstitutions,\n\t\t\t\t\tresolvingAliases,\n\t\t\t\t);\n\t}\n\tif (TRANSPARENT_WRAPPERS.has(name) && isBuiltIn(name, unwrapped, environment)) {\n\t\tconst wrapped = unwrapped.typeArguments?.params[0];\n\t\treturn wrapped === undefined\n\t\t\t? null\n\t\t\t: classifyAliasBroadTarget(wrapped, environment, substitutions, resolvingAliases);\n\t}\n\tif (name === \"Record\" && isBuiltIn(name, unwrapped, environment)) {\n\t\treturn hasBroadRecordKey(unwrapped, environment, substitutions)\n\t\t\t? { kind: \"open dictionary\" }\n\t\t\t: null;\n\t}\n\tconst alias = visibleTypeAlias(name, unwrapped, environment.typeAliases);\n\tif (alias === null || resolvingAliases.has(name)) return null;\n\tconst nextSubstitutions = aliasSubstitution(alias, unwrapped, substitutions);\n\tif (nextSubstitutions === null) return null;\n\tconst nextResolving = new Set(resolvingAliases);\n\tnextResolving.add(name);\n\treturn classifyAliasBroadTarget(\n\t\talias.typeAnnotation,\n\t\tenvironment,\n\t\tnextSubstitutions,\n\t\tnextResolving,\n\t);\n}\n\nexport function isPopulatedObjectExpression(expression: ESTree.Expression): boolean {\n\tlet current = expression;\n\twhile (\n\t\tcurrent.type === \"ParenthesizedExpression\" ||\n\t\tcurrent.type === \"TSAsExpression\" ||\n\t\tcurrent.type === \"TSTypeAssertion\" ||\n\t\tcurrent.type === \"TSNonNullExpression\"\n\t) {\n\t\tcurrent = current.expression;\n\t}\n\treturn current.type === \"ObjectExpression\" && current.properties.length > 0;\n}\n\nexport function isKnownEvidenceExpression(expression: ESTree.Expression): boolean {\n\tlet current = expression;\n\twhile (\n\t\tcurrent.type === \"ParenthesizedExpression\" ||\n\t\tcurrent.type === \"TSAsExpression\" ||\n\t\tcurrent.type === \"TSTypeAssertion\" ||\n\t\tcurrent.type === \"TSNonNullExpression\" ||\n\t\tcurrent.type === \"TSSatisfiesExpression\"\n\t) {\n\t\tcurrent = current.expression;\n\t}\n\tif (current.type === \"ObjectExpression\") return true;\n\treturn (\n\t\tcurrent.type === \"ArrayExpression\" ||\n\t\tcurrent.type === \"ArrowFunctionExpression\" ||\n\t\tcurrent.type === \"ClassExpression\" ||\n\t\tcurrent.type === \"FunctionExpression\" ||\n\t\tcurrent.type === \"NewExpression\" ||\n\t\tcurrent.type === \"Literal\" ||\n\t\tcurrent.type === \"TemplateLiteral\" ||\n\t\tcurrent.type === \"UnaryExpression\"\n\t);\n}\n","import type { ESTree, SourceCode } from \"@oxlint/plugins\";\n\nexport type FunctionParameter = ESTree.ParamPattern;\n\n/** Return whether a type is or contains TypeScript's absorbing unknown top type. */\nexport function containsUnknownType(type: ESTree.TSType): boolean {\n\tif (type.type === \"TSUnknownKeyword\") return true;\n\tif (type.type === \"TSParenthesizedType\") return containsUnknownType(type.typeAnnotation);\n\treturn type.type === \"TSUnionType\" && type.types.some(containsUnknownType);\n}\n\n/** Return the TypeScript annotation attached to a function parameter or its wrapped binding. */\nexport function functionParameterTypeAnnotation(\n\tparameter: FunctionParameter,\n): ESTree.TSTypeAnnotation | null | undefined {\n\tif (parameter.type === \"TSParameterProperty\") {\n\t\treturn functionParameterTypeAnnotation(parameter.parameter);\n\t}\n\tif (parameter.type === \"RestElement\") {\n\t\treturn parameter.typeAnnotation ?? functionParameterTypeAnnotation(parameter.argument);\n\t}\n\tif (parameter.type === \"AssignmentPattern\") {\n\t\treturn parameter.typeAnnotation ?? functionParameterTypeAnnotation(parameter.left);\n\t}\n\treturn parameter.typeAnnotation;\n}\n\n/** Return only a function parameter's local binding, excluding its annotation and default value. */\nexport function functionParameterBindingName(\n\tparameter: FunctionParameter,\n\tsourceCode: SourceCode,\n): string {\n\tif (parameter.type === \"TSParameterProperty\") {\n\t\treturn functionParameterBindingName(parameter.parameter, sourceCode);\n\t}\n\tif (parameter.type === \"AssignmentPattern\") {\n\t\treturn functionParameterBindingName(parameter.left, sourceCode);\n\t}\n\tif (parameter.type === \"RestElement\") {\n\t\treturn functionParameterBindingName(parameter.argument, sourceCode);\n\t}\n\tif (parameter.type === \"Identifier\") return parameter.name;\n\n\tconst sourceText = sourceCode.getText(parameter);\n\tconst annotationStart = parameter.typeAnnotation?.start;\n\treturn annotationStart === undefined\n\t\t? sourceText\n\t\t: sourceText.slice(0, annotationStart - parameter.start).trimEnd();\n}\n","import type { ESTree, Scope, SourceCode, Variable } from \"@oxlint/plugins\";\n\n/** Resolve an identifier to its binding by walking lexical scopes upward. */\nexport function resolveVariable(\n\tsourceCode: SourceCode,\n\tidentifier: ESTree.IdentifierReference,\n): Variable | null {\n\tlet scope: Scope | null = sourceCode.getScope(identifier);\n\twhile (scope !== null) {\n\t\tconst variable = scope.set.get(identifier.name);\n\t\tif (variable !== undefined) return variable;\n\t\tscope = scope.upper;\n\t}\n\treturn null;\n}\n","import { defineRule } from \"@oxlint/plugins\";\n\nimport { resolveVariable } from \"../shared/scope.ts\";\n\nimport type { ESTree, SourceCode } from \"@oxlint/plugins\";\n\nconst moduleMockMethods = new Set([\"doMock\", \"mock\", \"unstable_mockModule\"]);\n\nfunction importedName(node: ESTree.Node): string | null {\n if (node.type !== \"ImportSpecifier\") return null;\n return node.imported.type === \"Identifier\" ? node.imported.name : node.imported.value;\n}\n\nfunction isTestFrameworkObject(\n sourceCode: SourceCode,\n expression: ESTree.Expression,\n): expression is ESTree.IdentifierReference {\n if (expression.type !== \"Identifier\") return false;\n if (\n (expression.name === \"vi\" || expression.name === \"jest\") &&\n sourceCode.isGlobalReference(expression)\n ) {\n return true;\n }\n\n const variable = resolveVariable(sourceCode, expression);\n if (variable === null || variable.defs.length === 0) {\n return expression.name === \"vi\" || expression.name === \"jest\";\n }\n return variable.defs.some((definition) => {\n if (definition.type !== \"ImportBinding\" || definition.parent?.type !== \"ImportDeclaration\") {\n return false;\n }\n const source = definition.parent.source.value;\n const name = importedName(definition.node);\n return (source === \"vitest\" && name === \"vi\") || (source === \"@jest/globals\" && name === \"jest\");\n });\n}\n\nfunction moduleMockCall(sourceCode: SourceCode, callee: ESTree.Expression): boolean {\n if (!(\"property\" in callee) || !(\"object\" in callee) || !(\"computed\" in callee)) return false;\n if (!isTestFrameworkObject(sourceCode, callee.object)) return false;\n const property = callee.property;\n const method = callee.computed\n ? property.type === \"Literal\" &&\n (property.value === \"doMock\" ||\n property.value === \"mock\" ||\n property.value === \"unstable_mockModule\")\n ? property.value\n : null\n : property.type === \"Identifier\"\n ? property.name\n : null;\n return method !== null && moduleMockMethods.has(method);\n}\n\n/** Ban test framework module mocking in favor of real dependency seams. */\nexport const noModuleMockingRule = defineRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow Vitest and Jest module mocking; tests must replace dependencies through real interfaces.\",\n },\n messages: {\n moduleMock:\n \"Replace module mocking with dependency injection through a real interface, service layer, or faithful test implementation.\",\n },\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n if (node.callee.type === \"Super\" || node.callee.type === \"V8IntrinsicExpression\") return;\n if (moduleMockCall(context.sourceCode, node.callee)) {\n context.report({ node, messageId: \"moduleMock\" });\n }\n },\n };\n },\n});\n","import { defineRule } from \"@oxlint/plugins\";\n\nimport type { ESTree } from \"@oxlint/plugins\";\n\nimport {\n\tfunctionParameterBindingName,\n\tfunctionParameterTypeAnnotation,\n} from \"../shared/function-parameters.ts\";\nimport {\n\tcreateTypeAliasEnvironment,\n\tresolvedTypeMatches,\n\ttype TypeAliasEnvironment,\n} from \"../shared/type-alias-resolution.ts\";\ntype ParameterOwner =\n\t| ESTree.ArrowFunctionExpression\n\t| ESTree.Function\n\t| ESTree.TSCallSignatureDeclaration\n\t| ESTree.TSConstructSignatureDeclaration\n\t| ESTree.TSConstructorType\n\t| ESTree.TSFunctionType\n\t| ESTree.TSMethodSignature;\n\n/** Ban the broad object type on function inputs, including local aliases to object. */\nexport const noObjectParametersRule = defineRule({\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow object function parameters; inputs must use an owner-provided type and be parsed at their boundary.\",\n\t\t},\n\t\tmessages: {\n\t\t\tobjectParameter:\n\t\t\t\t\"Parameter `{{parameter}}` uses the broad `object` type. Accept a named owner type; parse external input at its boundary before calling this function.\",\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tlet environment: TypeAliasEnvironment | null = null;\n\n\t\tconst resolvesToObject = (type: ESTree.TSType): boolean =>\n\t\t\tenvironment !== null &&\n\t\t\tresolvedTypeMatches(type, environment, (resolved, matches) => {\n\t\t\t\tif (resolved.type === \"TSObjectKeyword\") return true;\n\t\t\t\tif (resolved.type === \"TSParenthesizedType\") {\n\t\t\t\t\treturn matches(resolved.typeAnnotation);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\tresolved.type === \"TSUnionType\" && resolved.types.some(matches)\n\t\t\t\t);\n\t\t\t});\n\n\t\tconst checkParameters = (node: ParameterOwner) => {\n\t\t\tfor (const parameter of node.params) {\n\t\t\t\tconst annotation = functionParameterTypeAnnotation(parameter);\n\t\t\t\tif (annotation === null || annotation === undefined) continue;\n\t\t\t\tif (!resolvesToObject(annotation.typeAnnotation)) continue;\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: annotation.typeAnnotation,\n\t\t\t\t\tmessageId: \"objectParameter\",\n\t\t\t\t\tdata: { parameter: functionParameterBindingName(parameter, context.sourceCode) },\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\tProgram(node) {\n\t\t\t\tenvironment = createTypeAliasEnvironment(\n\t\t\t\t\tnode,\n\t\t\t\t\tcontext.sourceCode.visitorKeys,\n\t\t\t\t);\n\t\t\t},\n\t\t\tArrowFunctionExpression: checkParameters,\n\t\t\tFunctionDeclaration: checkParameters,\n\t\t\tFunctionExpression: checkParameters,\n\t\t\tTSCallSignatureDeclaration: checkParameters,\n\t\t\tTSConstructSignatureDeclaration: checkParameters,\n\t\t\tTSConstructorType: checkParameters,\n\t\t\tTSDeclareFunction: checkParameters,\n\t\t\tTSEmptyBodyFunctionExpression: checkParameters,\n\t\t\tTSFunctionType: checkParameters,\n\t\t\tTSMethodSignature: checkParameters,\n\t\t};\n\t},\n});\n","import { defineRule } from \"@oxlint/plugins\";\n\nimport { isGlobalReflectMethodCall } from \"../shared/reflect-method.ts\";\n\n/** Ban Reflect.apply, which bypasses ordinary typed function calls. */\nexport const noReflectApplyRule = defineRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow Reflect.apply; call typed functions directly or model dynamic dispatch behind an interface.\",\n },\n messages: {\n reflectApply:\n \"Replace `Reflect.apply` with a typed function call. Model dynamic dispatch behind a named interface.\",\n },\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n if (node.callee.type === \"Super\" || node.callee.type === \"V8IntrinsicExpression\") return;\n if (isGlobalReflectMethodCall(context.sourceCode, node.callee, \"apply\")) {\n context.report({ node, messageId: \"reflectApply\" });\n }\n },\n };\n },\n});\n","import { resolveVariable } from \"./scope.ts\";\n\nimport type { ESTree, SourceCode } from \"@oxlint/plugins\";\n\nfunction isGlobalReflect(sourceCode: SourceCode, expression: ESTree.Expression): boolean {\n if (expression.type !== \"Identifier\" || expression.name !== \"Reflect\") return false;\n if (sourceCode.isGlobalReference(expression)) return true;\n const variable = resolveVariable(sourceCode, expression);\n return variable === null || variable.defs.length === 0;\n}\n\n/** Reports whether a call target names one method on the global Reflect object. */\nexport function isGlobalReflectMethodCall(\n sourceCode: SourceCode,\n callee: ESTree.Expression,\n methodName: string,\n): boolean {\n if (!(\"property\" in callee) || !(\"object\" in callee) || !(\"computed\" in callee)) return false;\n if (!isGlobalReflect(sourceCode, callee.object)) return false;\n const property = callee.property;\n return callee.computed\n ? property.type === \"Literal\" && property.value === methodName\n : property.type === \"Identifier\" && property.name === methodName;\n}\n","import { defineRule } from \"@oxlint/plugins\";\n\nimport { isGlobalReflectMethodCall } from \"../shared/reflect-method.ts\";\n\n/** Ban Reflect.get, which bypasses ordinary property access and useful type evidence. */\nexport const noReflectGetRule = defineRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow Reflect.get; use typed property access or parse dynamic input into a domain type.\",\n },\n messages: {\n reflectGet:\n \"Replace `Reflect.get` with typed property access. Parse dynamic input into a named domain type before reading it.\",\n },\n },\n createOnce(context) {\n return {\n CallExpression(node) {\n if (node.callee.type === \"Super\" || node.callee.type === \"V8IntrinsicExpression\") return;\n if (isGlobalReflectMethodCall(context.sourceCode, node.callee, \"get\")) {\n context.report({ node, messageId: \"reflectGet\" });\n }\n },\n };\n },\n});\n","import { defineRule } from \"@oxlint/plugins\";\n\nimport type { ESTree } from \"@oxlint/plugins\";\n\ntype RuntimeFunction = ESTree.ArrowFunctionExpression | ESTree.Function;\n\nfunction isRuntimeFunction(node: ESTree.Node): node is RuntimeFunction {\n\treturn (\n\t\tnode.type === \"ArrowFunctionExpression\" ||\n\t\tnode.type === \"FunctionDeclaration\" ||\n\t\tnode.type === \"FunctionExpression\"\n\t);\n}\n\nfunction isInsideTypeGuard(node: ESTree.Node): boolean {\n\tlet current: ESTree.Node | null = node.parent;\n\twhile (current !== null && current.type !== \"Program\") {\n\t\tif (isRuntimeFunction(current)) {\n\t\t\treturn current.returnType?.typeAnnotation.type === \"TSTypePredicate\";\n\t\t}\n\t\tcurrent = current.parent;\n\t}\n\treturn false;\n}\n\n/** Return whether typeof safely probes for the existence of a possibly absent binding. */\nfunction isExistenceProbe(node: ESTree.UnaryExpression): boolean {\n\tconst parent = node.parent;\n\tif (parent.type !== \"BinaryExpression\") return false;\n\tif (![\"===\", \"!==\", \"==\", \"!=\"].includes(parent.operator)) return false;\n\tconst other = parent.left === node ? parent.right : parent.left;\n\treturn other.type === \"Literal\" && other.value === \"undefined\";\n}\n\n/** Disallow runtime typeof checks that narrow unparsed values instead of decoding them. */\nexport const noRuntimeTypeofRule = defineRule({\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow runtime typeof checks; external values must be decoded into meaningful types at their I/O boundary.\",\n\t\t},\n\t\tmessages: {\n\t\t\truntimeTypeof:\n\t\t\t\t\"A `typeof` check narrows a representation without establishing its contract. Parse input at its I/O boundary, then branch on the domain value.\",\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: \"object\",\n\t\t\t\tproperties: {\n\t\t\t\t\tallowInTypeGuards: { type: \"boolean\" },\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t\tdefaultOptions: [{ allowInTypeGuards: false }],\n\t},\n\tcreateOnce(context) {\n\t\treturn {\n\t\t\tUnaryExpression(node) {\n\t\t\t\tconst option = context.options?.[0];\n\t\t\t\tconst allowInTypeGuards =\n\t\t\t\t\ttypeof option === \"object\" &&\n\t\t\t\t\toption !== null &&\n\t\t\t\t\t!Array.isArray(option) &&\n\t\t\t\t\toption.allowInTypeGuards === true;\n\t\t\t\tif (\n\t\t\t\t\tnode.operator === \"typeof\" &&\n\t\t\t\t\t!isExistenceProbe(node) &&\n\t\t\t\t\t(!allowInTypeGuards || !isInsideTypeGuard(node))\n\t\t\t\t) {\n\t\t\t\t\tcontext.report({ node, messageId: \"runtimeTypeof\" });\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n});\n","import { defineRule } from \"@oxlint/plugins\";\nimport type { ESTree } from \"@oxlint/plugins\";\n\nconst FORBIDDEN_SYMBOL_NAME = \"shape\";\n\nfunction containsForbiddenSymbolName(name: string): boolean {\n return name.toLowerCase().includes(FORBIDDEN_SYMBOL_NAME);\n}\n\n/** Return whether an identifier names a statically accessed member owned by another value. */\nfunction isBorrowedMemberName(node: ESTree.Node): boolean {\n const parent = node.parent;\n if (parent === null || parent.type !== \"MemberExpression\") return false;\n return parent.property === node && parent.computed === false;\n}\n\n/** Ban the case-insensitive substring \"shape\" in every JavaScript and TypeScript symbol name. */\nexport const noForbiddenTermInSymbolNamesRule = defineRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n 'Disallow the case-insensitive substring \"shape\" in JavaScript, TypeScript, private, and JSX symbol names.',\n },\n messages: {\n forbiddenSymbolName:\n 'Rename symbol \"{{name}}\" for its domain role; \"shape\" describes structure rather than ownership.',\n },\n },\n createOnce(context) {\n const reportForbiddenSymbolName = (node: ESTree.Node & { name: string }) => {\n if (!containsForbiddenSymbolName(node.name) || isBorrowedMemberName(node)) return;\n context.report({\n node,\n messageId: \"forbiddenSymbolName\",\n data: { name: node.name },\n });\n };\n\n return {\n Identifier: reportForbiddenSymbolName,\n PrivateIdentifier: reportForbiddenSymbolName,\n JSXIdentifier: reportForbiddenSymbolName,\n };\n },\n});\n","import { defineRule } from \"@oxlint/plugins\";\nimport type { ESTree } from \"@oxlint/plugins\";\n\nimport {\n containsUnknownType,\n functionParameterBindingName,\n functionParameterTypeAnnotation,\n} from \"../shared/function-parameters.ts\";\ntype ParameterOwner =\n | ESTree.ArrowFunctionExpression\n | ESTree.Function\n | ESTree.TSCallSignatureDeclaration\n | ESTree.TSConstructSignatureDeclaration\n | ESTree.TSConstructorType\n | ESTree.TSFunctionType\n | ESTree.TSMethodSignature;\n\nfunction isTypePredicateSubject(owner: ParameterOwner, parameterName: string): boolean {\n const predicate = owner.returnType?.typeAnnotation;\n return (\n predicate?.type === \"TSTypePredicate\" &&\n predicate.parameterName.type === \"Identifier\" &&\n predicate.parameterName.name === parameterName\n );\n}\n\n/** Disallow unknown inputs except explicitly named error-cause enrichment. */\nexport const noUnknownParametersRule = defineRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow explicitly unknown function parameters except `cause` and type-predicate subjects; decode unknown input at its I/O boundary instead.\",\n },\n messages: {\n unknownParameter:\n \"Parameter `{{parameter}}` leaves input unparsed. Accept a named domain type; run the expected schema or parser at the I/O boundary before calling this function.\",\n },\n },\n createOnce(context) {\n const checkParameters = (node: ParameterOwner) => {\n for (const parameter of node.params) {\n const annotation = functionParameterTypeAnnotation(parameter);\n if (annotation === null || annotation === undefined) continue;\n if (!containsUnknownType(annotation.typeAnnotation)) continue;\n const name = functionParameterBindingName(parameter, context.sourceCode);\n if (name === \"cause\" || isTypePredicateSubject(node, name)) continue;\n context.report({\n node: annotation.typeAnnotation,\n messageId: \"unknownParameter\",\n data: { parameter: name },\n });\n }\n };\n\n return {\n ArrowFunctionExpression: checkParameters,\n FunctionDeclaration: checkParameters,\n FunctionExpression: checkParameters,\n TSCallSignatureDeclaration: checkParameters,\n TSConstructSignatureDeclaration: checkParameters,\n TSConstructorType: checkParameters,\n TSDeclareFunction: checkParameters,\n TSEmptyBodyFunctionExpression: checkParameters,\n TSFunctionType: checkParameters,\n TSMethodSignature: checkParameters,\n };\n },\n});\n","import { defineRule } from \"@oxlint/plugins\";\n\nimport type { ESTree } from \"@oxlint/plugins\";\n\nimport {\n createTypeAliasEnvironment,\n resolvedTypeMatches,\n type TypeAliasEnvironment,\n} from \"../shared/type-alias-resolution.ts\";\n\ntype FunctionWithReturnType =\n | ESTree.ArrowFunctionExpression\n | ESTree.Function\n | ESTree.TSCallSignatureDeclaration\n | ESTree.TSConstructSignatureDeclaration\n | ESTree.TSConstructorType\n | ESTree.TSFunctionType\n | ESTree.TSMethodSignature;\n\n/** Ban function contracts that return unknown instead of a parsed domain type. */\nexport const noUnknownReturnsRule = defineRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow functions whose explicit return contract is unknown or Promise<unknown>.\",\n },\n messages: {\n unknownReturn:\n \"This function exposes `unknown` to its caller. Parse the value at its boundary and return a named domain type.\",\n },\n },\n createOnce(context) {\n let environment: TypeAliasEnvironment | null = null;\n\n const resolvesToUnknown = (type: ESTree.TSType): boolean =>\n environment !== null &&\n resolvedTypeMatches(type, environment, (resolved, matches) => {\n if (resolved.type === \"TSUnknownKeyword\") return true;\n if (resolved.type === \"TSParenthesizedType\") {\n return matches(resolved.typeAnnotation);\n }\n if (resolved.type === \"TSUnionType\") return resolved.types.some(matches);\n if (\n resolved.type !== \"TSTypeReference\" ||\n resolved.typeName.type !== \"Identifier\" ||\n (resolved.typeName.name !== \"Promise\" &&\n resolved.typeName.name !== \"PromiseLike\")\n ) {\n return false;\n }\n const value = resolved.typeArguments?.params[0];\n return value !== undefined && matches(value);\n });\n\n const checkReturnType = (node: FunctionWithReturnType) => {\n const annotation = node.returnType;\n if (annotation === null || annotation === undefined) return;\n if (!resolvesToUnknown(annotation.typeAnnotation)) return;\n context.report({ node: annotation.typeAnnotation, messageId: \"unknownReturn\" });\n };\n\n return {\n Program(node) {\n environment = createTypeAliasEnvironment(\n node,\n context.sourceCode.visitorKeys,\n );\n },\n ArrowFunctionExpression: checkReturnType,\n FunctionDeclaration: checkReturnType,\n FunctionExpression: checkReturnType,\n TSCallSignatureDeclaration: checkReturnType,\n TSConstructSignatureDeclaration: checkReturnType,\n TSConstructorType: checkReturnType,\n TSDeclareFunction: checkReturnType,\n TSEmptyBodyFunctionExpression: checkReturnType,\n TSFunctionType: checkReturnType,\n TSMethodSignature: checkReturnType,\n };\n },\n});\n","import { defineRule } from \"@oxlint/plugins\";\n\nimport type { ESTree } from \"@oxlint/plugins\";\n\nimport {\n\tcreateTypeAliasEnvironment,\n\tresolvedTypeMatches,\n\ttype TypeAliasEnvironment,\n} from \"../shared/type-alias-resolution.ts\";\n\n/** Ban named aliases that merely conceal TypeScript's unknown top type. */\nexport const noUnknownTypeAliasesRule = defineRule({\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow type aliases whose resolved type is unknown; unknown must remain visible at an allowed boundary.\",\n\t\t},\n\t\tmessages: {\n\t\t\tunknownAlias:\n\t\t\t\t\"Type alias `{{alias}}` hides `unknown`. Keep `unknown` explicit at the parsing boundary or on an allowed `cause` field; otherwise use the parsed owner type.\",\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tlet environment: TypeAliasEnvironment | null = null;\n\n\t\tconst resolvesToUnknown = (type: ESTree.TSType): boolean =>\n\t\t\tenvironment !== null &&\n\t\t\tresolvedTypeMatches(type, environment, (resolved, matches) => {\n\t\t\t\tif (resolved.type === \"TSUnknownKeyword\") return true;\n\t\t\t\tif (resolved.type === \"TSParenthesizedType\") {\n\t\t\t\t\treturn matches(resolved.typeAnnotation);\n\t\t\t\t}\n\t\t\t\treturn resolved.type === \"TSUnionType\" && resolved.types.some(matches);\n\t\t\t});\n\n\t\treturn {\n\t\t\tProgram(node) {\n\t\t\t\tenvironment = createTypeAliasEnvironment(\n\t\t\t\t\tnode,\n\t\t\t\t\tcontext.sourceCode.visitorKeys,\n\t\t\t\t);\n\t\t\t},\n\t\t\tTSTypeAliasDeclaration(node) {\n\t\t\t\tif (!resolvesToUnknown(node.typeAnnotation)) return;\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: node.id,\n\t\t\t\t\tmessageId: \"unknownAlias\",\n\t\t\t\t\tdata: { alias: node.id.name },\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n});\n","import { defineRule } from \"@oxlint/plugins\";\n\nimport {\n\tclassifyUnsafeDictionary,\n\tclassifyUnsafeDictionaryValue,\n\tcreateTypeEnvironment,\n\ttype TypeEnvironment,\n} from \"../shared/dictionary-types.ts\";\nimport { visibleTypeAlias } from \"../shared/type-alias-resolution.ts\";\n\nimport type { ESTree } from \"@oxlint/plugins\";\n\nconst typeNodeKinds: ReadonlySet<string> = new Set([\n\t\"JSDocNonNullableType\",\n\t\"JSDocNullableType\",\n\t\"JSDocUnknownType\",\n\t\"TSAnyKeyword\",\n\t\"TSArrayType\",\n\t\"TSBigIntKeyword\",\n\t\"TSBooleanKeyword\",\n\t\"TSConditionalType\",\n\t\"TSConstructorType\",\n\t\"TSFunctionType\",\n\t\"TSImportType\",\n\t\"TSIndexedAccessType\",\n\t\"TSInferType\",\n\t\"TSIntersectionType\",\n\t\"TSIntrinsicKeyword\",\n\t\"TSLiteralType\",\n\t\"TSMappedType\",\n\t\"TSNamedTupleMember\",\n\t\"TSNeverKeyword\",\n\t\"TSNullKeyword\",\n\t\"TSNumberKeyword\",\n\t\"TSObjectKeyword\",\n\t\"TSParenthesizedType\",\n\t\"TSStringKeyword\",\n\t\"TSSymbolKeyword\",\n\t\"TSTemplateLiteralType\",\n\t\"TSThisType\",\n\t\"TSTupleType\",\n\t\"TSTypeLiteral\",\n\t\"TSTypeOperator\",\n\t\"TSTypePredicate\",\n\t\"TSTypeQuery\",\n\t\"TSTypeReference\",\n\t\"TSUndefinedKeyword\",\n\t\"TSUnionType\",\n\t\"TSUnknownKeyword\",\n\t\"TSVoidKeyword\",\n]);\n\nfunction isTypeNode(node: ESTree.Node): node is ESTree.TSType {\n\treturn typeNodeKinds.has(node.type);\n}\n\nfunction typeReferenceName(type: ESTree.TSTypeReference): string | null {\n\treturn type.typeName.type === \"Identifier\" ? type.typeName.name : null;\n}\n\nfunction isInsideTypeAliasDeclaration(node: ESTree.Node): boolean {\n\tlet current: ESTree.Node | null = node.parent;\n\twhile (current !== null && current.type !== \"Program\") {\n\t\tif (current.type === \"TSTypeAliasDeclaration\") return true;\n\t\tcurrent = current.parent;\n\t}\n\treturn false;\n}\n\nfunction isPlainAliasConsumerUse(node: ESTree.TSType, environment: TypeEnvironment): boolean {\n\tif (node.type !== \"TSTypeReference\" || node.typeArguments?.params.length) return false;\n\tconst name = typeReferenceName(node);\n\treturn (\n\t\tname !== null &&\n\t\tvisibleTypeAlias(name, node, environment.typeAliases) !== null &&\n\t\t!isInsideTypeAliasDeclaration(node)\n\t);\n}\n\nfunction isInsideTypeParameterConstraint(node: ESTree.TSType): boolean {\n\tlet child: ESTree.Node = node;\n\tlet parent: ESTree.Node | null = child.parent;\n\twhile (parent !== null && parent.type !== \"Program\") {\n\t\tif (parent.type === \"TSTypeParameter\" && parent.constraint === child) return true;\n\t\tchild = parent;\n\t\tparent = child.parent;\n\t}\n\treturn false;\n}\n\nfunction shouldReportType(node: ESTree.TSType, environment: TypeEnvironment): boolean {\n\tif (isInsideTypeParameterConstraint(node)) return false;\n\tif (isPlainAliasConsumerUse(node, environment)) return false;\n\tif (classifyUnsafeDictionary(node, environment) === null) return false;\n\tlet current: ESTree.Node | null = node.parent;\n\twhile (current !== null && current.type !== \"Program\") {\n\t\tif (isTypeNode(current) && classifyUnsafeDictionary(current, environment) !== null)\n\t\t\treturn false;\n\t\tcurrent = current.parent;\n\t}\n\treturn true;\n}\n\n/** Disallow object-dictionary contracts whose direct value type is an unsafe escape hatch. */\nexport const noUnsafeDictionaryTypeRule = defineRule({\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow object-dictionary contracts whose direct value type is unknown, any, object, {}, or a union/alias containing one of those escape hatches.\",\n\t\t},\n\t\tmessages: {\n\t\t\tunsafeDictionary:\n\t\t\t\t\"This dictionary's {{value}} value type gives callers no concrete value contract. Use an owner/schema-derived value type; parse external payloads before insertion.\",\n\t\t},\n\t},\n\tcreateOnce(context) {\n\t\tlet environment: TypeEnvironment | null = null;\n\t\tconst report = (node: ESTree.Node, value: string) => {\n\t\t\tcontext.report({ node, messageId: \"unsafeDictionary\", data: { value } });\n\t\t};\n\t\tconst reportIfUnsafe = (node: ESTree.TSType) => {\n\t\t\tif (environment === null || !shouldReportType(node, environment)) return;\n\t\t\tconst unsafe = classifyUnsafeDictionary(node, environment);\n\t\t\tif (unsafe === null) return;\n\t\t\treport(node, unsafe.unsafeValue);\n\t\t};\n\n\t\treturn {\n\t\t\tProgram(node) {\n\t\t\t\tenvironment = createTypeEnvironment(\n\t\t\t\t\tnode,\n\t\t\t\t\tcontext.sourceCode.visitorKeys,\n\t\t\t\t);\n\t\t\t},\n\t\t\tTSTypeReference: reportIfUnsafe,\n\t\t\tTSTypeLiteral: reportIfUnsafe,\n\t\t\tTSMappedType: reportIfUnsafe,\n\t\t\tTSIndexSignature(node) {\n\t\t\t\tif (\n\t\t\t\t\tenvironment === null ||\n\t\t\t\t\tnode.typeAnnotation === null ||\n\t\t\t\t\tnode.parent.type === \"TSTypeLiteral\"\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tconst unsafe = classifyUnsafeDictionaryValue(\n\t\t\t\t\tnode.typeAnnotation.typeAnnotation,\n\t\t\t\t\tenvironment,\n\t\t\t\t);\n\t\t\t\tif (unsafe !== null) report(node, unsafe.unsafeValue);\n\t\t\t},\n\t\t};\n\t},\n});\n","import { defineRule } from \"@oxlint/plugins\";\nimport type { ESTree, Variable } from \"@oxlint/plugins\";\n\ntype BroadTypeKind = \"top\" | \"object\" | \"record\";\n\ntype KnownValueEvidence = {\n readonly type: ESTree.TSType | null;\n};\n\nconst functionBoundaryTypes = new Set([\n \"ArrowFunctionExpression\",\n \"FunctionDeclaration\",\n \"FunctionExpression\",\n \"TSDeclareFunction\",\n \"TSEmptyBodyFunctionExpression\",\n]);\n\nfunction unwrapExpressionParentheses(expression: ESTree.Expression): ESTree.Expression {\n let current = expression;\n while (current.type === \"ParenthesizedExpression\") current = current.expression;\n return current;\n}\n\nfunction unwrapTypeParentheses(type: ESTree.TSType): ESTree.TSType {\n let current = type;\n while (current.type === \"TSParenthesizedType\") current = current.typeAnnotation;\n return current;\n}\n\nfunction typeReferenceName(type: ESTree.TSTypeReference): string | null {\n return type.typeName.type === \"Identifier\" ? type.typeName.name : null;\n}\n\nfunction isUnknownOrAnyType(type: ESTree.TSType): boolean {\n const unwrapped = unwrapTypeParentheses(type);\n return unwrapped.type === \"TSUnknownKeyword\" || unwrapped.type === \"TSAnyKeyword\";\n}\n\nfunction isBroadRecordKeyType(type: ESTree.TSType): boolean {\n const unwrapped = unwrapTypeParentheses(type);\n if (\n unwrapped.type === \"TSStringKeyword\" ||\n unwrapped.type === \"TSNumberKeyword\" ||\n unwrapped.type === \"TSSymbolKeyword\"\n ) {\n return true;\n }\n if (unwrapped.type === \"TSUnionType\") return unwrapped.types.every(isBroadRecordKeyType);\n return unwrapped.type === \"TSTypeReference\" && typeReferenceName(unwrapped) === \"PropertyKey\";\n}\n\nfunction isBroadRecordType(type: ESTree.TSType): boolean {\n const unwrapped = unwrapTypeParentheses(type);\n\n if (unwrapped.type === \"TSTypeReference\") {\n if (typeReferenceName(unwrapped) === \"Readonly\") {\n const [inner] = unwrapped.typeArguments?.params ?? [];\n return inner !== undefined && isBroadRecordType(inner);\n }\n\n if (typeReferenceName(unwrapped) !== \"Record\") return false;\n const parameters = unwrapped.typeArguments?.params ?? [];\n return (\n parameters.length === 2 &&\n parameters[0] !== undefined &&\n parameters[1] !== undefined &&\n isBroadRecordKeyType(parameters[0]) &&\n isUnknownOrAnyType(parameters[1])\n );\n }\n\n if (unwrapped.type !== \"TSTypeLiteral\" || unwrapped.members.length !== 1) return false;\n const [member] = unwrapped.members;\n const [parameter] = member?.type === \"TSIndexSignature\" ? member.parameters : [];\n return (\n member?.type === \"TSIndexSignature\" &&\n member.parameters.length === 1 &&\n parameter !== undefined &&\n isBroadRecordKeyType(parameter.typeAnnotation.typeAnnotation) &&\n isUnknownOrAnyType(member.typeAnnotation.typeAnnotation)\n );\n}\n\nfunction broadTypeKind(type: ESTree.TSType): BroadTypeKind | null {\n const unwrapped = unwrapTypeParentheses(type);\n if (unwrapped.type === \"TSUnknownKeyword\" || unwrapped.type === \"TSAnyKeyword\") return \"top\";\n if (unwrapped.type === \"TSObjectKeyword\") return \"object\";\n return isBroadRecordType(unwrapped) ? \"record\" : null;\n}\n\nfunction assertedExpression(\n node: ESTree.TSAsExpression | ESTree.TSTypeAssertion,\n): ESTree.Expression {\n return unwrapExpressionParentheses(node.expression);\n}\n\nfunction assertionFromExpression(\n expression: ESTree.Expression,\n): ESTree.TSAsExpression | ESTree.TSTypeAssertion | null {\n const unwrapped = unwrapExpressionParentheses(expression);\n return unwrapped.type === \"TSAsExpression\" || unwrapped.type === \"TSTypeAssertion\"\n ? unwrapped\n : null;\n}\n\nfunction normalizedTypeText(sourceText: string, type: ESTree.TSType): string {\n return sourceText.slice(type.start, type.end).replaceAll(/\\s+/gu, \"\");\n}\n\nfunction typesHaveSameSyntax(\n sourceText: string,\n left: ESTree.TSType | null,\n right: ESTree.TSType,\n): boolean {\n return (\n left !== null &&\n normalizedTypeText(sourceText, unwrapTypeParentheses(left)) ===\n normalizedTypeText(sourceText, unwrapTypeParentheses(right))\n );\n}\n\nfunction isDefinitelyObjectType(type: ESTree.TSType): boolean {\n const unwrapped = unwrapTypeParentheses(type);\n switch (unwrapped.type) {\n case \"TSArrayType\":\n case \"TSConstructorType\":\n case \"TSFunctionType\":\n case \"TSMappedType\":\n case \"TSObjectKeyword\":\n case \"TSTupleType\":\n return true;\n case \"TSTypeLiteral\":\n return unwrapped.members.length > 0;\n case \"TSIntersectionType\":\n return unwrapped.types.every(isDefinitelyObjectType);\n case \"TSTypeOperator\":\n return unwrapped.operator === \"readonly\" && isDefinitelyObjectType(unwrapped.typeAnnotation);\n default:\n return false;\n }\n}\n\nfunction isDefinitelyNarrowerRecordType(type: ESTree.TSType): boolean {\n const unwrapped = unwrapTypeParentheses(type);\n if (unwrapped.type === \"TSTypeLiteral\") {\n return unwrapped.members.some((member) => member.type !== \"TSIndexSignature\");\n }\n\n if (unwrapped.type !== \"TSTypeReference\") return false;\n if (typeReferenceName(unwrapped) === \"Readonly\") {\n const [inner] = unwrapped.typeArguments?.params ?? [];\n return inner !== undefined && isDefinitelyNarrowerRecordType(inner);\n }\n if (typeReferenceName(unwrapped) !== \"Record\") return false;\n\n const parameters = unwrapped.typeArguments?.params ?? [];\n return (\n parameters.length === 2 && parameters[1] !== undefined && !isUnknownOrAnyType(parameters[1])\n );\n}\n\nfunction functionBoundary(node: ESTree.Node): ESTree.Node | null {\n let current = node.parent;\n while (current !== null && current.type !== \"Program\") {\n if (functionBoundaryTypes.has(current.type)) return current;\n current = current.parent;\n }\n return null;\n}\n\nfunction resolvedVariableForIdentifier(\n scopes: readonly {\n readonly references: readonly {\n readonly identifier: ESTree.Node;\n readonly resolved: Variable | null;\n }[];\n }[],\n identifier: ESTree.IdentifierReference,\n): Variable | null {\n for (const scope of scopes) {\n const reference = scope.references.find(\n (candidate) =>\n candidate.identifier.start === identifier.start &&\n candidate.identifier.end === identifier.end,\n );\n if (reference !== undefined) return reference.resolved;\n }\n return null;\n}\n\nfunction variableDeclarator(variable: Variable): ESTree.VariableDeclarator | null {\n for (const definition of variable.defs) {\n if (definition.type === \"Variable\" && definition.node.type === \"VariableDeclarator\") {\n return definition.node;\n }\n }\n return null;\n}\n\nfunction knownValueEvidence(\n expression: ESTree.Expression,\n scopes: Parameters<typeof resolvedVariableForIdentifier>[0],\n boundary: ESTree.Node | null,\n visitedVariables: ReadonlySet<Variable>,\n): KnownValueEvidence | null {\n const unwrapped = unwrapExpressionParentheses(expression);\n\n if (unwrapped.type === \"TSAsExpression\" || unwrapped.type === \"TSTypeAssertion\") {\n if (broadTypeKind(unwrapped.typeAnnotation) !== null) return null;\n return { type: unwrapped.typeAnnotation };\n }\n\n if (unwrapped.type === \"Literal\" || unwrapped.type === \"TemplateLiteral\") {\n return { type: null };\n }\n\n if (\n unwrapped.type === \"ArrayExpression\" ||\n unwrapped.type === \"ArrowFunctionExpression\" ||\n unwrapped.type === \"ClassExpression\" ||\n unwrapped.type === \"FunctionExpression\" ||\n unwrapped.type === \"NewExpression\" ||\n unwrapped.type === \"ObjectExpression\"\n ) {\n return { type: null };\n }\n\n if (unwrapped.type !== \"Identifier\") return null;\n const variable = resolvedVariableForIdentifier(scopes, unwrapped);\n if (variable === null || visitedVariables.has(variable)) return null;\n\n const annotatedIdentifier = variable.identifiers.find(\n (identifier) => identifier.typeAnnotation !== null && identifier.typeAnnotation !== undefined,\n );\n const annotation = annotatedIdentifier?.typeAnnotation?.typeAnnotation;\n if (annotation !== undefined && annotatedIdentifier !== undefined) {\n if (functionBoundary(annotatedIdentifier) !== boundary || broadTypeKind(annotation) !== null) {\n return null;\n }\n return { type: annotation };\n }\n\n const declarator = variableDeclarator(variable);\n if (\n declarator === null ||\n declarator.parent.type !== \"VariableDeclaration\" ||\n declarator.parent.kind !== \"const\" ||\n declarator.init === null ||\n variable.references.some((reference) => reference.isWrite() && !reference.init) ||\n functionBoundary(declarator) !== boundary\n ) {\n return null;\n }\n\n return knownValueEvidence(\n declarator.init,\n scopes,\n boundary,\n new Set([...visitedVariables, variable]),\n );\n}\n\nfunction widenedBinding(\n variable: Variable,\n scopes: Parameters<typeof resolvedVariableForIdentifier>[0],\n): {\n readonly broadKind: BroadTypeKind;\n readonly evidence: KnownValueEvidence;\n readonly declaredAt: number;\n readonly boundary: ESTree.Node | null;\n} | null {\n const declarator = variableDeclarator(variable);\n if (\n declarator === null ||\n declarator.parent.type !== \"VariableDeclaration\" ||\n declarator.parent.kind !== \"const\" ||\n declarator.id.type !== \"Identifier\" ||\n declarator.init === null ||\n variable.references.some((reference) => reference.isWrite() && !reference.init)\n ) {\n return null;\n }\n\n const boundary = functionBoundary(declarator);\n const declaredType = declarator.id.typeAnnotation?.typeAnnotation;\n const initializerAssertion = assertionFromExpression(declarator.init);\n const initializerBroadKind =\n initializerAssertion === null ? null : broadTypeKind(initializerAssertion.typeAnnotation);\n const declaredBroadKind = declaredType === undefined ? null : broadTypeKind(declaredType);\n const broadKind = declaredBroadKind ?? initializerBroadKind;\n if (broadKind === null) return null;\n\n const originalExpression =\n initializerAssertion !== null && initializerBroadKind !== null\n ? assertedExpression(initializerAssertion)\n : declarator.init;\n const evidence = knownValueEvidence(originalExpression, scopes, boundary, new Set([variable]));\n return evidence === null ? null : { broadKind, evidence, declaredAt: declarator.end, boundary };\n}\n\nfunction assertionIsNarrower(\n sourceText: string,\n broadKind: BroadTypeKind,\n evidence: KnownValueEvidence,\n assertedType: ESTree.TSType,\n): boolean {\n if (broadTypeKind(assertedType) !== null) return false;\n if (broadKind === \"top\") return true;\n if (typesHaveSameSyntax(sourceText, evidence.type, assertedType)) return true;\n if (broadKind === \"object\") return isDefinitelyObjectType(assertedType);\n return isDefinitelyNarrowerRecordType(assertedType);\n}\n\n/** Detect immutable local bindings that erase a known type and are later asserted back to a narrower type. */\nexport const noWidenThenAssertRule = defineRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Disallow local const flows that explicitly widen a known value before asserting the widened binding to a narrower type.\",\n },\n messages: {\n widenThenAssert:\n 'Binding \"{{name}}\" discards type evidence and later recreates it with an assertion. Keep the precise type from initialization through use; parse boundary input once.',\n },\n },\n createOnce(context) {\n let scopes: Parameters<typeof resolvedVariableForIdentifier>[0] = [];\n\n const checkAssertion = (node: ESTree.TSAsExpression | ESTree.TSTypeAssertion) => {\n const expression = assertedExpression(node);\n if (expression.type !== \"Identifier\") return;\n\n const variable = resolvedVariableForIdentifier(scopes, expression);\n if (variable === null) return;\n const widened = widenedBinding(variable, scopes);\n if (\n widened === null ||\n node.start <= widened.declaredAt ||\n functionBoundary(node) !== widened.boundary ||\n !assertionIsNarrower(\n context.sourceCode.text,\n widened.broadKind,\n widened.evidence,\n node.typeAnnotation,\n )\n ) {\n return;\n }\n\n context.report({\n node,\n messageId: \"widenThenAssert\",\n data: { name: expression.name },\n });\n };\n\n return {\n Program() {\n scopes = context.sourceCode.scopeManager.scopes;\n },\n TSAsExpression: checkAssertion,\n TSTypeAssertion: checkAssertion,\n };\n },\n});\n","// Local replacements for the upstream helper imports. See UPSTREAM.md.\nimport type { ESTree, SourceCode, Token as SyntaxToken, Comment, Location } from \"@oxlint/plugins\";\n\ntype Token = SyntaxToken | Comment;\n\n/** Line terminators recognized by the upstream padding matcher. */\nexport const LINEBREAKS = new Set([\"\\r\\n\", \"\\r\", \"\\n\", \"\\u2028\", \"\\u2029\"]);\n\n/** Test a closing brace without treating comment text as punctuation. */\nexport const isClosingBraceToken = (token: Token): boolean =>\n token.type === \"Punctuator\" && token.value === \"}\";\n\n/** Test a semicolon without treating comment text as punctuation. */\nexport const isSemicolonToken = (token: Token): boolean =>\n token.type === \"Punctuator\" && token.value === \";\";\n\n/** Filter the optional final semicolon when identifying block-like statements. */\nexport const isNotSemicolonToken = (token: Token): boolean => !isSemicolonToken(token);\n\n/** Compare token/node boundaries, including attached comments. */\nexport const isTokenOnSameLine = (left: { loc: Location }, right: { loc: Location }): boolean =>\n left.loc.end.line === right.loc.start.line;\n\n/** Recognize declarations and expressions used by the upstream IIFE matcher. */\nexport const isFunction = (node: ESTree.Node): boolean =>\n node.type === \"FunctionDeclaration\" ||\n node.type === \"FunctionExpression\" ||\n node.type === \"ArrowFunctionExpression\";\n\n/** Preserve the upstream multiline statement heuristic. */\nexport const isSingleLine = (node: ESTree.Node): boolean =>\n node.loc.start.line === node.loc.end.line;\n\n/** Unwrap optional chaining before checking IIFE syntax. */\nexport const skipChainExpression = (node: ESTree.Node): ESTree.Node =>\n node.type === \"ChainExpression\" ? node.expression : node;\n\n/** Only a program or function-body expression can begin a directive prologue. */\nexport const isTopLevelExpressionStatement = (\n node: ESTree.Node,\n): node is ESTree.ExpressionStatement =>\n node.type === \"ExpressionStatement\" &&\n (node.parent.type === \"Program\" ||\n (node.parent.type === \"BlockStatement\" && isFunction(node.parent.parent)));\n\n/** A single wrapping pair suffices to exclude a string from directive syntax. */\nexport function isParenthesized(node: ESTree.Node, sourceCode: SourceCode): boolean {\n const before = sourceCode.getTokenBefore(node);\n const after = sourceCode.getTokenAfter(node);\n return before?.value === \"(\" && after?.value === \")\";\n}\n","// Vendored from ESLint Stylistic; see UPSTREAM.md and LICENSE in this directory.\nimport type { ESTree, Context as RuleContext, SourceCode, Token as SyntaxToken, Comment, CreateRule, Location } from '@oxlint/plugins'\ntype ASTNode = ESTree.Node\ntype Token = SyntaxToken | Comment\nimport type {\n PaddingType,\n SelectorOption,\n StatementMatcher,\n} from './padding-line-options.d.ts'\nimport {\n isClosingBraceToken,\n isFunction,\n isNotSemicolonToken,\n isParenthesized,\n isSemicolonToken,\n isSingleLine,\n isTokenOnSameLine,\n isTopLevelExpressionStatement,\n LINEBREAKS,\n skipChainExpression,\n} from './padding-line-ast.ts'\n\nconst CJS_EXPORT = /^(?:module\\s*\\.\\s*)?exports(?:\\s*\\.|\\s*\\[|$)/u\nconst CJS_IMPORT = /^require\\(/u\n\n/**\n * This rule is a replica of padding-line-between-statements.\n *\n * Ideally we would want to extend the rule support typescript specific support.\n * But since not all the state is exposed by the eslint and eslint has frozen stylistic rules,\n * (see - https://eslint.org/blog/2020/05/changes-to-rules-policies for details.)\n * we are forced to re-implement the rule here.\n *\n * We have tried to keep the implementation as close as possible to the eslint implementation, to make\n * patching easier for future contributors.\n *\n * Reference rule - https://github.com/eslint/eslint/blob/main/lib/rules/padding-line-between-statements.js\n */\n\ntype NodeTest = (\n node: ASTNode,\n sourceCode: SourceCode,\n) => boolean\n\nexport interface NodeTestObject {\n test: NodeTest\n}\n\n/**\n * A policy entry may name a caller-defined statement type (registered through\n * `createPaddingLineRule`) anywhere the upstream statement types are accepted.\n */\nexport type PolicyStatementOption<Extra extends string = never> =\n | StatementMatcher\n | Extra\n | [StatementMatcher | Extra, ...(StatementMatcher | Extra)[]]\n\nexport type PolicyOptions<Extra extends string = never> = {\n blankLine: PaddingType\n prev: PolicyStatementOption<Extra>\n next: PolicyStatementOption<Extra>\n}[]\n\nconst LT = `[${Array.from(LINEBREAKS).join('')}]`\nconst PADDING_LINE_SEQUENCE = new RegExp(\n String.raw`^(\\s*?${LT})\\s*${LT}(\\s*;?)$`,\n 'u',\n)\n\nfunction isSelectorOption(option: PolicyStatementOption<string>): option is SelectorOption {\n return typeof option === 'object' && !Array.isArray(option)\n}\n\n/**\n * Creates tester which check if a node starts with specific keyword with the\n * appropriate AST_NODE_TYPES.\n * @param keyword The keyword to test.\n * @returns the created tester.\n * @private\n */\nfunction newKeywordTester(\n type: string | string[],\n keyword: string,\n): NodeTestObject {\n return {\n test(node, sourceCode): boolean {\n const isSameKeyword = sourceCode.getFirstToken(node)?.value === keyword\n const isSameType = Array.isArray(type)\n ? type.includes(node.type)\n : type === node.type\n\n return isSameKeyword && isSameType\n },\n }\n}\n\n/**\n * Creates tester which check if a node is specific type.\n * @param type The node type to test.\n * @returns the created tester.\n * @private\n */\nfunction newNodeTypeTester(type: string): NodeTestObject {\n return {\n test: (node): boolean => node.type === type,\n }\n}\n\n/**\n * Checks the given node is an expression statement of IIFE.\n * @param node The node to check.\n * @returns `true` if the node is an expression statement of IIFE.\n * @private\n */\nfunction isIIFEStatement(node: ASTNode): boolean {\n if (node.type === 'ExpressionStatement') {\n let expression = skipChainExpression(node.expression)\n if (expression.type === 'UnaryExpression')\n expression = skipChainExpression(expression.argument)\n\n if (expression.type === 'CallExpression') {\n let node: ASTNode = expression.callee\n while (node.type === 'SequenceExpression') {\n const lastExpression = node.expressions.at(-1)\n if (lastExpression === undefined)\n throw new Error('Padding rule invariant: sequence expression is empty')\n node = lastExpression\n }\n\n return isFunction(node)\n }\n }\n return false\n}\n\n/**\n * Checks the given node is a CommonJS require statement\n * @param node The node to check.\n * @returns `true` if the node is a CommonJS require statement.\n * @private\n */\nfunction isCJSRequire(node: ASTNode): boolean {\n if (node.type === 'VariableDeclaration') {\n const declaration = node.declarations[0]\n if (declaration?.init) {\n let call = declaration?.init\n while (call.type === 'MemberExpression')\n call = call.object\n\n if (\n call.type === 'CallExpression'\n && call.callee.type === 'Identifier'\n ) {\n return call.callee.name === 'require'\n }\n }\n }\n return false\n}\n\n/**\n * Checks whether the given node is a block-like statement.\n * This checks the last token of the node is the closing brace of a block.\n * @param sourceCode The source code to get tokens.\n * @param node The node to check.\n * @returns `true` if the node is a block-like statement.\n * @private\n */\nfunction isBlockLikeStatement(\n node: ASTNode,\n sourceCode: SourceCode,\n): boolean {\n // do-while with a block is a block-like statement.\n if (\n node.type === 'DoWhileStatement'\n && node.body.type === 'BlockStatement'\n ) {\n return true\n }\n\n /**\n * IIFE is a block-like statement specially from\n * JSCS#disallowPaddingNewLinesAfterBlocks.\n */\n if (isIIFEStatement(node))\n return true\n\n // Checks the last token is a closing brace of blocks.\n const lastToken = sourceCode.getLastToken(node, isNotSemicolonToken)\n const belongingNode\n = lastToken && isClosingBraceToken(lastToken)\n ? sourceCode.getNodeByRangeIndex(lastToken.range[0])\n : null\n\n return (\n !!belongingNode\n && (belongingNode.type === 'BlockStatement'\n || belongingNode.type === 'SwitchStatement')\n )\n}\n\n/**\n * Check whether the given node is a directive or not.\n * @param node The node to check.\n * @param sourceCode The source code object to get tokens.\n * @returns `true` if the node is a directive.\n */\nfunction isDirective(\n node: ASTNode,\n sourceCode: SourceCode,\n): boolean {\n return (\n isTopLevelExpressionStatement(node)\n && node.expression.type === 'Literal'\n && typeof node.expression.value === 'string'\n && !isParenthesized(node.expression, sourceCode)\n )\n}\n\n/**\n * Check whether the given node is a part of directive prologue or not.\n * @param node The node to check.\n * @param sourceCode The source code object to get tokens.\n * @returns `true` if the node is a part of directive prologue.\n */\nfunction isDirectivePrologue(\n node: ASTNode,\n sourceCode: SourceCode,\n): boolean {\n if (\n isDirective(node, sourceCode)\n && node.parent\n && 'body' in node.parent\n && Array.isArray(node.parent.body)\n ) {\n for (const sibling of node.parent.body) {\n if (sibling === node)\n break\n\n if (!isDirective(sibling, sourceCode))\n return false\n }\n return true\n }\n return false\n}\n\n/**\n * Checks the given node is a CommonJS export statement\n * @param node The node to check.\n * @returns `true` if the node is a CommonJS export statement.\n * @private\n */\nfunction isCJSExport(node: ASTNode): boolean {\n if (node.type === 'ExpressionStatement') {\n const expression = node.expression\n if (expression.type === 'AssignmentExpression') {\n let left = expression.left\n if (left.type === 'MemberExpression') {\n while (left.object.type === 'MemberExpression')\n left = left.object\n\n return (\n left.object.type === 'Identifier'\n && (left.object.name === 'exports'\n || (left.object.name === 'module'\n && left.property.type === 'Identifier'\n && left.property.name === 'exports'))\n )\n }\n }\n }\n return false\n}\n\n/**\n * Check whether the given node is an expression\n * @param node The node to check.\n * @param sourceCode The source code object to get tokens.\n * @returns `true` if the node is an expression\n */\nfunction isExpression(\n node: ASTNode,\n sourceCode: SourceCode,\n): boolean {\n return (\n node.type === 'ExpressionStatement'\n && !isDirectivePrologue(node, sourceCode)\n )\n}\n\n/**\n * Gets the actual last token.\n *\n * If a semicolon is semicolon-less style's semicolon, this ignores it.\n * For example:\n *\n * foo()\n * ;[1, 2, 3].forEach(bar)\n * @param sourceCode The source code to get tokens.\n * @param node The node to get.\n * @returns The actual last token.\n * @private\n */\nfunction getActualLastToken(\n node: ASTNode,\n sourceCode: SourceCode,\n): Token | null {\n const semiToken = sourceCode.getLastToken(node)!\n const prevToken = sourceCode.getTokenBefore(semiToken)\n const nextToken = sourceCode.getTokenAfter(semiToken)\n const isSemicolonLessStyle\n = prevToken\n && nextToken\n && prevToken.range[0] >= node.range[0]\n && isSemicolonToken(semiToken)\n && !isTokenOnSameLine(prevToken, semiToken)\n && isTokenOnSameLine(semiToken, nextToken)\n\n return isSemicolonLessStyle ? prevToken : semiToken\n}\n\n/**\n * This returns the concatenation of the first 2 captured strings.\n * @param _ Unused. Whole matched string.\n * @param trailingSpaces The trailing spaces of the first line.\n * @param indentSpaces The indentation spaces of the last line.\n * @returns The concatenation of trailingSpaces and indentSpaces.\n * @private\n */\nfunction replacerToRemovePaddingLines(\n _: string,\n trailingSpaces: string,\n indentSpaces: string,\n): string {\n return trailingSpaces + indentSpaces\n}\n\nfunction getReportLoc(node: ASTNode, sourceCode: SourceCode): Location {\n if (isSingleLine(node))\n return node.loc\n\n const line = node.loc.start.line\n const sourceLine = sourceCode.lines[line - 1]\n if (sourceLine === undefined)\n throw new Error('Padding rule invariant: statement source line is missing')\n\n return {\n start: node.loc.start,\n end: {\n line,\n column: sourceLine.length,\n },\n }\n}\n\n/**\n * Check and report statements for `any` configuration.\n * It does nothing.\n *\n * @private\n */\nfunction verifyForAny(): void {\n // Empty\n}\n\n/**\n * Check and report statements for `never` configuration.\n * This autofix removes blank lines between the given 2 statements.\n * However, if comments exist between 2 blank lines, it does not remove those\n * blank lines automatically.\n * @param context The rule context to report.\n * @param _ Unused. The previous node to check.\n * @param nextNode The next node to check.\n * @param paddingLines The array of token pairs that blank\n * lines exist between the pair.\n *\n * @private\n */\nfunction verifyForNever(\n context: RuleContext,\n _: ASTNode,\n nextNode: ASTNode,\n paddingLines: [Token, Token][],\n): void {\n if (paddingLines.length === 0)\n return\n\n context.report({\n node: nextNode,\n messageId: 'unexpectedBlankLine',\n loc: getReportLoc(nextNode, context.sourceCode),\n fix(fixer) {\n if (paddingLines.length >= 2)\n return null\n\n const paddingPair = paddingLines[0]\n if (paddingPair === undefined)\n throw new Error('Padding rule invariant: reported padding pair is missing')\n const [prevToken, nextToken] = paddingPair\n const start = prevToken.range[1]\n const end = nextToken.range[0]\n const text = context\n .sourceCode\n .text\n .slice(start, end)\n .replace(PADDING_LINE_SEQUENCE, replacerToRemovePaddingLines)\n\n return fixer.replaceTextRange([start, end], text)\n },\n })\n}\n\n/**\n * Check and report statements for `always` configuration.\n * This autofix inserts a blank line between the given 2 statements.\n * If the `prevNode` has trailing comments, it inserts a blank line after the\n * trailing comments.\n * @param context The rule context to report.\n * @param prevNode The previous node to check.\n * @param nextNode The next node to check.\n * @param paddingLines The array of token pairs that blank\n * lines exist between the pair.\n *\n * @private\n */\nfunction verifyForAlways(\n context: RuleContext,\n prevNode: ASTNode,\n nextNode: ASTNode,\n paddingLines: [Token, Token][],\n): void {\n if (paddingLines.length > 0)\n return\n\n context.report({\n node: nextNode,\n messageId: 'expectedBlankLine',\n loc: getReportLoc(nextNode, context.sourceCode),\n fix(fixer) {\n const sourceCode = context.sourceCode\n let prevToken = getActualLastToken(prevNode, sourceCode)!\n const nextToken\n = sourceCode.getFirstTokenBetween(prevToken, nextNode, {\n includeComments: true,\n\n /**\n * Skip the trailing comments of the previous node.\n * This inserts a blank line after the last trailing comment.\n *\n * For example:\n *\n * foo(); // trailing comment.\n * // comment.\n * bar();\n *\n * Get fixed to:\n *\n * foo(); // trailing comment.\n *\n * // comment.\n * bar();\n * @param token The token to check.\n * @returns `true` if the token is not a trailing comment.\n * @private\n */\n filter(token) {\n if (isTokenOnSameLine(prevToken, token)) {\n prevToken = token\n return false\n }\n return true\n },\n })! || nextNode\n const insertText = isTokenOnSameLine(prevToken, nextToken)\n ? '\\n\\n'\n : '\\n'\n\n return fixer.insertTextAfter(prevToken, insertText)\n },\n })\n}\n\n/**\n * Types of blank lines.\n * `any`, `never`, and `always` are defined.\n * Those have `verify` method to check and report statements.\n * @private\n */\nconst PaddingTypes = {\n any: { verify: verifyForAny },\n never: { verify: verifyForNever },\n always: { verify: verifyForAlways },\n}\n\nconst MaybeMultilineStatementType: Record<string, NodeTestObject> = {\n 'block-like': { test: isBlockLikeStatement },\n 'expression': { test: isExpression },\n 'return': newKeywordTester('ReturnStatement', 'return'),\n 'export': newKeywordTester(\n [\n 'ExportAllDeclaration',\n 'ExportDefaultDeclaration',\n 'ExportNamedDeclaration',\n ],\n 'export',\n ),\n 'var': newKeywordTester('VariableDeclaration', 'var'),\n 'let': newKeywordTester('VariableDeclaration', 'let'),\n 'const': newKeywordTester('VariableDeclaration', 'const'),\n 'using': {\n test: node => node.type === 'VariableDeclaration'\n && (node.kind === 'using' || node.kind === 'await using'),\n },\n 'type': newKeywordTester('TSTypeAliasDeclaration', 'type'),\n}\n\n/**\n * Types of statements.\n * Those have `test` method to check it matches to the given statement.\n * @private\n */\nconst StatementTypes: Record<string, NodeTestObject> = {\n '*': { test: (): boolean => true },\n 'exports': { test: isCJSExport },\n 'require': { test: isCJSRequire },\n 'directive': { test: isDirectivePrologue },\n 'iife': { test: isIIFEStatement },\n\n 'block': newNodeTypeTester('BlockStatement'),\n 'empty': newNodeTypeTester('EmptyStatement'),\n 'function': newNodeTypeTester('FunctionDeclaration'),\n 'ts-method': newNodeTypeTester('TSMethodSignature'),\n\n 'break': newKeywordTester('BreakStatement', 'break'),\n 'case': newKeywordTester('SwitchCase', 'case'),\n 'class': newKeywordTester('ClassDeclaration', 'class'),\n 'continue': newKeywordTester('ContinueStatement', 'continue'),\n 'debugger': newKeywordTester('DebuggerStatement', 'debugger'),\n 'default': newKeywordTester(\n ['SwitchCase', 'ExportDefaultDeclaration'],\n 'default',\n ),\n 'do': newKeywordTester('DoWhileStatement', 'do'),\n 'for': newKeywordTester(\n [\n 'ForStatement',\n 'ForInStatement',\n 'ForOfStatement',\n ],\n 'for',\n ),\n 'if': newKeywordTester('IfStatement', 'if'),\n 'import': newKeywordTester('ImportDeclaration', 'import'),\n 'switch': newKeywordTester('SwitchStatement', 'switch'),\n 'throw': newKeywordTester('ThrowStatement', 'throw'),\n 'try': newKeywordTester('TryStatement', 'try'),\n 'while': newKeywordTester(\n ['WhileStatement', 'DoWhileStatement'],\n 'while',\n ),\n 'with': newKeywordTester('WithStatement', 'with'),\n\n 'cjs-export': {\n test: (node, sourceCode) => node.type === 'ExpressionStatement'\n && node.expression.type === 'AssignmentExpression'\n && CJS_EXPORT.test(sourceCode.getText(node.expression.left)),\n },\n 'cjs-import': {\n test: (node, sourceCode) => node.type === 'VariableDeclaration'\n && node.declarations.length > 0\n && node.declarations[0]?.init != null\n && CJS_IMPORT.test(sourceCode.getText(node.declarations[0].init)),\n },\n\n 'enum': newKeywordTester(\n 'TSEnumDeclaration',\n 'enum',\n ),\n 'interface': newKeywordTester(\n 'TSInterfaceDeclaration',\n 'interface',\n ),\n 'function-overload': newNodeTypeTester('TSDeclareFunction'),\n ...Object.fromEntries(\n Object.entries(MaybeMultilineStatementType)\n .flatMap(([key, value]) => [\n [key, value],\n [\n `singleline-${key}`,\n {\n ...value,\n test: (node, sourceCode) => value.test(node, sourceCode) && isSingleLine(node),\n },\n ],\n [\n `multiline-${key}`,\n {\n ...value,\n test: (node, sourceCode) => value.test(node, sourceCode) && !isSingleLine(node),\n },\n ],\n ]),\n ),\n}\n\n/**\n * Build the vendored padding rule with caller-owned, typed policy options.\n * `statementTypes` registers caller-defined statement types, looked up before\n * the upstream table, for syntax the upstream matchers do not distinguish.\n */\nexport default function createPaddingLineRule<Extra extends string = never>(\n options: PolicyOptions<NoInfer<Extra>>,\n statementTypes?: Record<Extra, NodeTestObject>,\n): CreateRule {\nconst customStatementTypes: Partial<Record<string, NodeTestObject>> = statementTypes ?? {}\nreturn {\n meta: {\n type: 'layout',\n docs: {\n description: 'Require or disallow padding lines between statements',\n },\n fixable: 'whitespace',\n hasSuggestions: false,\n // This is intentionally an array schema as you can pass 0..n config objects\n schema: {\n $defs: {\n paddingType: {\n type: 'string',\n enum: Object.keys(PaddingTypes),\n },\n statementType: {\n type: 'string',\n enum: Object.keys(StatementTypes),\n },\n selectorOption: {\n type: 'object',\n properties: {\n selector: {\n type: 'string',\n },\n lineMode: {\n type: 'string',\n enum: ['any', 'singleline', 'multiline'],\n },\n },\n required: ['selector'],\n additionalProperties: false,\n },\n statementMatcher: {\n anyOf: [\n { $ref: '#/$defs/statementType' },\n { $ref: '#/$defs/selectorOption' },\n ],\n },\n statementOption: {\n anyOf: [\n { $ref: '#/$defs/statementMatcher' },\n {\n type: 'array',\n items: { $ref: '#/$defs/statementMatcher' },\n minItems: 1,\n uniqueItems: true,\n additionalItems: false,\n },\n ],\n },\n },\n type: 'array',\n additionalItems: false,\n items: {\n type: 'object',\n properties: {\n blankLine: { $ref: '#/$defs/paddingType' },\n prev: { $ref: '#/$defs/statementOption' },\n next: { $ref: '#/$defs/statementOption' },\n },\n additionalProperties: false,\n required: ['blankLine', 'prev', 'next'],\n },\n },\n messages: {\n unexpectedBlankLine: 'Unexpected blank line before this statement.',\n expectedBlankLine: 'Expected blank line before this statement.',\n },\n },\n create(context) {\n const sourceCode = context.sourceCode\n\n const selectorMatchedNodes = new Map<string, Set<ASTNode>>()\n const pendingPairs: { prevNode: ASTNode, nextNode: ASTNode }[] = []\n\n function collectSelectorOption(option: PolicyStatementOption<Extra>): void {\n if (Array.isArray(option)) {\n for (const item of option)\n collectSelectorOption(item)\n return\n }\n\n if (!isSelectorOption(option))\n return\n\n selectorMatchedNodes.set(option.selector, new Set())\n }\n\n for (const configure of options) {\n collectSelectorOption(configure.prev)\n collectSelectorOption(configure.next)\n }\n\n type Scope = {\n upper: Scope\n prevNode: ASTNode | null\n } | null\n\n let scopeInfo: Scope = null\n\n /**\n * Processes to enter to new scope.\n * This manages the current previous statement.\n *\n * @private\n */\n function enterScope(): void {\n scopeInfo = {\n upper: scopeInfo,\n prevNode: null,\n }\n }\n\n /**\n * Processes to exit from the current scope.\n *\n * @private\n */\n function exitScope(): void {\n if (scopeInfo)\n scopeInfo = scopeInfo.upper\n }\n\n /**\n * Checks whether the given node matches the given type.\n * @param node The statement node to check.\n * @param type The statement type to check.\n * @returns `true` if the statement node matched the type.\n * @private\n */\n function match(node: ASTNode, type: PolicyStatementOption<Extra>): boolean {\n let innerStatementNode = node\n\n while (innerStatementNode.type === 'LabeledStatement')\n innerStatementNode = innerStatementNode.body\n\n if (Array.isArray(type))\n return type.some(match.bind(null, innerStatementNode))\n\n if (isSelectorOption(type)) {\n const matchedNodes = selectorMatchedNodes.get(type.selector)\n if (!matchedNodes?.has(innerStatementNode))\n return false\n\n const lineMode = type.lineMode\n\n if (lineMode === 'singleline')\n return isSingleLine(innerStatementNode)\n else if (lineMode === 'multiline')\n return !isSingleLine(innerStatementNode)\n\n return true\n }\n else {\n const statementType = customStatementTypes[type] ?? StatementTypes[type]\n if (statementType === undefined)\n throw new Error(`Padding rule invariant: unsupported statement type ${type}`)\n return statementType.test(innerStatementNode, sourceCode)\n }\n }\n\n /**\n * Finds the last matched configure from options.\n * @param prevNode The previous statement to match.\n * @param nextNode The current statement to match.\n * @returns The tester of the last matched configure.\n * @private\n */\n function getPaddingType(\n prevNode: ASTNode,\n nextNode: ASTNode,\n ): (typeof PaddingTypes)[keyof typeof PaddingTypes] {\n for (let i = options.length - 1; i >= 0; --i) {\n const configure = options[i]\n if (configure === undefined)\n throw new Error('Padding rule invariant: configuration entry is missing')\n if (\n match(prevNode, configure.prev)\n && match(nextNode, configure.next)\n ) {\n return PaddingTypes[configure.blankLine]\n }\n }\n return PaddingTypes.any\n }\n\n /**\n * Gets padding line sequences between the given 2 statements.\n * Comments are separators of the padding line sequences.\n * @param prevNode The previous statement to count.\n * @param nextNode The current statement to count.\n * @returns The array of token pairs.\n * @private\n */\n function getPaddingLineSequences(\n prevNode: ASTNode,\n nextNode: ASTNode,\n ): [Token, Token][] {\n const pairs: [Token, Token][] = []\n let prevToken: Token = getActualLastToken(prevNode, sourceCode)!\n\n if (nextNode.loc.start.line - prevToken.loc.end.line >= 2) {\n do {\n const token: Token = sourceCode.getTokenAfter(prevToken, {\n includeComments: true,\n })!\n\n if (token.loc.start.line - prevToken.loc.end.line >= 2)\n pairs.push([prevToken, token])\n\n prevToken = token\n } while (prevToken.range[0] < nextNode.range[0])\n }\n\n return pairs\n }\n\n /**\n * Verify padding lines between the given node and the previous node.\n * @param node The node to verify.\n *\n * @private\n */\n function verify(node: ASTNode): void {\n if (\n !node.parent\n || ![\n 'BlockStatement',\n 'Program',\n 'StaticBlock',\n 'SwitchCase',\n 'SwitchStatement',\n 'TSInterfaceBody',\n 'TSModuleBlock',\n 'TSTypeLiteral',\n ].includes(node.parent.type)\n ) {\n return\n }\n\n // Save this node as the current previous statement.\n const prevNode = scopeInfo!.prevNode\n\n // Verify.\n if (prevNode)\n pendingPairs.push({ prevNode, nextNode: node })\n\n scopeInfo!.prevNode = node\n }\n\n function verifyPendingPairs(): void {\n for (const { prevNode, nextNode } of pendingPairs) {\n const type = getPaddingType(prevNode, nextNode)\n const paddingLines = getPaddingLineSequences(prevNode, nextNode)\n\n type.verify(context, prevNode, nextNode, paddingLines)\n }\n }\n\n /**\n * Verify padding lines between the given node and the previous node.\n * Then process to enter to new scope.\n * @param node The node to verify.\n *\n * @private\n */\n function verifyThenEnterScope(node: ASTNode): void {\n verify(node)\n enterScope()\n }\n\n const selectorMatchListeners = Object.fromEntries(\n Array.from(selectorMatchedNodes.keys(), selector => [\n selector,\n (node: ASTNode): void => {\n selectorMatchedNodes.get(selector)?.add(node)\n },\n ]),\n )\n\n return {\n 'Program': enterScope,\n 'Program:exit': () => {\n verifyPendingPairs()\n exitScope()\n },\n 'BlockStatement': enterScope,\n 'BlockStatement:exit': exitScope,\n 'SwitchStatement': enterScope,\n 'SwitchStatement:exit': exitScope,\n 'SwitchCase': verifyThenEnterScope,\n 'SwitchCase:exit': exitScope,\n 'StaticBlock': enterScope,\n 'StaticBlock:exit': exitScope,\n\n 'TSInterfaceBody': enterScope,\n 'TSInterfaceBody:exit': exitScope,\n 'TSModuleBlock': enterScope,\n 'TSModuleBlock:exit': exitScope,\n 'TSTypeLiteral': enterScope,\n 'TSTypeLiteral:exit': exitScope,\n 'TSDeclareFunction': verifyThenEnterScope,\n 'TSDeclareFunction:exit': exitScope,\n 'TSMethodSignature': verifyThenEnterScope,\n 'TSMethodSignature:exit': exitScope,\n\n ':statement': verify,\n ...selectorMatchListeners,\n }\n },\n}\n}\n","import type { CreateRule, ESTree, SourceCode } from \"@oxlint/plugins\";\n\nimport createPaddingLineRule from \"../vendor/eslint-stylistic/padding-line-between-statements.ts\";\n\nimport type { NodeTestObject } from \"../vendor/eslint-stylistic/padding-line-between-statements.ts\";\n\n/** A `const`/`let`/`var`/`using` declaration, optionally exported, written on one line. */\nfunction isSinglelineBinding(node: ESTree.Node): boolean {\n const declaration = node.type === \"ExportNamedDeclaration\" ? node.declaration : node;\n return declaration?.type === \"VariableDeclaration\" && node.loc.start.line === node.loc.end.line;\n}\n\n/** Comments above a statement belong to it; a comment trailing the previous line does not. */\nfunction hasLeadingComment(node: ESTree.Node, sourceCode: SourceCode): boolean {\n const previousLine = sourceCode.getTokenBefore(node)?.loc.end.line;\n return sourceCode\n .getCommentsBefore(node)\n .some((comment) => comment.loc.start.line !== previousLine);\n}\n\nconst singlelineBinding: NodeTestObject = {\n test: (node) => isSinglelineBinding(node),\n};\n\nconst undocumentedSinglelineBinding: NodeTestObject = {\n test: (node, sourceCode) => isSinglelineBinding(node) && !hasLeadingComment(node, sourceCode),\n};\n\nconst paddingRule = createPaddingLineRule(\n [\n { blankLine: \"always\", prev: \"import\", next: \"*\" },\n { blankLine: \"always\", prev: \"*\", next: { selector: \"Program > :not(ImportDeclaration)\" } },\n { blankLine: \"always\", prev: { selector: \"Program > :not(ImportDeclaration)\" }, next: \"*\" },\n { blankLine: \"always\", prev: \"*\", next: [\"function\", \"class\", \"interface\", \"type\"] },\n { blankLine: \"always\", prev: [\"function\", \"class\", \"interface\", \"type\"], next: \"*\" },\n {\n blankLine: \"always\",\n prev: \"*\",\n next: [\"multiline-const\", \"multiline-let\", \"multiline-var\", \"multiline-using\"],\n },\n {\n blankLine: \"always\",\n prev: [\"multiline-const\", \"multiline-let\", \"multiline-var\", \"multiline-using\"],\n next: \"*\",\n },\n { blankLine: \"always\", prev: \"*\", next: [\"return\", \"if\", \"switch\", \"try\", \"for\", \"while\", \"do\"] },\n { blankLine: \"always\", prev: \"block-like\", next: \"*\" },\n { blankLine: \"any\", prev: \"import\", next: \"import\" },\n // Consecutive single-line bindings form one group at any scope, including\n // module scope. A binding with its own leading comment starts a new group.\n { blankLine: \"any\", prev: \"singleline-binding\", next: \"undocumented-singleline-binding\" },\n {\n blankLine: \"any\",\n prev: {\n selector:\n ':matches(TSDeclareFunction, ExportNamedDeclaration[declaration.type=\"TSDeclareFunction\"])',\n },\n next: {\n selector:\n ':matches(TSDeclareFunction, FunctionDeclaration, ExportNamedDeclaration[declaration.type=\"TSDeclareFunction\"], ExportNamedDeclaration[declaration.type=\"FunctionDeclaration\"])',\n },\n },\n ],\n {\n \"singleline-binding\": singlelineBinding,\n \"undocumented-singleline-binding\": undocumentedSinglelineBinding,\n },\n);\n\n/** Restore structural blank lines with whitespace-only fixes; keep single-line binding groups and overloads grouped. */\nexport const requireReadableSpacingRule: CreateRule = {\n ...paddingRule,\n meta: {\n ...paddingRule.meta,\n docs: {\n description: \"Require readable spacing between declarations and logical statement groups.\",\n },\n schema: [],\n },\n};\n","import { defineRule } from \"@oxlint/plugins\";\n\nimport type { ESTree, SourceCode } from \"@oxlint/plugins\";\n\ntype TypeAssertion = ESTree.TSAsExpression | ESTree.TSTypeAssertion;\n\nconst DEFAULT_SAFETY_MARKERS = [\"SAFETY\"] as const;\n\nconst commentOwnerKinds = new Set([\n \"ExpressionStatement\",\n \"PropertyDefinition\",\n \"ReturnStatement\",\n \"ThrowStatement\",\n \"VariableDeclaration\",\n]);\n\nfunction isConstAssertion(node: TypeAssertion): boolean {\n return (\n node.typeAnnotation.type === \"TSTypeReference\" &&\n node.typeAnnotation.typeName.type === \"Identifier\" &&\n node.typeAnnotation.typeName.name === \"const\"\n );\n}\n\nfunction configuredSafetyMarkers(option: unknown): readonly string[] {\n if (typeof option !== \"object\" || option === null || !(\"markers\" in option)) {\n return DEFAULT_SAFETY_MARKERS;\n }\n const configured = option.markers;\n if (!Array.isArray(configured)) return DEFAULT_SAFETY_MARKERS;\n const markers = configured.flatMap((marker) =>\n typeof marker === \"string\" && marker.trim().length > 0 ? [marker.trim()] : [],\n );\n return markers.length > 0 ? markers : DEFAULT_SAFETY_MARKERS;\n}\n\nfunction markerPattern(markers: readonly string[]): RegExp {\n const alternation = markers\n .map((marker) => marker.replaceAll(/[.*+?^${}()|[\\]\\\\]/gu, String.raw`\\$&`))\n .join(\"|\");\n return new RegExp(\n String.raw`(?:^|[^\\p{L}\\p{N}_])(?:${alternation})\\s*:\\s*\\S`,\n \"u\",\n );\n}\n\nfunction hasSafetyJustificationBefore(\n sourceCode: SourceCode,\n owner: ESTree.Node,\n assertion: TypeAssertion,\n pattern: RegExp,\n): boolean {\n return sourceCode\n .getCommentsBefore(owner)\n .some(\n (comment) => comment.end <= assertion.start && pattern.test(comment.value),\n );\n}\n\nfunction hasSafetyComment(\n sourceCode: SourceCode,\n node: TypeAssertion,\n pattern: RegExp,\n): boolean {\n let current: ESTree.Node = node;\n while (true) {\n if (hasSafetyJustificationBefore(sourceCode, current, node, pattern)) return true;\n if (commentOwnerKinds.has(current.type)) {\n const exportDeclaration = current.parent;\n return (\n exportDeclaration.type === \"ExportNamedDeclaration\" &&\n exportDeclaration.declaration === current &&\n hasSafetyJustificationBefore(sourceCode, exportDeclaration, node, pattern)\n );\n }\n if (current.parent.type === \"Program\") return false;\n current = current.parent;\n }\n}\n\n/** Require every non-const type assertion to state the invariant TypeScript cannot express. */\nexport const requireSafetyCommentForTypeAssertionRule = defineRule({\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Require a nearby SAFETY comment for every TypeScript type assertion except const assertions.\",\n },\n messages: {\n missingSafetyComment:\n \"This type assertion has no `{{marker}}:` justification. State the checked invariant immediately before the assertion or its containing statement.\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n markers: {\n type: \"array\",\n items: { type: \"string\", minLength: 1 },\n minItems: 1,\n uniqueItems: true,\n },\n },\n additionalProperties: false,\n },\n ],\n defaultOptions: [{ markers: [\"SAFETY\"] }],\n },\n createOnce(context) {\n const patterns = new Map<string, RegExp>();\n\n const checkAssertion = (node: TypeAssertion) => {\n if (isConstAssertion(node)) return;\n const markers = configuredSafetyMarkers(context.options?.[0]);\n const patternKey = markers.join(\"\\u0000\");\n const pattern = patterns.get(patternKey) ?? markerPattern(markers);\n patterns.set(patternKey, pattern);\n if (hasSafetyComment(context.sourceCode, node, pattern)) return;\n context.report({\n node,\n messageId: \"missingSafetyComment\",\n data: { marker: markers[0] ?? DEFAULT_SAFETY_MARKERS[0] },\n });\n };\n\n return {\n TSAsExpression: checkAssertion,\n TSTypeAssertion: checkAssertion,\n };\n },\n});\n"],"mappings":";AAAA,SAAS,0BAA0B;;;ACAnC,SAAS,kBAAkB;;;ACGpB,SAAS,sBAAsB,MAAgC;AACpE,SACE,KAAK,SAAS,6BACd,KAAK,SAAS,qBACd,KAAK,SAAS,oBACd,KAAK,SAAS,qBACd,KAAK,SAAS,yBACd,KAAK,SAAS,yBACd;AACA,WAAO,KAAK;AAAA,EACd;AACA,SAAO;AACT;AAGO,SAAS,oBAAoB,YAAwB,MAAoC;AAC9F,SAAO,sBAAsB,IAAI;AACjC,MAAI,KAAK,SAAS,aAAc,QAAO;AACvC,MAAI,QAAsB,WAAW,SAAS,IAAI;AAClD,SAAO,UAAU,MAAM;AACrB,UAAM,WAAW,MAAM,IAAI,IAAI,KAAK,IAAI;AACxC,QAAI,aAAa,OAAW,QAAO;AACnC,YAAQ,MAAM;AAAA,EAChB;AACA,SAAO;AACT;AAGO,SAAS,kBAC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IAAI,YAAY,OAAO;AAChC,UAAI,iBAAiB,QAAQ,YAAY,MAAM,OAAO,EAAG;AACzD,cAAQ,OAAO;AAAA,QACb;AAAA,QACA,WAAW;AAAA,QACX,MAAM,EAAE,QAAQ,QAAQ,CAAC,KAAK,uBAAuB,CAAC,EAAE;AAAA,MAC1D,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,MACL,gBAAgB;AAAA,MAChB,iBAAiB;AAAA,IACnB;AAAA,EACF;AACF,CAAC;;;A3B5GD,IAAM,iBAAiB,mBAAmB;AAAA,EACzC,MAAM,EAAE,MAAM,YAAY;AAAA,EAC1B,OAAO;AAAA,IACN,uBAAuB;AAAA,IACvB,8BAA8B;AAAA,IAC9B,8BAA8B;AAAA,IAC9B,sCAAsC;AAAA,IACtC,2BAA2B;AAAA,IAC3B,qBAAqB;AAAA,IACrB,wBAAwB;AAAA,IACxB,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,IAClB,qBAAqB;AAAA,IACrB,6BAA6B;AAAA,IAC7B,4BAA4B;AAAA,IAC5B,yBAAyB;AAAA,IACzB,sBAAsB;AAAA,IACtB,2BAA2B;AAAA,IAC3B,wBAAwB;AAAA,IACxB,4BAA4B;AAAA,IAC5B,6CAA6C;AAAA,EAC9C;AACD,CAAC;AAED,IAAO,oBAAQ;","names":["defineRule","defineRule","defineRule","defineRule","defineRule","isNode","typeReferenceName","substitutions","resolved","isEmptyObjectExpression","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","defineRule","typeReferenceName","defineRule","defineRule","typeReferenceName","variableDeclarator","node","defineRule","isConstAssertion"]}
@@ -0,0 +1,24 @@
1
+ declare const _default: {
2
+ ignorePatterns: string[];
3
+ useTabs: false;
4
+ tabWidth: number;
5
+ printWidth: number;
6
+ singleQuote: true;
7
+ jsxSingleQuote: false;
8
+ quoteProps: "as-needed";
9
+ trailingComma: "es5";
10
+ semi: true;
11
+ arrowParens: "always";
12
+ bracketSameLine: false;
13
+ bracketSpacing: true;
14
+ sortImports: {};
15
+ sortPackageJson: false;
16
+ overrides: {
17
+ files: string[];
18
+ options: {
19
+ tabWidth: number;
20
+ };
21
+ }[];
22
+ };
23
+
24
+ export { _default as default };
package/build/oxfmt.js ADDED
@@ -0,0 +1,37 @@
1
+ // src/oxfmt.ts
2
+ import { defineConfig } from "oxfmt";
3
+ var agentDirs = [
4
+ ".agent",
5
+ ".agents",
6
+ ".claude",
7
+ ".codex",
8
+ ".continue",
9
+ ".cursor",
10
+ ".gemini",
11
+ ".omp",
12
+ ".opencode",
13
+ ".pi",
14
+ ".roo",
15
+ ".windsurf"
16
+ ];
17
+ var oxfmt_default = defineConfig({
18
+ ignorePatterns: [...agentDirs.map((dir) => `${dir}/**`), "**/.worktrees/**", "**/anti-slop/**"],
19
+ useTabs: false,
20
+ tabWidth: 4,
21
+ printWidth: 120,
22
+ singleQuote: true,
23
+ jsxSingleQuote: false,
24
+ quoteProps: "as-needed",
25
+ trailingComma: "es5",
26
+ semi: true,
27
+ arrowParens: "always",
28
+ bracketSameLine: false,
29
+ bracketSpacing: true,
30
+ sortImports: {},
31
+ sortPackageJson: false,
32
+ overrides: [{ files: ["**/*.json"], options: { tabWidth: 2 } }]
33
+ });
34
+ export {
35
+ oxfmt_default as default
36
+ };
37
+ //# sourceMappingURL=oxfmt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/oxfmt.ts"],"sourcesContent":["import { defineConfig } from 'oxfmt';\n\nconst agentDirs = [\n '.agent',\n '.agents',\n '.claude',\n '.codex',\n '.continue',\n '.cursor',\n '.gemini',\n '.omp',\n '.opencode',\n '.pi',\n '.roo',\n '.windsurf',\n];\n\nexport default defineConfig({\n ignorePatterns: [...agentDirs.map((dir) => `${dir}/**`), '**/.worktrees/**', '**/anti-slop/**'],\n useTabs: false,\n tabWidth: 4,\n printWidth: 120,\n singleQuote: true,\n jsxSingleQuote: false,\n quoteProps: 'as-needed',\n trailingComma: 'es5',\n semi: true,\n arrowParens: 'always',\n bracketSameLine: false,\n bracketSpacing: true,\n sortImports: {},\n sortPackageJson: false,\n overrides: [{ files: ['**/*.json'], options: { tabWidth: 2 } }],\n});\n"],"mappings":";AAAA,SAAS,oBAAoB;AAE7B,IAAM,YAAY;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAEA,IAAO,gBAAQ,aAAa;AAAA,EACxB,gBAAgB,CAAC,GAAG,UAAU,IAAI,CAAC,QAAQ,GAAG,GAAG,KAAK,GAAG,oBAAoB,iBAAiB;AAAA,EAC9F,SAAS;AAAA,EACT,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,MAAM;AAAA,EACN,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,aAAa,CAAC;AAAA,EACd,iBAAiB;AAAA,EACjB,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,GAAG,SAAS,EAAE,UAAU,EAAE,EAAE,CAAC;AAClE,CAAC;","names":[]}