import type { Program } from 'estree'; import type { Linter } from 'eslint'; import { analyzeTsrx as analyze_tsrx, DIAGNOSTIC_CODES, parseModule as parse_module, } from '@tsrx/core'; interface ParseResult { ast: Program; services?: Record; scopeManager?: any; visitorKeys?: Record; } const visitorKeys: Record = { Program: ['body'], JSXElement: ['openingElement', 'children', 'closingElement'], JSXOpeningElement: ['name', 'attributes'], JSXClosingElement: ['name'], JSXFragment: ['openingFragment', 'children', 'closingFragment'], JSXOpeningFragment: [], JSXClosingFragment: [], JSXExpressionContainer: ['expression'], JSXAttribute: ['name', 'value'], JSXSpreadAttribute: ['argument'], JSXIdentifier: [], JSXMemberExpression: ['object', 'property'], JSXNamespacedName: ['namespace', 'name'], JSXText: [], JSXStyleElement: ['openingElement', 'children', 'closingElement'], JSXIfExpression: ['test', 'consequent', 'alternate'], JSXForExpression: ['init', 'test', 'update', 'left', 'right', 'body', 'index', 'key', 'empty'], JSXSwitchExpression: ['discriminant', 'cases'], JSXTryExpression: ['block', 'handler', 'finalizer', 'pending'], JSXCodeBlock: ['body', 'render'], StyleSheet: [], ForOfStatement: ['left', 'right', 'body'], }; /** * Keep this hook for small ESLint-only AST normalizations. */ function normalize_tsrx_ast_for_eslint(ast: any): void { const seen = new Set(); const visit = (node: any) => { if (!node || typeof node !== 'object') return; if (seen.has(node)) return; seen.add(node); // `