@tsrx/eslint-plugin 0.6.3 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["rule","NESTED_BOUNDARY_TYPES","functionNode","rule","rule","noReturnInComponent","controlFlowJsx","validForOfKey","requireStatementContainerBody"],"sources":["../src/rules/no-return-in-component.ts","../src/utils/tsrx.ts","../src/rules/control-flow-jsx.ts","../src/rules/valid-for-of-key.ts","../src/rules/require-statement-container-body.ts","../src/index.ts"],"sourcesContent":["import type { Rule } from 'eslint';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Deprecated: TSRX components are functions that return native TSRX expressions.',\n\t\t\trecommended: false,\n\t\t},\n\t\tdeprecated: true,\n\t\tmessages: {\n\t\t\tnoReturn: 'TSRX components should return native TSRX expressions.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tvoid context;\n\t\treturn {};\n\t},\n};\n\nexport default rule;\n","import type * as AST from '@tsrx/core/types/estree';\n\ntype AnyNode = AST.Node & Record<string, any>;\n\nconst NESTED_BOUNDARY_TYPES = new Set([\n\t'FunctionDeclaration',\n\t'FunctionExpression',\n\t'ArrowFunctionExpression',\n\t'ClassDeclaration',\n\t'ClassExpression',\n\t'MethodDefinition',\n\t'PropertyDefinition',\n\t'StaticBlock',\n]);\n\nexport function isNativeTsrxJsxNode(node: AST.Node | null | undefined): boolean {\n\tif (!node) return false;\n\n\tif (\n\t\tnode.type === ('JSXCodeBlock' as string) ||\n\t\tnode.type === ('JSXIfExpression' as string) ||\n\t\tnode.type === ('JSXForExpression' as string) ||\n\t\tnode.type === ('JSXSwitchExpression' as string) ||\n\t\tnode.type === ('JSXTryExpression' as string)\n\t) {\n\t\treturn true;\n\t}\n\n\treturn (\n\t\t(node.type === ('JSXElement' as string) ||\n\t\t\tnode.type === ('JSXFragment' as string) ||\n\t\t\tnode.type === ('JSXStyleElement' as string)) &&\n\t\t!!(node as AnyNode).metadata?.native_tsrx\n\t);\n}\n\nexport function functionReturnsNativeTsrx(node: AST.Node): boolean {\n\tconst functionNode = node as AnyNode;\n\tconst body = functionNode.body as AnyNode | undefined;\n\n\tif (!body) {\n\t\treturn false;\n\t}\n\n\tif (isNativeTsrxJsxNode(body)) {\n\t\treturn true;\n\t}\n\n\tif (body.type !== 'BlockStatement') {\n\t\treturn false;\n\t}\n\n\treturn containsNativeTsrxReturn(body);\n}\n\nfunction containsNativeTsrxReturn(node: AnyNode): boolean {\n\tif (!node || typeof node !== 'object') {\n\t\treturn false;\n\t}\n\n\tif (node.type === 'ReturnStatement' && isNativeTsrxJsxNode(node.argument)) {\n\t\treturn true;\n\t}\n\n\tif (node.type !== 'BlockStatement' && NESTED_BOUNDARY_TYPES.has(node.type)) {\n\t\treturn false;\n\t}\n\n\tfor (const key of Object.keys(node)) {\n\t\tif (key === 'parent' || key === 'loc' || key === 'range') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst value = node[key];\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (const child of value) {\n\t\t\t\tif (child?.type && containsNativeTsrxReturn(child)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (value?.type && containsNativeTsrxReturn(value)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\nimport { functionReturnsNativeTsrx } from '../utils/tsrx.js';\n\nconst NESTED_BOUNDARY_TYPES = new Set([\n\t'FunctionDeclaration',\n\t'FunctionExpression',\n\t'ArrowFunctionExpression',\n\t'ClassDeclaration',\n\t'ClassExpression',\n\t'MethodDefinition',\n\t'PropertyDefinition',\n]);\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Require template output in @for blocks',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\trequireJsxInLoop:\n\t\t\t\t'@for blocks in returned TSRX should contain template output. Render an element, fragment, or nested template directive.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tlet insideComponent = 0;\n\t\tlet nonComponentFunctionDepth = 0;\n\t\tconst functionStack: boolean[] = [];\n\n\t\tfunction containsTemplateOutput(node: AST.Node, visited: Set<AST.Node> = new Set()): boolean {\n\t\t\tif (!node) return false;\n\n\t\t\t// Avoid infinite loops from circular references\n\t\t\tif (visited.has(node)) return false;\n\t\t\tvisited.add(node);\n\n\t\t\tif (visited.size > 1 && NESTED_BOUNDARY_TYPES.has(node.type)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tnode.type === ('JSXElement' as string) ||\n\t\t\t\tnode.type === ('JSXFragment' as string) ||\n\t\t\t\tnode.type === ('JSXStyleElement' as string) ||\n\t\t\t\tnode.type === ('JSXIfExpression' as string) ||\n\t\t\t\tnode.type === ('JSXForExpression' as string) ||\n\t\t\t\tnode.type === ('JSXSwitchExpression' as string) ||\n\t\t\t\tnode.type === ('JSXTryExpression' as string)\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (node.type === ('JSXCodeBlock' as string)) {\n\t\t\t\tconst render = (node as any).render;\n\t\t\t\treturn !!render && containsTemplateOutput(render, visited);\n\t\t\t}\n\n\t\t\tconst keys = Object.keys(node);\n\t\t\tfor (const key of keys) {\n\t\t\t\tif (key === 'parent' || key === 'loc' || key === 'range') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst value = (node as any)[key];\n\t\t\t\tif (value && typeof value === 'object') {\n\t\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t\tfor (const item of value) {\n\t\t\t\t\t\t\tif (item && typeof item === 'object' && containsTemplateOutput(item, visited)) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (value.type && containsTemplateOutput(value, visited)) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn {\n\t\t\tFunctionDeclaration: enterFunction,\n\t\t\t'FunctionDeclaration:exit': exitFunction,\n\t\t\tFunctionExpression: enterFunction,\n\t\t\t'FunctionExpression:exit': exitFunction,\n\t\t\tArrowFunctionExpression: enterFunction,\n\t\t\t'ArrowFunctionExpression:exit': exitFunction,\n\n\t\t\tJSXForExpression(node: AST.Node) {\n\t\t\t\tif (insideComponent === 0 || nonComponentFunctionDepth > 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst body = (node as any).body;\n\t\t\t\tif (!body || containsTemplateOutput(body)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'requireJsxInLoop',\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\n\t\tfunction enterFunction(node: AST.Node) {\n\t\t\tconst isComponent = functionReturnsNativeTsrx(node);\n\t\t\tfunctionStack.push(isComponent);\n\n\t\t\tif (isComponent) {\n\t\t\t\tinsideComponent++;\n\t\t\t} else if (insideComponent > 0) {\n\t\t\t\tnonComponentFunctionDepth++;\n\t\t\t}\n\t\t}\n\n\t\tfunction exitFunction() {\n\t\t\tconst isComponent = functionStack.pop();\n\n\t\t\tif (isComponent) {\n\t\t\t\tinsideComponent--;\n\t\t\t} else if (insideComponent > 0) {\n\t\t\t\tnonComponentFunctionDepth--;\n\t\t\t}\n\t\t}\n\t},\n};\n\nexport default rule;\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\nimport type { Scope } from 'eslint';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Ensure variables used in for..of key expression are defined',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tundefinedVariable: \"Variable '{{name}}' is not defined.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst checkForOfKey = (node: AST.ForOfStatement | AST.JSXForExpression) => {\n\t\t\tif (!node.key) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst checkIdentifier = (identifier: AST.Identifier) => {\n\t\t\t\tconst scope = context.sourceCode.getScope(node);\n\t\t\t\tconst variable = findVariable(scope, identifier.name);\n\n\t\t\t\tif (!variable) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: identifier,\n\t\t\t\t\t\tmessageId: 'undefinedVariable',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: identifier.name,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst traverse = (node: AST.Node) => {\n\t\t\t\tif (!node) return;\n\n\t\t\t\tswitch (node.type) {\n\t\t\t\t\tcase 'Identifier':\n\t\t\t\t\t\tcheckIdentifier(node);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'MemberExpression':\n\t\t\t\t\t\ttraverse(node.object);\n\n\t\t\t\t\t\tif (node.computed) {\n\t\t\t\t\t\t\ttraverse(node.property);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'BinaryExpression':\n\t\t\t\t\tcase 'LogicalExpression':\n\t\t\t\t\t\ttraverse(node.left);\n\t\t\t\t\t\ttraverse(node.right);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'UnaryExpression':\n\t\t\t\t\t\ttraverse(node.argument);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'CallExpression':\n\t\t\t\t\t\ttraverse(node.callee);\n\t\t\t\t\t\tnode.arguments.forEach(traverse);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'ArrayExpression':\n\t\t\t\t\t\t(node.elements as (AST.Expression | AST.SpreadElement)[]).forEach(traverse);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'ObjectExpression':\n\t\t\t\t\t\tnode.properties.forEach((prop: AST.Property | AST.SpreadElement) => {\n\t\t\t\t\t\t\tif (prop.type === 'Property') {\n\t\t\t\t\t\t\t\tif (prop.computed) {\n\t\t\t\t\t\t\t\t\ttraverse(prop.key);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\ttraverse(prop.value);\n\t\t\t\t\t\t\t} else if (prop.type === 'SpreadElement') {\n\t\t\t\t\t\t\t\ttraverse(prop.argument);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'ConditionalExpression':\n\t\t\t\t\t\ttraverse(node.test);\n\t\t\t\t\t\ttraverse(node.consequent);\n\t\t\t\t\t\ttraverse(node.alternate);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'TemplateLiteral':\n\t\t\t\t\t\tnode.expressions.forEach(traverse);\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttraverse(node.key);\n\t\t};\n\n\t\t// `@for (... ; key X)` loops parse to `JSXForExpression`, while the bare\n\t\t// `for (... ; key X)` form parses to `ForOfStatement`. Both carry the same\n\t\t// `key` shape, so validate either node type.\n\t\treturn {\n\t\t\tForOfStatement: checkForOfKey,\n\t\t\tJSXForExpression: checkForOfKey,\n\t\t};\n\t},\n};\n\nfunction findVariable(scope: Scope.Scope, name: string) {\n\tlet currentScope: Scope.Scope | null = scope;\n\n\twhile (currentScope) {\n\t\tconst variable = currentScope.variables.find((v: { name: string }) => v.name === name);\n\n\t\tif (variable) {\n\t\t\treturn variable;\n\t\t}\n\n\t\t// Also check references for global variables or variables defined in the loop itself (like the loop variable)\n\t\t// The loop variable might not be in the 'variables' list of the surrounding scope yet if we are inside the loop statement\n\t\t// But for 'for-of', the loop variable is in a special scope or the upper scope.\n\t\t// Let's rely on standard scope analysis.\n\n\t\t// Special case: check if the variable is the loop variable itself (left side of for-of)\n\t\t// The scope analysis might handle this, but let's be sure.\n\n\t\tcurrentScope = currentScope.upper;\n\t}\n\n\t// If not found in scopes, it might be a global variable.\n\t// ESLint scope analysis usually includes globals in the global scope.\n\t// However, if we are in a module, we might need to check if it's an implicit global or defined elsewhere.\n\t// For now, let's assume standard scope resolution works.\n\n\treturn null;\n}\n\nexport default rule;\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\n\ntype AnyNode = AST.Node & Record<string, any>;\n\nconst MESSAGE =\n\t\"This function body contains TSRX template output, but it is a normal JavaScript block. Add '@' before the opening brace to use a TSRX statement container.\";\n\nfunction is_template_output_statement(node: AnyNode | null | undefined): boolean {\n\tif (!node) return false;\n\n\tif (\n\t\tnode.type === ('JSXElement' as string) ||\n\t\tnode.type === ('JSXFragment' as string) ||\n\t\tnode.type === ('JSXStyleElement' as string) ||\n\t\tnode.type === ('JSXIfExpression' as string) ||\n\t\tnode.type === ('JSXForExpression' as string) ||\n\t\tnode.type === ('JSXSwitchExpression' as string) ||\n\t\tnode.type === ('JSXTryExpression' as string)\n\t) {\n\t\treturn true;\n\t}\n\n\treturn (\n\t\tnode.type === 'ExpressionStatement' &&\n\t\tis_template_output_statement((node as AnyNode).expression)\n\t);\n}\n\nfunction is_ignored_statement(node: AnyNode | null | undefined): boolean {\n\treturn !node || node.type === 'EmptyStatement';\n}\n\nfunction get_forgotten_output_statement(node: AST.Node): AnyNode | null {\n\tconst body = (node as AnyNode).body;\n\tif (!body || body.type !== 'BlockStatement') {\n\t\treturn null;\n\t}\n\n\tlet target: AnyNode | null = null;\n\tlet target_index = -1;\n\tconst statements = body.body || [];\n\tfor (let index = 0; index < statements.length; index++) {\n\t\tconst statement = statements[index] as AnyNode;\n\t\tif (is_template_output_statement(statement)) {\n\t\t\tif (target_index !== -1) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\ttarget = statement;\n\t\t\ttarget_index = index;\n\t\t}\n\t}\n\n\tif (!target) {\n\t\treturn null;\n\t}\n\n\tfor (const statement of statements.slice(target_index + 1)) {\n\t\tif (!is_ignored_statement(statement as AnyNode)) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn target;\n}\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Require @{...} for TSRX component bodies with setup and template output.',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\trequireStatementContainerBody: MESSAGE,\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tfunction check_function(node: AST.Node) {\n\t\t\tif (!(node as AnyNode).returnType) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst forgotten_output = get_forgotten_output_statement(node);\n\t\t\tif (!forgotten_output) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst body = (node as AnyNode).body;\n\t\t\tcontext.report({\n\t\t\t\tnode: forgotten_output,\n\t\t\t\tmessageId: 'requireStatementContainerBody',\n\t\t\t\tfix(fixer) {\n\t\t\t\t\treturn fixer.insertTextBefore(body, '@');\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\tFunctionDeclaration: check_function,\n\t\t\tFunctionExpression: check_function,\n\t\t\tArrowFunctionExpression: check_function,\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { createRequire } from 'module';\nimport noReturnInComponent from './rules/no-return-in-component.js';\nimport controlFlowJsx from './rules/control-flow-jsx.js';\nimport validForOfKey from './rules/valid-for-of-key.js';\nimport requireStatementContainerBody from './rules/require-statement-container-body.js';\n\nconst plugin = {\n\tmeta: {\n\t\tname: '@tsrx/eslint-plugin',\n\t\tversion: '0.1.3',\n\t},\n\trules: {\n\t\t'no-return-in-component': noReturnInComponent,\n\t\t'control-flow-jsx': controlFlowJsx,\n\t\t'valid-for-of-key': validForOfKey,\n\t\t'require-statement-container-body': requireStatementContainerBody,\n\t},\n\tconfigs: {} as any,\n};\n\n// Try to load optional parsers\nconst require = createRequire(import.meta.url);\n\nlet tsrxParser: any;\nlet tsParser: any;\n\ntry {\n\ttsrxParser = require('@tsrx/eslint-parser');\n} catch {\n\t// @tsrx/eslint-parser is optional\n\ttsrxParser = null;\n}\n\ntry {\n\ttsParser = require('@typescript-eslint/parser');\n} catch {\n\t// @typescript-eslint/parser is optional\n\ttsParser = null;\n}\n\n// Helper to create config objects\nfunction createConfig(name: string, files: string[], parser: any, isTsrx: boolean) {\n\tconst rules: Record<string, string> = {\n\t\t'tsrx/control-flow-jsx': 'error',\n\t\t'tsrx/valid-for-of-key': 'error',\n\t};\n\n\tif (isTsrx) {\n\t\trules['tsrx/require-statement-container-body'] = 'error';\n\t}\n\n\tconst config: any = {\n\t\tname,\n\t\tfiles,\n\t\tplugins: {\n\t\t\ttsrx: plugin,\n\t\t},\n\t\trules,\n\t};\n\n\t// Only add parser if it's available\n\tif (parser) {\n\t\tconfig.languageOptions = {\n\t\t\tparser,\n\t\t\tparserOptions: {\n\t\t\t\tecmaVersion: 'latest',\n\t\t\t\tsourceType: 'module',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn config;\n}\n\n// Recommended configuration (flat config format)\nplugin.configs.recommended = [\n\tcreateConfig('tsrx/recommended-tsrx-files', ['**/*.tsrx'], tsrxParser, true),\n\tcreateConfig('tsrx/recommended-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser, false),\n\t{\n\t\tname: 'tsrx/ignores',\n\t\tignores: ['**/*.d.ts', '**/node_modules/**', '**/dist/**', '**/build/**'],\n\t},\n];\n\n// Strict configuration (flat config format)\nplugin.configs.strict = [\n\tcreateConfig('tsrx/strict-tsrx-files', ['**/*.tsrx'], tsrxParser, true),\n\tcreateConfig('tsrx/strict-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser, false),\n\t{\n\t\tname: 'tsrx/ignores',\n\t\tignores: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AI;CACH,WAAW,QAAQ,2BAA2B;AAC/C,QAAQ;CAEP,WAAW;AACZ;AAGA,SAAS,aAAa,MAAc,OAAiB,QAAa,QAAiB;CAClF,MAAM,QAAgC;EACrC,yBAAyB;EACzB,yBAAyB;CAC1B;CAEA,IAAI,QACH,MAAM,2CAA2C;CAGlD,MAAM,SAAc;EACnB;EACA;EACA,SAAS,EACR,MAAM,OACP;EACA;CACD;CAGA,IAAI,QACH,OAAO,kBAAkB;EACxB;EACA,eAAe;GACd,aAAa;GACb,YAAY;EACb;CACD;CAGD,OAAO;AACR;AAGA,OAAO,QAAQ,cAAc;CAC5B,aAAa,+BAA+B,CAAC,WAAW,GAAG,YAAY,IAAI;CAC3E,aAAa,qCAAqC,CAAC,WAAW,UAAU,GAAG,UAAU,KAAK;CAC1F;EACC,MAAM;EACN,SAAS;GAAC;GAAa;GAAsB;GAAc;EAAa;CACzE;AACD;AAGA,OAAO,QAAQ,SAAS;CACvB,aAAa,0BAA0B,CAAC,WAAW,GAAG,YAAY,IAAI;CACtE,aAAa,gCAAgC,CAAC,WAAW,UAAU,GAAG,UAAU,KAAK;CACrF;EACC,MAAM;EACN,SAAS;GAAC;GAAa;GAAsB;GAAc;EAAa;CACzE;AACD"}
1
+ {"version":3,"file":"index.js","names":["rule","NESTED_BOUNDARY_TYPES","functionNode","rule","rule","rule","rule","core","rule","core","FUNCTION_TYPES","rule","noReturnInComponent","controlFlowJsx","validForOfKey","requireStatementContainerBody","jsxCurlyBracePresence","noUnusedVars","noAwaitInLoop","noUnreachable"],"sources":["../src/rules/no-return-in-component.ts","../src/utils/tsrx.ts","../src/rules/control-flow-jsx.ts","../src/rules/valid-for-of-key.ts","../src/rules/require-statement-container-body.ts","../src/rules/jsx-curly-brace-presence.ts","../src/utils/core-rule.ts","../src/rules/no-unused-vars.ts","../src/rules/no-await-in-loop.ts","../src/rules/no-unreachable.ts","../src/index.ts"],"sourcesContent":["import type { Rule } from 'eslint';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Deprecated: TSRX components are functions that return native TSRX expressions.',\n\t\t\trecommended: false,\n\t\t},\n\t\tdeprecated: true,\n\t\tmessages: {\n\t\t\tnoReturn: 'TSRX components should return native TSRX expressions.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tvoid context;\n\t\treturn {};\n\t},\n};\n\nexport default rule;\n","import type * as AST from '@tsrx/core/types/estree';\n\ntype AnyNode = AST.Node & Record<string, any>;\n\nconst NESTED_BOUNDARY_TYPES = new Set([\n\t'FunctionDeclaration',\n\t'FunctionExpression',\n\t'ArrowFunctionExpression',\n\t'ClassDeclaration',\n\t'ClassExpression',\n\t'MethodDefinition',\n\t'PropertyDefinition',\n\t'StaticBlock',\n]);\n\nexport function isNativeTsrxJsxNode(node: AST.Node | null | undefined): boolean {\n\tif (!node) return false;\n\n\tif (\n\t\tnode.type === ('JSXCodeBlock' as string) ||\n\t\tnode.type === ('JSXIfExpression' as string) ||\n\t\tnode.type === ('JSXForExpression' as string) ||\n\t\tnode.type === ('JSXSwitchExpression' as string) ||\n\t\tnode.type === ('JSXTryExpression' as string)\n\t) {\n\t\treturn true;\n\t}\n\n\treturn (\n\t\t(node.type === ('JSXElement' as string) ||\n\t\t\tnode.type === ('JSXFragment' as string) ||\n\t\t\tnode.type === ('JSXStyleElement' as string)) &&\n\t\t!!(node as AnyNode).metadata?.native_tsrx\n\t);\n}\n\nexport function functionReturnsNativeTsrx(node: AST.Node): boolean {\n\tconst functionNode = node as AnyNode;\n\tconst body = functionNode.body as AnyNode | undefined;\n\n\tif (!body) {\n\t\treturn false;\n\t}\n\n\tif (isNativeTsrxJsxNode(body)) {\n\t\treturn true;\n\t}\n\n\tif (body.type !== 'BlockStatement') {\n\t\treturn false;\n\t}\n\n\treturn containsNativeTsrxReturn(body);\n}\n\nfunction containsNativeTsrxReturn(node: AnyNode): boolean {\n\tif (!node || typeof node !== 'object') {\n\t\treturn false;\n\t}\n\n\tif (node.type === 'ReturnStatement' && isNativeTsrxJsxNode(node.argument)) {\n\t\treturn true;\n\t}\n\n\tif (node.type !== 'BlockStatement' && NESTED_BOUNDARY_TYPES.has(node.type)) {\n\t\treturn false;\n\t}\n\n\tfor (const key of Object.keys(node)) {\n\t\tif (key === 'parent' || key === 'loc' || key === 'range') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst value = node[key];\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (const child of value) {\n\t\t\t\tif (child?.type && containsNativeTsrxReturn(child)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (value?.type && containsNativeTsrxReturn(value)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\nimport { functionReturnsNativeTsrx } from '../utils/tsrx.js';\n\nconst NESTED_BOUNDARY_TYPES = new Set([\n\t'FunctionDeclaration',\n\t'FunctionExpression',\n\t'ArrowFunctionExpression',\n\t'ClassDeclaration',\n\t'ClassExpression',\n\t'MethodDefinition',\n\t'PropertyDefinition',\n]);\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Require template output in @for blocks',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\trequireJsxInLoop:\n\t\t\t\t'@for blocks in returned TSRX should contain template output. Render an element, fragment, or nested template directive.',\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tlet insideComponent = 0;\n\t\tlet nonComponentFunctionDepth = 0;\n\t\tconst functionStack: boolean[] = [];\n\n\t\tfunction containsTemplateOutput(node: AST.Node, visited: Set<AST.Node> = new Set()): boolean {\n\t\t\tif (!node) return false;\n\n\t\t\t// Avoid infinite loops from circular references\n\t\t\tif (visited.has(node)) return false;\n\t\t\tvisited.add(node);\n\n\t\t\tif (visited.size > 1 && NESTED_BOUNDARY_TYPES.has(node.type)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tnode.type === ('JSXElement' as string) ||\n\t\t\t\tnode.type === ('JSXFragment' as string) ||\n\t\t\t\tnode.type === ('JSXStyleElement' as string) ||\n\t\t\t\tnode.type === ('JSXIfExpression' as string) ||\n\t\t\t\tnode.type === ('JSXForExpression' as string) ||\n\t\t\t\tnode.type === ('JSXSwitchExpression' as string) ||\n\t\t\t\tnode.type === ('JSXTryExpression' as string)\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (node.type === ('JSXCodeBlock' as string)) {\n\t\t\t\tconst render = (node as any).render;\n\t\t\t\treturn !!render && containsTemplateOutput(render, visited);\n\t\t\t}\n\n\t\t\tconst keys = Object.keys(node);\n\t\t\tfor (const key of keys) {\n\t\t\t\tif (key === 'parent' || key === 'loc' || key === 'range') {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst value = (node as any)[key];\n\t\t\t\tif (value && typeof value === 'object') {\n\t\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t\tfor (const item of value) {\n\t\t\t\t\t\t\tif (item && typeof item === 'object' && containsTemplateOutput(item, visited)) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (value.type && containsTemplateOutput(value, visited)) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn {\n\t\t\tFunctionDeclaration: enterFunction,\n\t\t\t'FunctionDeclaration:exit': exitFunction,\n\t\t\tFunctionExpression: enterFunction,\n\t\t\t'FunctionExpression:exit': exitFunction,\n\t\t\tArrowFunctionExpression: enterFunction,\n\t\t\t'ArrowFunctionExpression:exit': exitFunction,\n\n\t\t\tJSXForExpression(node: AST.Node) {\n\t\t\t\tif (insideComponent === 0 || nonComponentFunctionDepth > 0) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// The ESLint parser keeps the loop itself, with its body, in `loop`.\n\t\t\t\tconst body = (node as any).loop?.body;\n\t\t\t\tif (!body || containsTemplateOutput(body)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: 'requireJsxInLoop',\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\n\t\tfunction enterFunction(node: AST.Node) {\n\t\t\tconst isComponent = functionReturnsNativeTsrx(node);\n\t\t\tfunctionStack.push(isComponent);\n\n\t\t\tif (isComponent) {\n\t\t\t\tinsideComponent++;\n\t\t\t} else if (insideComponent > 0) {\n\t\t\t\tnonComponentFunctionDepth++;\n\t\t\t}\n\t\t}\n\n\t\tfunction exitFunction() {\n\t\t\tconst isComponent = functionStack.pop();\n\n\t\t\tif (isComponent) {\n\t\t\t\tinsideComponent--;\n\t\t\t} else if (insideComponent > 0) {\n\t\t\t\tnonComponentFunctionDepth--;\n\t\t\t}\n\t\t}\n\t},\n};\n\nexport default rule;\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Ensure variables used in for..of key expression are defined',\n\t\t\trecommended: true,\n\t\t},\n\t\tmessages: {\n\t\t\tundefinedVariable: \"Variable '{{name}}' is not defined.\",\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tconst checkForOfKey = (node: AST.JSXForExpression) => {\n\t\t\tconst key = node.key;\n\t\t\tif (!key) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst [start, end] = key.range!;\n\t\t\tfor (const reference of context.sourceCode.getScope(node).through) {\n\t\t\t\tconst identifier = reference.identifier as Rule.Node & AST.Identifier;\n\t\t\t\tconst [identifier_start, identifier_end] = identifier.range!;\n\t\t\t\tif (reference.resolved || identifier_start < start || identifier_end > end) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (is_type_name(identifier, node)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: identifier,\n\t\t\t\t\tmessageId: 'undefinedVariable',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tname: identifier.name,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\t// The ESLint parser's scope manager resolves the key in the loop's scope,\n\t\t// where the loop's variable and `index` are declared.\n\t\treturn {\n\t\t\tJSXForExpression: checkForOfKey,\n\t\t};\n\t},\n};\n\n// TypeScript nodes that hold a value; every other TypeScript node is a type.\n// TSRX reads `<T>value` as JSX, so no key holds a `TSTypeAssertion`.\nconst TS_EXPRESSIONS = new Set([\n\t'TSAsExpression',\n\t'TSSatisfiesExpression',\n\t'TSNonNullExpression',\n\t'TSInstantiationExpression',\n\t// The default in `constructor(public x = value)`.\n\t'TSParameterProperty',\n]);\n\n/**\n * Whether the identifier names a type, as `Foo` does in `key item as Foo`.\n * ESLint's scope analysis reports a type declared in the file as unresolved.\n */\nfunction is_type_name(identifier: Rule.Node, loop: AST.Node): boolean {\n\tfor (let node = identifier.parent; node && node !== loop; node = node.parent) {\n\t\tif (node.type.startsWith('TS') && !TS_EXPRESSIONS.has(node.type)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nexport default rule;\n","import type { Rule } from 'eslint';\nimport type * as AST from '@tsrx/core/types/estree';\n\ntype AnyNode = AST.Node & Record<string, any>;\n\nconst MESSAGE =\n\t\"This function body contains TSRX template output, but it is a normal JavaScript block. Add '@' before the opening brace to use a TSRX statement container.\";\n\nfunction is_template_output_statement(node: AnyNode | null | undefined): boolean {\n\tif (!node) return false;\n\n\tif (\n\t\tnode.type === ('JSXElement' as string) ||\n\t\tnode.type === ('JSXFragment' as string) ||\n\t\tnode.type === ('JSXStyleElement' as string) ||\n\t\tnode.type === ('JSXIfExpression' as string) ||\n\t\tnode.type === ('JSXForExpression' as string) ||\n\t\tnode.type === ('JSXSwitchExpression' as string) ||\n\t\tnode.type === ('JSXTryExpression' as string)\n\t) {\n\t\treturn true;\n\t}\n\n\treturn (\n\t\tnode.type === 'ExpressionStatement' &&\n\t\tis_template_output_statement((node as AnyNode).expression)\n\t);\n}\n\nfunction is_ignored_statement(node: AnyNode | null | undefined): boolean {\n\treturn !node || node.type === 'EmptyStatement';\n}\n\nfunction get_forgotten_output_statement(node: AST.Node): AnyNode | null {\n\tconst body = (node as AnyNode).body;\n\tif (!body || body.type !== 'BlockStatement') {\n\t\treturn null;\n\t}\n\n\tlet target: AnyNode | null = null;\n\tlet target_index = -1;\n\tconst statements = body.body || [];\n\tfor (let index = 0; index < statements.length; index++) {\n\t\tconst statement = statements[index] as AnyNode;\n\t\tif (is_template_output_statement(statement)) {\n\t\t\tif (target_index !== -1) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\ttarget = statement;\n\t\t\ttarget_index = index;\n\t\t}\n\t}\n\n\tif (!target) {\n\t\treturn null;\n\t}\n\n\tfor (const statement of statements.slice(target_index + 1)) {\n\t\tif (!is_ignored_statement(statement as AnyNode)) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn target;\n}\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'problem',\n\t\tdocs: {\n\t\t\tdescription: 'Require @{...} for TSRX component bodies with setup and template output.',\n\t\t},\n\t\tfixable: 'code',\n\t\tmessages: {\n\t\t\trequireStatementContainerBody: MESSAGE,\n\t\t},\n\t\tschema: [],\n\t},\n\tcreate(context) {\n\t\tfunction check_function(node: AST.Node) {\n\t\t\tif (!(node as AnyNode).returnType) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst forgotten_output = get_forgotten_output_statement(node);\n\t\t\tif (!forgotten_output) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst body = (node as AnyNode).body;\n\t\t\tcontext.report({\n\t\t\t\tnode: forgotten_output,\n\t\t\t\tmessageId: 'requireStatementContainerBody',\n\t\t\t\tfix(fixer) {\n\t\t\t\t\treturn fixer.insertTextBefore(body, '@');\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\treturn {\n\t\t\tFunctionDeclaration: check_function,\n\t\t\tFunctionExpression: check_function,\n\t\t\tArrowFunctionExpression: check_function,\n\t\t};\n\t},\n};\n\nexport default rule;\n","/*!\n * `tsrx/jsx-curly-brace-presence` is copied from eslint-plugin-react 7.37.5,\n * `lib/rules/jsx-curly-brace-presence.js`:\n *\n * @fileoverview Enforce curly braces or disallow unnecessary curly brace in JSX\n * @author Jacky Ho\n * @author Simon Lydell\n *\n * The MIT License (MIT)\n *\n * Copyright (c) 2014 Yannick Croissant\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n/**\n * `react/jsx-curly-brace-presence` for TSRX text, with the same options and\n * messages. Apart from types and calling ESLint's API directly, the only\n * changes, marked `TSRX:`, keep the braces around a child that TSRX would read\n * differently once unwrapped: text that starts a directive (`@if (`) or a\n * comment (`//`), joins a comment or a directive's clause beside it, or turns a\n * `<style>` into a scoped style block. Keep the rest in step with\n * eslint-plugin-react when upgrading.\n */\nimport type { Rule } from 'eslint';\n\ntype AnyNode = Record<string, any>;\n\nconst OPTION_ALWAYS = 'always';\nconst OPTION_NEVER = 'never';\nconst OPTION_IGNORE = 'ignore';\n\nconst OPTION_VALUES = [OPTION_ALWAYS, OPTION_NEVER, OPTION_IGNORE];\nconst DEFAULT_CONFIG = {\n\tprops: OPTION_NEVER,\n\tchildren: OPTION_NEVER,\n\tpropElementValues: OPTION_IGNORE,\n};\n\nconst HTML_ENTITY_REGEX = () => /&[A-Za-z\\d#]+;/g;\n\nfunction containsLineTerminators(rawStringValue: string) {\n\treturn /[\\n\\r\\u2028\\u2029]/.test(rawStringValue);\n}\n\nfunction containsBackslash(rawStringValue: string) {\n\treturn rawStringValue.includes('\\\\');\n}\n\nfunction containsHTMLEntity(rawStringValue: string) {\n\treturn HTML_ENTITY_REGEX().test(rawStringValue);\n}\n\nfunction containsOnlyHtmlEntities(rawStringValue: string) {\n\treturn rawStringValue.replace(HTML_ENTITY_REGEX(), '').trim() === '';\n}\n\nfunction containsDisallowedJSXTextChars(rawStringValue: string) {\n\treturn /[{<>}]/.test(rawStringValue);\n}\n\nfunction containsQuoteCharacters(value: string) {\n\treturn /['\"]/.test(value);\n}\n\nfunction containsMultilineComment(value: string) {\n\treturn /\\/\\*/.test(value);\n}\n\nfunction escapeDoubleQuotes(rawStringValue: string) {\n\treturn rawStringValue.replace(/\\\\\"/g, '\"').replace(/\"/g, '\\\\\"');\n}\n\nfunction escapeBackslashes(rawStringValue: string) {\n\treturn rawStringValue.replace(/\\\\/g, '\\\\\\\\');\n}\n\nfunction needToEscapeCharacterForJSX(raw: string, node: AnyNode) {\n\treturn (\n\t\tcontainsBackslash(raw) ||\n\t\tcontainsHTMLEntity(raw) ||\n\t\t(node.parent.type !== 'JSXAttribute' && containsDisallowedJSXTextChars(raw))\n\t);\n}\n\nfunction isJSX(node: AnyNode | null | undefined) {\n\treturn !!node && (node.type === 'JSXElement' || node.type === 'JSXFragment');\n}\n\nfunction isWhiteSpaces(value: unknown) {\n\treturn typeof value === 'string' ? /^\\s*$/.test(value) : false;\n}\n\nfunction containsWhitespaceExpression(child: AnyNode) {\n\tif (child.type === 'JSXExpressionContainer') {\n\t\tconst value = child.expression.value;\n\t\treturn value ? isWhiteSpaces(value) : false;\n\t}\n\treturn false;\n}\n\nfunction isLineBreak(text: string) {\n\treturn containsLineTerminators(text) && text.trim() === '';\n}\n\nfunction wrapNonHTMLEntities(text: string) {\n\tconst HTML_ENTITY = '<HTML_ENTITY>';\n\tconst withCurlyBraces = text\n\t\t.split(HTML_ENTITY_REGEX())\n\t\t.map((word) => (word === '' ? '' : `{${JSON.stringify(word)}}`))\n\t\t.join(HTML_ENTITY);\n\n\tconst htmlEntities = text.match(HTML_ENTITY_REGEX())!;\n\treturn htmlEntities.reduce(\n\t\t(acc, htmlEntity) => acc.replace(HTML_ENTITY, htmlEntity),\n\t\twithCurlyBraces,\n\t);\n}\n\nfunction wrapWithCurlyBraces(rawText: string) {\n\tif (!containsLineTerminators(rawText)) {\n\t\treturn `{${JSON.stringify(rawText)}}`;\n\t}\n\n\treturn rawText\n\t\t.split('\\n')\n\t\t.map((line) => {\n\t\t\tif (line.trim() === '') {\n\t\t\t\treturn line;\n\t\t\t}\n\t\t\tconst firstCharIndex = line.search(/[^\\s]/);\n\t\t\tconst leftWhitespace = line.slice(0, firstCharIndex);\n\t\t\tconst text = line.slice(firstCharIndex);\n\n\t\t\tif (containsHTMLEntity(line)) {\n\t\t\t\treturn `${leftWhitespace}${wrapNonHTMLEntities(text)}`;\n\t\t\t}\n\t\t\treturn `${leftWhitespace}{${JSON.stringify(text)}}`;\n\t\t})\n\t\t.join('\\n');\n}\n\nfunction isWhiteSpaceLiteral(node: AnyNode) {\n\treturn node.type && node.type === 'Literal' && node.value && isWhiteSpaces(node.value);\n}\n\nfunction isStringWithTrailingWhiteSpaces(value: string) {\n\treturn /^\\s|\\s$/.test(value);\n}\n\nfunction isLiteralWithTrailingWhiteSpaces(node: AnyNode) {\n\treturn (\n\t\tnode.type &&\n\t\tnode.type === 'Literal' &&\n\t\tnode.value &&\n\t\tisStringWithTrailingWhiteSpaces(node.value)\n\t);\n}\n\n/** TSRX: the directives, whose clauses (`@else`, `catch (e)`) text could continue. */\nconst DIRECTIVE_TYPES = new Set([\n\t'JSXIfExpression',\n\t'JSXForExpression',\n\t'JSXSwitchExpression',\n\t'JSXTryExpression',\n]);\n\n/**\n * TSRX: whether `<style>` or `<script>` holds `node`. The first child of a\n * `<style>` decides what it is: text makes it a scoped style block, while\n * `{css}` keeps it an ordinary element. A `<script>` body is raw text.\n */\nfunction is_in_raw_text_element(node: AnyNode) {\n\tconst name = node.parent?.openingElement?.name;\n\treturn name?.type === 'JSXIdentifier' && (name.name === 'style' || name.name === 'script');\n}\n\n/**\n * TSRX: whether an expression container or an attribute holds `element`, at any\n * depth. A cut parsed on its own doesn't reproduce that context.\n */\nfunction is_in_expression(element: AnyNode) {\n\tfor (let node = element.parent; node; node = node.parent) {\n\t\tif (node.type === 'JSXExpressionContainer' || node.type === 'JSXAttribute') return true;\n\t}\n\treturn false;\n}\n\n/** TSRX: the nearest child before (`step` -1) or after (1) `index` that isn't text. */\nfunction non_text_sibling(children: AnyNode[], index: number, step: number) {\n\tlet at = index + step;\n\twhile (children[at]?.type === 'JSXText') at += step;\n\treturn at;\n}\n\n/**\n * TSRX: whether unwrapping the child `node` into `replacement` could read as\n * TSRX syntax:\n *\n * - its text, joined with the text beside it, has `@`, `/`, `*` or `&`;\n * - a comment follows the braces directly;\n * - the nearest sibling before it that isn't text is a directive, whose clause\n * the text could continue;\n * - a `<style>` or `<script>` holds it;\n * - inside an expression container, the element holds a directive.\n *\n * Anything else reads as the same text in TSRX as in JSX.\n */\nfunction may_read_as_tsrx_syntax(node: AnyNode, replacement: string, sourceCode: AnyNode) {\n\tif (is_in_raw_text_element(node)) return true;\n\tconst children: AnyNode[] = node.parent.children;\n\tconst index = children.indexOf(node);\n\tconst text_of = (child: AnyNode | undefined) =>\n\t\tchild?.type === 'JSXText' ? sourceCode.getText(child) : '';\n\tconst run = text_of(children[index - 1]) + replacement + text_of(children[index + 1]);\n\treturn (\n\t\t/[@/*&]/.test(run) ||\n\t\tsourceCode.text[node.range[1]] === '/' ||\n\t\tDIRECTIVE_TYPES.has(children[non_text_sibling(children, index, -1)]?.type) ||\n\t\t(is_in_expression(node.parent) && children.some((child) => DIRECTIVE_TYPES.has(child.type)))\n\t);\n}\n\n/**\n * TSRX: a parse function from the file's parser, or `null`. A parser with only\n * `parse` gives no diagnostics.\n */\nfunction parser_of(context: Rule.RuleContext) {\n\tconst parser = (context.languageOptions as AnyNode)?.parser;\n\tconst options = { ...context.languageOptions.parserOptions, filePath: context.filename };\n\tif (typeof parser?.parseForESLint === 'function') {\n\t\treturn (code: string) => parser.parseForESLint(code, options);\n\t}\n\tif (typeof parser?.parse === 'function') {\n\t\treturn (code: string) => ({ ast: parser.parse(code, options) });\n\t}\n\treturn null;\n}\n\n/** TSRX: each child's type, with adjacent text joined. */\nfunction children_shape(children: AnyNode[]) {\n\tconst out: Array<{ type: string; value?: string }> = [];\n\tfor (const child of children) {\n\t\tconst previous = out.at(-1);\n\t\tif (child.type === 'JSXText' && previous?.type === 'JSXText') {\n\t\t\tprevious.value += child.value;\n\t\t} else {\n\t\t\tout.push({ type: child.type, value: child.type === 'JSXText' ? child.value : undefined });\n\t\t}\n\t}\n\treturn JSON.stringify(out);\n}\n\n/** TSRX: the comments inside `range`. */\nfunction count_comments(comments: AnyNode[] | undefined, range: [number, number]) {\n\treturn (comments ?? []).filter(\n\t\t(comment) => comment.range[0] >= range[0] && comment.range[1] <= range[1],\n\t).length;\n}\n\n/**\n * TSRX: whether unwrapping the child `node` into `replacement`, which parses as\n * a `type` child, keeps the element around it as it was: its comments, its\n * diagnostics and its children, with the new text joined to the text beside\n * it. The parser of the file reads the element before and after the edit:\n *\n * - usually only a cut of it, from the nearest child before `node` that isn't\n * text to the nearest one after, in a bare tag of its own;\n * - the top-level statement around the element when it sits in an expression\n * container or an attribute, a context the cut can't reproduce. Parsed on\n * its own, a top-level statement reads as it does in the file. A file gets\n * `STATEMENT_PARSE_LIMIT` of these, and past them the braces stay.\n *\n * Without a parser, and for the first child of a `<style>`, the braces stay.\n */\nfunction unwraps_to_the_same_children(\n\tcontext: Rule.RuleContext,\n\tstate: CheckState,\n\tnode: AnyNode,\n\treplacement: string,\n\ttype: string,\n) {\n\tconst parse = parser_of(context);\n\tif (!parse) return false;\n\tconst text = context.sourceCode.text;\n\tconst element = node.parent;\n\tconst children: AnyNode[] = element.children;\n\tconst index = children.indexOf(node);\n\t// The first child of a `<style>` decides what it is. Any other child leaves\n\t// it an ordinary element, whose children read like any element's.\n\tif (\n\t\tis_in_raw_text_element(node) &&\n\t\tchildren.slice(0, index).every((child) => child.type === 'JSXText' && !child.value.trim())\n\t) {\n\t\treturn false;\n\t}\n\tconst expected = (nodes: AnyNode[], at: number) =>\n\t\tchildren_shape(\n\t\t\tnodes.map((child) =>\n\t\t\t\tchild.range[0] === at\n\t\t\t\t\t? { type, value: type === 'JSXText' ? replacement : undefined }\n\t\t\t\t\t: child,\n\t\t\t),\n\t\t);\n\tconst read = (code: string) => {\n\t\ttry {\n\t\t\tconst result = parse(code);\n\t\t\treturn { ast: result.ast, diagnostics: result.services?.tsrxDiagnostics?.length ?? 0 };\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t};\n\n\tif (is_in_expression(element)) {\n\t\tif (state.statement_parses >= STATEMENT_PARSE_LIMIT) return false;\n\t\tstate.statement_parses++;\n\t\tlet statement = element;\n\t\twhile (statement.parent && statement.parent.type !== 'Program') statement = statement.parent;\n\t\tconst [statement_start, statement_end] = statement.range;\n\t\tlet before = state.statements.get(statement);\n\t\tif (before === undefined) {\n\t\t\tbefore = read(text.slice(statement_start, statement_end));\n\t\t\tstate.statements.set(statement, before);\n\t\t}\n\t\tconst after = read(\n\t\t\ttext.slice(statement_start, node.range[0]) +\n\t\t\t\treplacement +\n\t\t\t\ttext.slice(node.range[1], statement_end),\n\t\t);\n\t\tconst element_start = element.range[0] - statement_start;\n\t\tconst before_element = before && find_element(before.ast.body, element_start);\n\t\tconst after_element = after && find_element(after.ast.body, element_start);\n\t\tif (!before_element || !after_element) return false;\n\t\treturn (\n\t\t\tafter_element.type === before_element.type &&\n\t\t\tcount_comments(after!.ast.comments, after_element.range) ===\n\t\t\t\tcount_comments(before!.ast.comments, before_element.range) &&\n\t\t\tafter!.diagnostics === before!.diagnostics &&\n\t\t\tchildren_shape(after_element.children) ===\n\t\t\t\texpected(before_element.children, node.range[0] - statement_start)\n\t\t);\n\t}\n\n\tconst [start, end] = neighborhood(node);\n\t// The element's name, without its attributes. TSRX can read text after a\n\t// directive's block differently before another closing tag.\n\tconst name =\n\t\telement.type === 'JSXFragment' ? '' : text.slice(...element.openingElement.name.range);\n\t// The children of a `<style>` read like any element's once `{…}` leads them.\n\tconst open = `<${name}>` + (is_in_raw_text_element(node) ? '{0}' : '');\n\tconst close = `</${name}>`;\n\t// Statement level, not in parentheses: TSRX reads some text after a\n\t// directive's block more strictly there, so the check errs toward the braces.\n\tconst prefix = 'export const tsrx = ' + open;\n\tconst suffix = close + ';\\n';\n\tconst root = (result: { ast: AnyNode } | null) =>\n\t\tresult?.ast.body[0]?.declaration?.declarations?.[0]?.init;\n\tconst before = read(prefix + text.slice(start, end) + suffix);\n\tconst after = read(\n\t\tprefix +\n\t\t\ttext.slice(start, node.range[0]) +\n\t\t\treplacement +\n\t\t\ttext.slice(node.range[1], end) +\n\t\t\tsuffix,\n\t);\n\tconst before_root = root(before);\n\tconst after_root = root(after);\n\tif (!before_root?.children || !after_root?.children) return false;\n\treturn (\n\t\tafter_root.type === before_root.type &&\n\t\tafter!.ast.comments?.length === before!.ast.comments?.length &&\n\t\tafter!.diagnostics === before!.diagnostics &&\n\t\tchildren_shape(after_root.children) ===\n\t\t\texpected(before_root.children, node.range[0] - start + prefix.length)\n\t);\n}\n\n/**\n * TSRX: the source range from the nearest child before `node` that isn't text\n * to the nearest one after, or to the start or end of the element's children.\n */\nfunction neighborhood(node: AnyNode): [number, number] {\n\tconst element = node.parent;\n\tconst children: AnyNode[] = element.children;\n\tconst index = children.indexOf(node);\n\tconst first = non_text_sibling(children, index, -1);\n\tconst last = non_text_sibling(children, index, 1);\n\treturn [\n\t\tfirst >= 0\n\t\t\t? children[first].range[0]\n\t\t\t: (element.openingElement ?? element.openingFragment).range[1],\n\t\tlast < children.length\n\t\t\t? children[last].range[1]\n\t\t\t: (element.closingElement ?? element.closingFragment).range[0],\n\t];\n}\n\n/**\n * TSRX: how many children in expression containers one file may check by\n * parsing their top-level statement, at about one parse each. No file in the\n * repo checks any.\n */\nexport const STATEMENT_PARSE_LIMIT = 50;\n\n/** TSRX: what the checks of one file share. */\ninterface CheckState {\n\tstatement_parses: number;\n\t/** Each top-level statement's parse before any edit. */\n\tstatements: Map<AnyNode, { ast: AnyNode; diagnostics: number } | null>;\n}\n\n/**\n * TSRX: the source range from the end of the nearest child before `node` that\n * isn't text to the start of the nearest one after, or to the start or end of\n * the element's children.\n */\nfunction between_neighbors(node: AnyNode): [number, number] {\n\tconst element = node.parent;\n\tconst children: AnyNode[] = element.children;\n\tconst index = children.indexOf(node);\n\tconst first = non_text_sibling(children, index, -1);\n\tconst last = non_text_sibling(children, index, 1);\n\treturn [\n\t\tfirst >= 0\n\t\t\t? children[first].range[1]\n\t\t\t: (element.openingElement ?? element.openingFragment).range[1],\n\t\tlast < children.length\n\t\t\t? children[last].range[0]\n\t\t\t: (element.closingElement ?? element.closingFragment).range[0],\n\t];\n}\n\nconst ELEMENT_TYPES = new Set(['JSXElement', 'JSXFragment', 'JSXStyleElement']);\n\n/** TSRX: the first element or fragment in `node` that starts at `start`. */\nfunction find_element(node: AnyNode, start: number): AnyNode | null {\n\tif (!node || typeof node !== 'object') return null;\n\tif (Array.isArray(node)) {\n\t\tfor (const child of node) {\n\t\t\tconst found = find_element(child, start);\n\t\t\tif (found) return found;\n\t\t}\n\t\treturn null;\n\t}\n\tif (node.range && (node.range[1] < start || node.range[0] > start)) return null;\n\tif (ELEMENT_TYPES.has(node.type) && node.range?.[0] === start) return node;\n\tfor (const key of Object.keys(node)) {\n\t\tif (key === 'parent' || key === 'loc' || key === 'range' || key === 'metadata') continue;\n\t\tconst found = find_element(node[key], start);\n\t\tif (found) return found;\n\t}\n\treturn null;\n}\n\nconst messages = {\n\tunnecessaryCurly: 'Curly braces are unnecessary here.',\n\tmissingCurly: 'Need to wrap this literal in a JSX expression.',\n};\n\nconst rule: Rule.RuleModule = {\n\tmeta: {\n\t\ttype: 'suggestion',\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t'Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes, without unwrapping text that TSRX reads as syntax',\n\t\t},\n\t\tfixable: 'code',\n\n\t\tmessages,\n\n\t\tschema: [\n\t\t\t{\n\t\t\t\tanyOf: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tprops: { enum: OPTION_VALUES },\n\t\t\t\t\t\t\tchildren: { enum: OPTION_VALUES },\n\t\t\t\t\t\t\tpropElementValues: { enum: OPTION_VALUES },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tadditionalProperties: false,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tenum: OPTION_VALUES,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t},\n\n\tcreate(context) {\n\t\tconst sourceCode = context.sourceCode;\n\t\tconst getText = (node: AnyNode) => sourceCode.getText(node as Rule.Node);\n\t\t// TSRX: what the checks of this file share.\n\t\tconst state: CheckState = { statement_parses: 0, statements: new Map() };\n\t\tconst ruleOptions = context.options[0];\n\t\tconst userConfig =\n\t\t\ttypeof ruleOptions === 'string'\n\t\t\t\t? { props: ruleOptions, children: ruleOptions, propElementValues: OPTION_IGNORE }\n\t\t\t\t: Object.assign({}, DEFAULT_CONFIG, ruleOptions);\n\n\t\t/**\n\t\t * Report and fix an unnecessary curly brace violation on a node\n\t\t */\n\t\tfunction reportUnnecessaryCurly(JSXExpressionNode: AnyNode) {\n\t\t\tcontext.report({\n\t\t\t\tnode: JSXExpressionNode as Rule.Node,\n\t\t\t\tmessageId: 'unnecessaryCurly',\n\t\t\t\tfix(fixer) {\n\t\t\t\t\tconst expression = JSXExpressionNode.expression;\n\n\t\t\t\t\tlet textToReplace;\n\t\t\t\t\tif (isJSX(expression)) {\n\t\t\t\t\t\ttextToReplace = getText(expression);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst expressionType = expression && expression.type;\n\t\t\t\t\t\tconst parentType = JSXExpressionNode.parent.type;\n\n\t\t\t\t\t\tif (parentType === 'JSXAttribute') {\n\t\t\t\t\t\t\tif (expressionType !== 'TemplateLiteral' && /[\"]/.test(expression.raw.slice(1, -1))) {\n\t\t\t\t\t\t\t\ttextToReplace = expression.raw;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\ttextToReplace = `\"${\n\t\t\t\t\t\t\t\t\texpressionType === 'TemplateLiteral'\n\t\t\t\t\t\t\t\t\t\t? expression.quasis[0].value.raw\n\t\t\t\t\t\t\t\t\t\t: expression.raw.slice(1, -1)\n\t\t\t\t\t\t\t\t}\"`;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (isJSX(expression)) {\n\t\t\t\t\t\t\ttextToReplace = getText(expression);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttextToReplace =\n\t\t\t\t\t\t\t\texpressionType === 'TemplateLiteral'\n\t\t\t\t\t\t\t\t\t? expression.quasis[0].value.cooked\n\t\t\t\t\t\t\t\t\t: expression.value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// TSRX: a child's fix also spans the text beside it, up to the nearest\n\t\t\t\t\t// child on each side that isn't text. Fixes that would touch the same\n\t\t\t\t\t// text then go in separate passes, each checked against the code it\n\t\t\t\t\t// edits.\n\t\t\t\t\tif (JSXExpressionNode.parent.type !== 'JSXAttribute') {\n\t\t\t\t\t\tconst [start, end] = between_neighbors(JSXExpressionNode);\n\t\t\t\t\t\tconst [node_start, node_end] = JSXExpressionNode.range;\n\t\t\t\t\t\treturn fixer.replaceTextRange(\n\t\t\t\t\t\t\t[start, end],\n\t\t\t\t\t\t\tsourceCode.text.slice(start, node_start) +\n\t\t\t\t\t\t\t\ttextToReplace +\n\t\t\t\t\t\t\t\tsourceCode.text.slice(node_end, end),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn fixer.replaceText(JSXExpressionNode as Rule.Node, textToReplace);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\tfunction reportMissingCurly(literalNode: AnyNode) {\n\t\t\tcontext.report({\n\t\t\t\tnode: literalNode as Rule.Node,\n\t\t\t\tmessageId: 'missingCurly',\n\t\t\t\tfix(fixer) {\n\t\t\t\t\tif (isJSX(literalNode)) {\n\t\t\t\t\t\treturn fixer.replaceText(literalNode as Rule.Node, `{${getText(literalNode)}}`);\n\t\t\t\t\t}\n\n\t\t\t\t\t// If a HTML entity name is found, bail out because it can be fixed\n\t\t\t\t\t// by either using the real character or the unicode equivalent.\n\t\t\t\t\t// If it contains any line terminator character, bail out as well.\n\t\t\t\t\tif (\n\t\t\t\t\t\tcontainsOnlyHtmlEntities(literalNode.raw) ||\n\t\t\t\t\t\t(literalNode.parent.type === 'JSXAttribute' &&\n\t\t\t\t\t\t\tcontainsLineTerminators(literalNode.raw)) ||\n\t\t\t\t\t\tisLineBreak(literalNode.raw)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst expression =\n\t\t\t\t\t\tliteralNode.parent.type === 'JSXAttribute'\n\t\t\t\t\t\t\t? `{\"${escapeDoubleQuotes(escapeBackslashes(literalNode.raw.slice(1, -1)))}\"}`\n\t\t\t\t\t\t\t: wrapWithCurlyBraces(literalNode.raw);\n\n\t\t\t\t\treturn fixer.replaceText(literalNode as Rule.Node, expression);\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Bail out if there is any character that needs to be escaped in JSX\n\t\t// because escaping decreases readability and the original code may be more\n\t\t// readable anyway or intentional for other specific reasons\n\t\tfunction lintUnnecessaryCurly(JSXExpressionNode: AnyNode) {\n\t\t\tconst expression = JSXExpressionNode.expression;\n\t\t\tconst expressionType = expression.type;\n\n\t\t\t// Curly braces containing comments are necessary\n\t\t\tif (sourceCode.getCommentsInside(JSXExpressionNode as Rule.Node).length > 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// TSRX: braces that keep a child from reading as TSRX syntax are necessary.\n\t\t\tconst keepsTsrxBraces = (replacement: string, type: string) =>\n\t\t\t\tJSXExpressionNode.parent.type !== 'JSXAttribute' &&\n\t\t\t\tmay_read_as_tsrx_syntax(JSXExpressionNode, replacement, sourceCode) &&\n\t\t\t\t!unwraps_to_the_same_children(context, state, JSXExpressionNode, replacement, type);\n\n\t\t\tif (\n\t\t\t\t(expressionType === 'Literal' || expressionType === 'JSXText') &&\n\t\t\t\ttypeof expression.value === 'string' &&\n\t\t\t\t((JSXExpressionNode.parent.type === 'JSXAttribute' && !isWhiteSpaceLiteral(expression)) ||\n\t\t\t\t\t!isLiteralWithTrailingWhiteSpaces(expression)) &&\n\t\t\t\t!containsMultilineComment(expression.value) &&\n\t\t\t\t!needToEscapeCharacterForJSX(expression.raw, JSXExpressionNode) &&\n\t\t\t\t(isJSX(JSXExpressionNode.parent) ||\n\t\t\t\t\t!containsQuoteCharacters(expression.value) ||\n\t\t\t\t\ttypeof expression.value === 'string')\n\t\t\t) {\n\t\t\t\tif (keepsTsrxBraces(expression.value, 'JSXText')) return;\n\t\t\t\treportUnnecessaryCurly(JSXExpressionNode);\n\t\t\t} else if (\n\t\t\t\texpressionType === 'TemplateLiteral' &&\n\t\t\t\texpression.expressions.length === 0 &&\n\t\t\t\texpression.quasis[0].value.raw.indexOf('\\n') === -1 &&\n\t\t\t\t!isStringWithTrailingWhiteSpaces(expression.quasis[0].value.raw) &&\n\t\t\t\t!needToEscapeCharacterForJSX(expression.quasis[0].value.raw, JSXExpressionNode) &&\n\t\t\t\t!containsQuoteCharacters(expression.quasis[0].value.cooked)\n\t\t\t) {\n\t\t\t\tif (keepsTsrxBraces(expression.quasis[0].value.cooked, 'JSXText')) return;\n\t\t\t\treportUnnecessaryCurly(JSXExpressionNode);\n\t\t\t} else if (isJSX(expression)) {\n\t\t\t\tif (keepsTsrxBraces(getText(expression), expression.type)) return;\n\t\t\t\treportUnnecessaryCurly(JSXExpressionNode);\n\t\t\t}\n\t\t}\n\n\t\tfunction areRuleConditionsSatisfied(parent: AnyNode, config: AnyNode, ruleCondition: string) {\n\t\t\treturn (\n\t\t\t\t(parent.type === 'JSXAttribute' &&\n\t\t\t\t\ttypeof config.props === 'string' &&\n\t\t\t\t\tconfig.props === ruleCondition) ||\n\t\t\t\t(isJSX(parent) && typeof config.children === 'string' && config.children === ruleCondition)\n\t\t\t);\n\t\t}\n\n\t\tfunction getAdjacentSiblings(node: AnyNode, children: AnyNode[]) {\n\t\t\tfor (let i = 1; i < children.length - 1; i++) {\n\t\t\t\tconst child = children[i];\n\t\t\t\tif (node === child) {\n\t\t\t\t\treturn [children[i - 1], children[i + 1]];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (node === children[0] && children[1]) {\n\t\t\t\treturn [children[1]];\n\t\t\t}\n\t\t\tif (node === children[children.length - 1] && children[children.length - 2]) {\n\t\t\t\treturn [children[children.length - 2]];\n\t\t\t}\n\t\t\treturn [];\n\t\t}\n\n\t\tfunction hasAdjacentJsxExpressionContainers(node: AnyNode, children: AnyNode[] | undefined) {\n\t\t\tif (!children) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst childrenExcludingWhitespaceLiteral = children.filter(\n\t\t\t\t(child) => !isWhiteSpaceLiteral(child),\n\t\t\t);\n\t\t\tconst adjSiblings = getAdjacentSiblings(node, childrenExcludingWhitespaceLiteral);\n\n\t\t\treturn adjSiblings.some((x) => x.type && x.type === 'JSXExpressionContainer');\n\t\t}\n\n\t\tfunction hasAdjacentJsx(node: AnyNode, children: AnyNode[] | undefined) {\n\t\t\tif (!children) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst childrenExcludingWhitespaceLiteral = children.filter(\n\t\t\t\t(child) => !isWhiteSpaceLiteral(child),\n\t\t\t);\n\t\t\tconst adjSiblings = getAdjacentSiblings(node, childrenExcludingWhitespaceLiteral);\n\n\t\t\treturn adjSiblings.some(\n\t\t\t\t(x) => x.type && (x.type === 'JSXExpressionContainer' || x.type === 'JSXElement'),\n\t\t\t);\n\t\t}\n\n\t\tfunction shouldCheckForUnnecessaryCurly(node: AnyNode, config: AnyNode) {\n\t\t\tconst parent = node.parent;\n\t\t\t// Bail out if the parent is a JSXAttribute & its contents aren't\n\t\t\t// StringLiteral or TemplateLiteral since e.g\n\t\t\t// <App prop1={<CustomEl />} prop2={<CustomEl>...</CustomEl>} />\n\n\t\t\tif (\n\t\t\t\tparent.type &&\n\t\t\t\tparent.type === 'JSXAttribute' &&\n\t\t\t\tnode.expression &&\n\t\t\t\tnode.expression.type &&\n\t\t\t\tnode.expression.type !== 'Literal' &&\n\t\t\t\tnode.expression.type !== 'StringLiteral' &&\n\t\t\t\tnode.expression.type !== 'TemplateLiteral'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// If there are adjacent `JsxExpressionContainer` then there is no need,\n\t\t\t// to check for unnecessary curly braces.\n\t\t\tif (isJSX(parent) && hasAdjacentJsxExpressionContainers(node, parent.children)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (containsWhitespaceExpression(node) && hasAdjacentJsx(node, parent.children)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif (parent.children && parent.children.length === 1 && containsWhitespaceExpression(node)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn areRuleConditionsSatisfied(parent, config, OPTION_NEVER);\n\t\t}\n\n\t\tfunction shouldCheckForMissingCurly(node: AnyNode, config: AnyNode) {\n\t\t\tif (isJSX(node)) {\n\t\t\t\treturn config.propElementValues !== OPTION_IGNORE;\n\t\t\t}\n\t\t\tif (isLineBreak(node.raw) || containsOnlyHtmlEntities(node.raw)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tconst parent = node.parent;\n\t\t\tif (\n\t\t\t\tparent.children &&\n\t\t\t\tparent.children.length === 1 &&\n\t\t\t\tcontainsWhitespaceExpression(parent.children[0])\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// TSRX: the text of a `<style>` or `<script>` is raw.\n\t\t\tif (is_in_raw_text_element(node)) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn areRuleConditionsSatisfied(parent, config, OPTION_ALWAYS);\n\t\t}\n\n\t\treturn {\n\t\t\t'JSXAttribute > JSXExpressionContainer > JSXElement'(node: AnyNode) {\n\t\t\t\tif (userConfig.propElementValues === OPTION_NEVER) {\n\t\t\t\t\treportUnnecessaryCurly(node.parent);\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tJSXExpressionContainer(node: AnyNode) {\n\t\t\t\tif (shouldCheckForUnnecessaryCurly(node, userConfig)) {\n\t\t\t\t\tlintUnnecessaryCurly(node);\n\t\t\t\t}\n\t\t\t},\n\n\t\t\t'JSXAttribute > JSXElement, Literal, JSXText'(node: AnyNode) {\n\t\t\t\tif (shouldCheckForMissingCurly(node, userConfig)) {\n\t\t\t\t\treportMissingCurly(node);\n\t\t\t\t}\n\t\t\t},\n\t\t} as Rule.RuleListener;\n\t},\n};\n\nexport default rule;\n","import type { Rule } from 'eslint';\n// `builtinRules` is marked deprecated, but it is the only way to reach a core\n// rule; typescript-eslint loads the rules its extension rules wrap the same way.\nimport { builtinRules } from 'eslint/use-at-your-own-risk';\n\n/**\n * An ESLint core rule, for a TSRX rule that wraps it.\n */\nexport function get_core_rule(name: string): Rule.RuleModule {\n\tconst rule = builtinRules.get(name);\n\tif (!rule) {\n\t\tthrow new Error(`ESLint has no core rule named '${name}'.`);\n\t}\n\treturn rule;\n}\n\n/**\n * The core rule's meta, with the TSRX rule's description. No wrapper is in the\n * `recommended` configuration: `tsrx.configs.js` swaps them in.\n */\nexport function wrapper_meta(core: Rule.RuleModule, description: string): Rule.RuleMetaData {\n\treturn { ...core.meta, docs: { ...core.meta?.docs, description, recommended: false } };\n}\n\n/**\n * The rule context, with its `report` replaced.\n */\nexport function with_report(\n\tcontext: Rule.RuleContext,\n\treport: (descriptor: Rule.ReportDescriptor) => void,\n): Rule.RuleContext {\n\treturn Object.create(context, { report: { value: report } });\n}\n\n/**\n * Both rules' listeners, the first's running first where both listen to an\n * event.\n */\nexport function merge_listeners(\n\tfirst: Rule.RuleListener,\n\tsecond: Record<string, (...args: any[]) => void>,\n): Rule.RuleListener {\n\tconst merged: Record<string, any> = { ...first };\n\tfor (const [key, listener] of Object.entries(second)) {\n\t\tconst existing = (first as Record<string, any>)[key];\n\t\tmerged[key] = existing\n\t\t\t? (...args: any[]) => {\n\t\t\t\t\texisting(...args);\n\t\t\t\t\tlistener(...args);\n\t\t\t\t}\n\t\t\t: listener;\n\t}\n\treturn merged;\n}\n","import type { Rule } from 'eslint';\nimport { get_core_rule, with_report, wrapper_meta } from '../utils/core-rule.js';\n\nconst core = get_core_rule('no-unused-vars');\n\n/**\n * Core `no-unused-vars`. Its suggestion for an unused `@for` index deleted\n * only the name, which left `index )`: here it deletes the `; index i` clause.\n */\nconst rule: Rule.RuleModule = {\n\tmeta: wrapper_meta(\n\t\tcore,\n\t\t'Disallow unused variables, with a suggestion that removes an unused `@for` index clause',\n\t),\n\tcreate(context) {\n\t\treturn core.create(\n\t\t\twith_report(context, (descriptor) => {\n\t\t\t\tconst node = (descriptor as { node?: Rule.Node }).node;\n\t\t\t\tconst parent = node?.parent as (Rule.Node & { index?: unknown }) | undefined;\n\t\t\t\tif (!node || parent?.type !== ('JSXForExpression' as string) || parent.index !== node) {\n\t\t\t\t\tcontext.report(descriptor);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcontext.report({\n\t\t\t\t\t...descriptor,\n\t\t\t\t\tsuggest: descriptor.suggest?.map((suggestion) => ({\n\t\t\t\t\t\t...suggestion,\n\t\t\t\t\t\tfix: (fixer) => remove_index_clause(context.sourceCode, fixer, node),\n\t\t\t\t\t})),\n\t\t\t\t});\n\t\t\t}),\n\t\t);\n\t},\n};\n\n/**\n * Removes `; index i`, from the `;` before `index` to the end of the name.\n */\nfunction remove_index_clause(\n\tsource_code: Rule.RuleContext['sourceCode'],\n\tfixer: Rule.RuleFixer,\n\tindex: Rule.Node,\n): Rule.Fix | null {\n\tconst keyword = source_code.getTokenBefore(index);\n\tconst semicolon = keyword && source_code.getTokenBefore(keyword);\n\tif (keyword?.value !== 'index' || semicolon?.value !== ';') {\n\t\treturn null;\n\t}\n\treturn fixer.removeRange([semicolon.range[0], index.range![1]]);\n}\n\nexport default rule;\n","import type { Rule } from 'eslint';\nimport { get_core_rule, merge_listeners, with_report, wrapper_meta } from '../utils/core-rule.js';\n\nconst core = get_core_rule('no-await-in-loop');\n\nconst FUNCTION_TYPES = new Set([\n\t'FunctionDeclaration',\n\t'FunctionExpression',\n\t'ArrowFunctionExpression',\n]);\n\n/**\n * Core `no-await-in-loop`, which also reports an `await` in a `@for` key: the\n * key runs once per item, as the body does.\n */\nconst rule: Rule.RuleModule = {\n\tmeta: wrapper_meta(core, 'Disallow `await` inside of loops, including the key of a `@for` loop'),\n\tcreate(context) {\n\t\tconst reported = new Set<unknown>();\n\t\tconst listeners = core.create(\n\t\t\twith_report(context, (descriptor) => {\n\t\t\t\treported.add((descriptor as { node?: Rule.Node }).node);\n\t\t\t\tcontext.report(descriptor);\n\t\t\t}),\n\t\t);\n\t\treturn merge_listeners(listeners, {\n\t\t\tAwaitExpression(node: Rule.Node) {\n\t\t\t\tif (!reported.has(node) && is_in_for_key(node)) {\n\t\t\t\t\tcontext.report({ node, messageId: 'unexpectedAwait' });\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t},\n};\n\nfunction is_in_for_key(node: Rule.Node): boolean {\n\tfor (\n\t\tlet child = node, parent = node.parent;\n\t\tparent && !FUNCTION_TYPES.has(parent.type);\n\t\tchild = parent, parent = parent.parent\n\t) {\n\t\tif (parent.type === ('JSXForExpression' as string) && (parent as any).key === child) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nexport default rule;\n","import type { Rule } from 'eslint';\nimport { get_core_rule, merge_listeners, wrapper_meta } from '../utils/core-rule.js';\n\nconst core = get_core_rule('no-unreachable');\n\nconst FUNCTION_TYPES = new Set([\n\t'FunctionDeclaration',\n\t'FunctionExpression',\n\t'ArrowFunctionExpression',\n]);\n\nconst LOOP_TYPES = [\n\t'WhileStatement',\n\t'DoWhileStatement',\n\t'ForStatement',\n\t'ForInStatement',\n\t'ForOfStatement',\n];\n\nconst SEGMENT_EVENTS = [\n\t'onCodePathSegmentStart',\n\t'onUnreachableCodePathSegmentStart',\n\t'onCodePathSegmentEnd',\n\t'onUnreachableCodePathSegmentEnd',\n] as const;\n\n/** The fields of a code path segment this rule reads. */\ninterface Segment {\n\treachable: boolean;\n\tallPrevSegments: Segment[];\n}\n\ninterface SwitchState {\n\t/** Whether the `@switch` is reached. */\n\tentry: boolean;\n\thas_default: boolean;\n\t/** Whether some arm reaches its end. */\n\tcompletes: boolean;\n}\n\ninterface TryState {\n\t/** Whether the `try` block, the `catch` block or the `finally` block reaches its end. */\n\tblock?: boolean;\n\thandler?: boolean;\n\tfinalizer?: boolean;\n\t/**\n\t * Whether something that can throw runs in the `try` block, which leads to\n\t * the `catch` block, or something that leaves early (a `return` too) runs\n\t * in the `try` statement, which leads to the `finally` block.\n\t */\n\tblock_throws: boolean;\n\tthrows: boolean;\n\tin_block: boolean;\n}\n\n/** The expressions code path analysis counts as able to throw, with identifier references. */\nconst THROWING_TYPES = ['CallExpression', 'NewExpression', 'MemberExpression', 'ImportExpression'];\n\n/**\n * Core `no-unreachable`, with the arms of a `@switch` as alternatives.\n *\n * ESLint's code path analysis knows only the standard node types, so it runs\n * the arms of a `@switch` one after another: after an arm that throws, it\n * marks the other arms and the code after the `@switch` unreachable. The core\n * rule here sees each segment through a proxy whose `reachable` revives those\n * paths: at the start of each arm of a reached `@switch`, and after the\n * `@switch` when an arm reaches its end or there is no `@default` arm.\n *\n * Code path analysis records nothing for an exit inside code it already holds\n * unreachable, so in a revived path this rule follows `throw`, `return`,\n * `break`, `continue`, `try` and endless loops itself. Elsewhere, every answer\n * is the core rule's.\n */\nconst rule: Rule.RuleModule = {\n\tmeta: wrapper_meta(\n\t\tcore,\n\t\t'Disallow unreachable code after `return`, `throw`, `continue`, and `break` statements, with the arms of a `@switch` as alternatives',\n\t),\n\tcreate(context) {\n\t\tconst listeners = core.create(context) as Record<string, any>;\n\n\t\t// Revived segments, and segments an exit in a revived path ended. Both\n\t\t// change as the traversal goes on: a segment can span several arms.\n\t\tconst revived = new WeakSet<Segment>();\n\t\tconst exited = new WeakSet<Segment>();\n\t\t// Answers of `is_reachable`. Reviving or ending a current segment changes\n\t\t// only its own answer: the segments after it don't exist yet.\n\t\tconst answers = new Map<Segment, boolean>();\n\n\t\tconst outer_segments: Set<Segment>[] = [];\n\t\tlet current = new Set<Segment>();\n\t\tconst switches = new Map<unknown, SwitchState>();\n\t\t// The `try` statements and loops entered through a revived path.\n\t\tconst tries = new Map<unknown, TryState>();\n\t\t// The `try` statements of the current code path the traversal is in.\n\t\tconst outer_try_stacks: TryState[][] = [];\n\t\tlet try_stack: TryState[] = [];\n\t\tconst loops = new WeakSet<object>();\n\t\t// Statements a `break` or `continue` in a revived path leaves or repeats.\n\t\tconst broken = new WeakSet<object>();\n\t\tconst continued = new WeakSet<object>();\n\t\tconst proxies = new WeakMap<Segment, { readonly reachable: boolean }>();\n\n\t\tfunction is_reachable(segment: Segment, seen?: Set<Segment>): boolean {\n\t\t\tconst known = answers.get(segment);\n\t\t\tif (known !== undefined) return known;\n\t\t\tif (segment.reachable || revived.has(segment)) return true;\n\t\t\tif (exited.has(segment) || seen?.has(segment)) return false;\n\t\t\tconst top = !seen;\n\t\t\tseen ??= new Set();\n\t\t\tseen.add(segment);\n\t\t\tconst previous = segment.allPrevSegments;\n\t\t\t// Code path analysis made it unreachable after an exit.\n\t\t\tconst result =\n\t\t\t\t!previous.some((segment) => segment.reachable) &&\n\t\t\t\tprevious.some((segment) => is_reachable(segment, seen));\n\t\t\t// Below the top, `false` may only mean the path loops back.\n\t\t\tif (result || top) answers.set(segment, result);\n\t\t\treturn result;\n\t\t}\n\n\t\tconst any_reachable = () => [...current].some((segment) => is_reachable(segment));\n\t\tconst in_revived_path = () =>\n\t\t\t[...current].some((segment) => !segment.reachable && is_reachable(segment));\n\n\t\tconst revive = () => {\n\t\t\tfor (const segment of current) {\n\t\t\t\tanswers.delete(segment);\n\t\t\t\texited.delete(segment);\n\t\t\t\trevived.add(segment);\n\t\t\t}\n\t\t};\n\n\t\tconst exit = () => {\n\t\t\tfor (const segment of current) {\n\t\t\t\tif (segment.reachable) continue;\n\t\t\t\tanswers.delete(segment);\n\t\t\t\trevived.delete(segment);\n\t\t\t\texited.add(segment);\n\t\t\t}\n\t\t};\n\n\t\tconst proxy = (segment: Segment) => {\n\t\t\tlet result = proxies.get(segment);\n\t\t\tif (!result) {\n\t\t\t\tresult = {\n\t\t\t\t\tget reachable() {\n\t\t\t\t\t\treturn is_reachable(segment);\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tproxies.set(segment, result);\n\t\t\t}\n\t\t\treturn result;\n\t\t};\n\n\t\tconst wrapped: Record<string, (...args: any[]) => void> = {\n\t\t\tonCodePathStart(...args: any[]) {\n\t\t\t\touter_segments.push(current);\n\t\t\t\tcurrent = new Set();\n\t\t\t\touter_try_stacks.push(try_stack);\n\t\t\t\ttry_stack = [];\n\t\t\t\tlisteners.onCodePathStart?.(...args);\n\t\t\t},\n\t\t\tonCodePathEnd(...args: any[]) {\n\t\t\t\tcurrent = outer_segments.pop()!;\n\t\t\t\ttry_stack = outer_try_stacks.pop()!;\n\t\t\t\tlisteners.onCodePathEnd?.(...args);\n\t\t\t},\n\t\t\t// A loop adds a predecessor to an earlier segment.\n\t\t\tonCodePathSegmentLoop() {\n\t\t\t\tanswers.clear();\n\t\t\t},\n\t\t\t// Before the core rule checks the block.\n\t\t\tBlockStatement(node: any) {\n\t\t\t\tconst parent = node.parent;\n\t\t\t\tconst state = tries.get(parent);\n\t\t\t\tif (\n\t\t\t\t\tparent.finalizer === node &&\n\t\t\t\t\tstate &&\n\t\t\t\t\t(state.block || state.handler || state.throws) &&\n\t\t\t\t\t!any_reachable()\n\t\t\t\t) {\n\t\t\t\t\trevive();\n\t\t\t\t}\n\t\t\t\tlisteners.BlockStatement(node);\n\t\t\t},\n\t\t};\n\t\tfor (const event of SEGMENT_EVENTS) {\n\t\t\tconst starts = event.endsWith('Start');\n\t\t\twrapped[event] = (segment: Segment, node: Rule.Node) => {\n\t\t\t\tif (starts) current.add(segment);\n\t\t\t\telse current.delete(segment);\n\t\t\t\tlisteners[event]?.(proxy(segment), node);\n\t\t\t};\n\t\t}\n\n\t\t// Something that can throw runs here, or with `throws_to_catch` false, a\n\t\t// `return`, which reaches a `finally` block but no `catch` block.\n\t\tconst may_throw = (throws_to_catch = true) => {\n\t\t\tif (!try_stack.length || !any_reachable()) return;\n\t\t\tfor (const state of try_stack) {\n\t\t\t\tstate.throws = true;\n\t\t\t\tif (throws_to_catch && state.in_block) state.block_throws = true;\n\t\t\t}\n\t\t};\n\n\t\tconst leave_loop = (node: any) => {\n\t\t\tif (broken.has(node) || (continued.has(node) && !is_endless(node))) {\n\t\t\t\tif (!any_reachable()) revive();\n\t\t\t} else if (loops.has(node) && is_endless(node)) {\n\t\t\t\texit();\n\t\t\t}\n\t\t};\n\t\tconst leave_breakable = (node: object) => {\n\t\t\tif (broken.has(node) && !any_reachable()) revive();\n\t\t};\n\n\t\treturn merge_listeners(\n\t\t\t{ ...listeners, ...wrapped },\n\t\t\t{\n\t\t\t\t...Object.fromEntries(\n\t\t\t\t\tLOOP_TYPES.flatMap((type) => [\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t(node: object) => {\n\t\t\t\t\t\t\t\tif (in_revived_path()) loops.add(node);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\t[`${type}:exit`, leave_loop],\n\t\t\t\t\t]),\n\t\t\t\t),\n\t\t\t\t'SwitchStatement:exit': leave_breakable,\n\t\t\t\t'LabeledStatement:exit': leave_breakable,\n\t\t\t\t'BreakStatement:exit'(node: any) {\n\t\t\t\t\tif (!in_revived_path()) return;\n\t\t\t\t\tconst target = jump_target(node, true);\n\t\t\t\t\tif (target) broken.add(target);\n\t\t\t\t\texit();\n\t\t\t\t},\n\t\t\t\t'ContinueStatement:exit'(node: any) {\n\t\t\t\t\tif (!in_revived_path()) return;\n\t\t\t\t\tconst target = jump_target(node, false);\n\t\t\t\t\tif (target) continued.add(target);\n\t\t\t\t\texit();\n\t\t\t\t},\n\t\t\t\t// A `continue` leads to the test of a `do` loop, after its body.\n\t\t\t\t'DoWhileStatement > .test'(node: any) {\n\t\t\t\t\tif (continued.has(node.parent) && !any_reachable()) revive();\n\t\t\t\t},\n\t\t\t\t'ThrowStatement:exit'() {\n\t\t\t\t\tmay_throw();\n\t\t\t\t\texit();\n\t\t\t\t},\n\t\t\t\t'ReturnStatement:exit'() {\n\t\t\t\t\tmay_throw(false);\n\t\t\t\t\texit();\n\t\t\t\t},\n\t\t\t\t...Object.fromEntries(THROWING_TYPES.map((type) => [`${type}:exit`, () => may_throw()])),\n\t\t\t\t'Identifier:exit'(node: any) {\n\t\t\t\t\tif (is_reference(node)) may_throw();\n\t\t\t\t},\n\t\t\t\tTryStatement(node: unknown) {\n\t\t\t\t\tif (!in_revived_path()) return;\n\t\t\t\t\tconst state = { block_throws: false, throws: false, in_block: true };\n\t\t\t\t\ttries.set(node, state);\n\t\t\t\t\ttry_stack.push(state);\n\t\t\t\t},\n\t\t\t\t'BlockStatement:exit'(node: any) {\n\t\t\t\t\tconst state = tries.get(node.parent);\n\t\t\t\t\tif (!state) return;\n\t\t\t\t\tif (node.parent.block === node) {\n\t\t\t\t\t\tstate.block = any_reachable();\n\t\t\t\t\t\tstate.in_block = false;\n\t\t\t\t\t}\n\t\t\t\t\tif (node.parent.finalizer === node) state.finalizer = any_reachable();\n\t\t\t\t},\n\t\t\t\t// As code path analysis has it, a `catch` block runs when something in\n\t\t\t\t// the `try` block can throw, or the `try` block reaches its end.\n\t\t\t\tCatchClause(node: any) {\n\t\t\t\t\tconst state = tries.get(node.parent);\n\t\t\t\t\tif (state && (state.block_throws || state.block) && !any_reachable()) revive();\n\t\t\t\t},\n\t\t\t\t'CatchClause:exit'(node: any) {\n\t\t\t\t\tconst state = tries.get(node.parent);\n\t\t\t\t\tif (state) state.handler = any_reachable();\n\t\t\t\t},\n\t\t\t\t'TryStatement:exit'(node: any) {\n\t\t\t\t\tconst state = tries.get(node);\n\t\t\t\t\tif (!state) return;\n\t\t\t\t\ttry_stack.pop();\n\t\t\t\t\tconst completes = (state.block || state.handler) && (!node.finalizer || state.finalizer);\n\t\t\t\t\tif (completes && !any_reachable()) revive();\n\t\t\t\t\telse if (!completes && any_reachable()) exit();\n\t\t\t\t},\n\t\t\t\tJSXSwitchExpression(node: any) {\n\t\t\t\t\tswitches.set(node, {\n\t\t\t\t\t\tentry: any_reachable(),\n\t\t\t\t\t\thas_default: node.cases.some((switch_case: any) => !switch_case.test),\n\t\t\t\t\t\tcompletes: false,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tJSXSwitchCase(node: any) {\n\t\t\t\t\tif (switches.get(node.parent)!.entry && !any_reachable()) revive();\n\t\t\t\t},\n\t\t\t\t'JSXSwitchCase:exit'(node: any) {\n\t\t\t\t\tconst state = switches.get(node.parent)!;\n\t\t\t\t\tstate.completes ||= any_reachable();\n\t\t\t\t},\n\t\t\t\t'JSXSwitchExpression:exit'(node: any) {\n\t\t\t\t\tconst state = switches.get(node)!;\n\t\t\t\t\tif (state.entry && (state.completes || !state.has_default) && !any_reachable()) {\n\t\t\t\t\t\trevive();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t},\n};\n\n/**\n * The statement a `break` leaves, or the loop a `continue` repeats.\n */\nfunction jump_target(node: any, is_break: boolean): object | null {\n\tfor (\n\t\tlet parent = node.parent;\n\t\tparent && !FUNCTION_TYPES.has(parent.type);\n\t\tparent = parent.parent\n\t) {\n\t\tif (node.label) {\n\t\t\tif (parent.type === 'LabeledStatement' && parent.label.name === node.label.name) {\n\t\t\t\treturn is_break ? parent : parent.body;\n\t\t\t}\n\t\t} else if (\n\t\t\tLOOP_TYPES.includes(parent.type) ||\n\t\t\t(is_break && parent.type === 'SwitchStatement')\n\t\t) {\n\t\t\treturn parent;\n\t\t}\n\t}\n\treturn null;\n}\n\n/** Whether an identifier is a reference, as code path analysis decides. */\nfunction is_reference(node: any): boolean {\n\tconst parent = node.parent;\n\tswitch (parent.type) {\n\t\tcase 'LabeledStatement':\n\t\tcase 'BreakStatement':\n\t\tcase 'ContinueStatement':\n\t\tcase 'ArrayPattern':\n\t\tcase 'RestElement':\n\t\tcase 'ImportSpecifier':\n\t\tcase 'ImportDefaultSpecifier':\n\t\tcase 'ImportNamespaceSpecifier':\n\t\tcase 'CatchClause':\n\t\t\treturn false;\n\t\tcase 'FunctionDeclaration':\n\t\tcase 'FunctionExpression':\n\t\tcase 'ArrowFunctionExpression':\n\t\tcase 'ClassDeclaration':\n\t\tcase 'ClassExpression':\n\t\tcase 'VariableDeclarator':\n\t\t\treturn parent.id !== node;\n\t\tcase 'Property':\n\t\tcase 'PropertyDefinition':\n\t\tcase 'MethodDefinition':\n\t\t\treturn parent.key !== node || parent.computed || parent.shorthand;\n\t\tcase 'AssignmentPattern':\n\t\t\treturn parent.key !== node;\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n\n/** Whether a loop's test is missing or a truthy literal, as code path analysis checks. */\nfunction is_endless(node: any): boolean {\n\tif (node.type === 'ForStatement' && !node.test) return true;\n\treturn (\n\t\t(node.type === 'WhileStatement' ||\n\t\t\tnode.type === 'DoWhileStatement' ||\n\t\t\tnode.type === 'ForStatement') &&\n\t\tnode.test.type === 'Literal' &&\n\t\tBoolean(node.test.value)\n\t);\n}\n\nexport default rule;\n","import { createRequire } from 'module';\nimport noReturnInComponent from './rules/no-return-in-component.js';\nimport controlFlowJsx from './rules/control-flow-jsx.js';\nimport validForOfKey from './rules/valid-for-of-key.js';\nimport requireStatementContainerBody from './rules/require-statement-container-body.js';\nimport jsxCurlyBracePresence from './rules/jsx-curly-brace-presence.js';\nimport noUnusedVars from './rules/no-unused-vars.js';\nimport noAwaitInLoop from './rules/no-await-in-loop.js';\nimport noUnreachable from './rules/no-unreachable.js';\n\nconst plugin = {\n\tmeta: {\n\t\tname: '@tsrx/eslint-plugin',\n\t\tversion: '0.1.3',\n\t},\n\trules: {\n\t\t'no-return-in-component': noReturnInComponent,\n\t\t'control-flow-jsx': controlFlowJsx,\n\t\t'valid-for-of-key': validForOfKey,\n\t\t'require-statement-container-body': requireStatementContainerBody,\n\t\t'jsx-curly-brace-presence': jsxCurlyBracePresence,\n\t\t'no-unused-vars': noUnusedVars,\n\t\t'no-await-in-loop': noAwaitInLoop,\n\t\t'no-unreachable': noUnreachable,\n\t},\n\tconfigs: {} as any,\n};\n\n// Try to load optional parsers\nconst require = createRequire(import.meta.url);\n\nlet tsrxParser: any;\nlet tsParser: any;\n\ntry {\n\ttsrxParser = require('@tsrx/eslint-parser');\n} catch {\n\t// @tsrx/eslint-parser is optional\n\ttsrxParser = null;\n}\n\ntry {\n\ttsParser = require('@typescript-eslint/parser');\n} catch {\n\t// @typescript-eslint/parser is optional\n\ttsParser = null;\n}\n\n// Helper to create config objects\nfunction createConfig(name: string, files: string[], parser: any, isTsrx: boolean) {\n\tconst rules: Record<string, string> = {\n\t\t'tsrx/control-flow-jsx': 'error',\n\t\t'tsrx/valid-for-of-key': 'error',\n\t};\n\n\tif (isTsrx) {\n\t\trules['tsrx/require-statement-container-body'] = 'error';\n\t}\n\n\tconst config: any = {\n\t\tname,\n\t\tfiles,\n\t\tplugins: {\n\t\t\ttsrx: plugin,\n\t\t},\n\t\trules,\n\t};\n\n\t// Only add parser if it's available\n\tif (parser) {\n\t\tconfig.languageOptions = {\n\t\t\tparser,\n\t\t\tparserOptions: {\n\t\t\t\tecmaVersion: 'latest',\n\t\t\t\tsourceType: 'module',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn config;\n}\n\n// Recommended configuration (flat config format)\nplugin.configs.recommended = [\n\tcreateConfig('tsrx/recommended-tsrx-files', ['**/*.tsrx'], tsrxParser, true),\n\tcreateConfig('tsrx/recommended-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser, false),\n\t{\n\t\tname: 'tsrx/ignores',\n\t\tignores: ['**/*.d.ts', '**/node_modules/**', '**/dist/**', '**/build/**'],\n\t},\n];\n\n// Strict configuration (flat config format)\nplugin.configs.strict = [\n\tcreateConfig('tsrx/strict-tsrx-files', ['**/*.tsrx'], tsrxParser, true),\n\tcreateConfig('tsrx/strict-typescript-files', ['**/*.ts', '**/*.tsx'], tsParser, false),\n\t{\n\t\tname: 'tsrx/ignores',\n\t\tignores: ['**/*.d.ts', '**/node_modules/**', '**/dist/**', '**/build/**'],\n\t},\n];\n\n// For eslint-plugin-react users, listed after react's configurations: its\n// `jsx-curly-brace-presence` unwraps strings that TSRX text reads as syntax, so\n// `.tsrx` files get the TSRX version. A rule that is off needs no plugin.\nplugin.configs.react = [\n\t{\n\t\tname: 'tsrx/react-tsrx-files',\n\t\tfiles: ['**/*.tsrx'],\n\t\tplugins: {\n\t\t\ttsrx: plugin,\n\t\t},\n\t\trules: {\n\t\t\t'tsrx/jsx-curly-brace-presence': 'error',\n\t\t\t'react/jsx-curly-brace-presence': 'off',\n\t\t},\n\t},\n];\n\n// For `js.configs.recommended` users, listed after it: the TSRX versions of the\n// core rules it turns on. A config can't read the severity another gives the\n// core rule, so each is an error, as `js.configs.recommended` has it.\nplugin.configs.js = [\n\t{\n\t\tname: 'tsrx/js-tsrx-files',\n\t\tfiles: ['**/*.tsrx'],\n\t\tplugins: {\n\t\t\ttsrx: plugin,\n\t\t},\n\t\trules: {\n\t\t\t'no-unused-vars': 'off',\n\t\t\t'tsrx/no-unused-vars': 'error',\n\t\t\t'no-unreachable': 'off',\n\t\t\t'tsrx/no-unreachable': 'error',\n\t\t},\n\t},\n];\n\nexport default plugin;\n"],"mappings":";;;AAEA,MAAMA,SAAwB;CAC7B,MAAM;EACL,MAAM;EACN,MAAM;GACL,aAAa;GACb,aAAa;EACd;EACA,YAAY;EACZ,UAAU,EACT,UAAU,yDACX;EACA,QAAQ,CAAC;CACV;CACA,OAAO,SAAS;EAEf,OAAO,CAAC;CACT;AACD;;;ACfA,MAAMC,0CAAwB,IAAI,IAAI;CACrC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAED,SAAgB,oBAAoB,MAA4C;CAC/E,IAAI,CAAC,MAAM,OAAO;CAElB,IACC,KAAK,SAAU,kBACf,KAAK,SAAU,qBACf,KAAK,SAAU,sBACf,KAAK,SAAU,yBACf,KAAK,SAAU,oBAEf,OAAO;CAGR,QACE,KAAK,SAAU,gBACf,KAAK,SAAU,iBACf,KAAK,SAAU,sBAChB,CAAC,CAAE,KAAiB,UAAU;AAEhC;AAEA,SAAgB,0BAA0B,MAAyB;CAElE,MAAM,OAAOC,KAAa;CAE1B,IAAI,CAAC,MACJ,OAAO;CAGR,IAAI,oBAAoB,IAAI,GAC3B,OAAO;CAGR,IA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1,6 @@
1
1
  {
2
2
  "name": "@tsrx/eslint-plugin",
3
- "version": "0.6.3",
3
+ "version": "0.7.1",
4
4
  "description": "ESLint plugin for TSRX",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -33,18 +33,19 @@
33
33
  "peerDependencies": {
34
34
  "eslint": ">=9.0.0",
35
35
  "@typescript-eslint/parser": "^8.56.1",
36
- "@tsrx/eslint-parser": "0.6.3"
36
+ "@tsrx/eslint-parser": "0.7.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/eslint": "^9.6.1",
40
40
  "@types/node": "^24.3.0",
41
41
  "@typescript-eslint/parser": "^8.56.1",
42
42
  "eslint": "^10.3.0",
43
+ "eslint-9": "npm:eslint@9.39.5",
43
44
  "tsdown": "^0.23.0",
44
45
  "typescript": "^5.9.3",
45
46
  "vitest": "^4.1.6",
46
- "@tsrx/eslint-parser": "0.6.3",
47
- "@tsrx/core": "0.5.5"
47
+ "@tsrx/eslint-parser": "0.7.1",
48
+ "@tsrx/core": "0.6.1"
48
49
  },
49
50
  "engines": {
50
51
  "node": ">=22.0.0"
package/src/index.ts CHANGED
@@ -3,6 +3,10 @@ import noReturnInComponent from './rules/no-return-in-component.js';
3
3
  import controlFlowJsx from './rules/control-flow-jsx.js';
4
4
  import validForOfKey from './rules/valid-for-of-key.js';
5
5
  import requireStatementContainerBody from './rules/require-statement-container-body.js';
6
+ import jsxCurlyBracePresence from './rules/jsx-curly-brace-presence.js';
7
+ import noUnusedVars from './rules/no-unused-vars.js';
8
+ import noAwaitInLoop from './rules/no-await-in-loop.js';
9
+ import noUnreachable from './rules/no-unreachable.js';
6
10
 
7
11
  const plugin = {
8
12
  meta: {
@@ -14,6 +18,10 @@ const plugin = {
14
18
  'control-flow-jsx': controlFlowJsx,
15
19
  'valid-for-of-key': validForOfKey,
16
20
  'require-statement-container-body': requireStatementContainerBody,
21
+ 'jsx-curly-brace-presence': jsxCurlyBracePresence,
22
+ 'no-unused-vars': noUnusedVars,
23
+ 'no-await-in-loop': noAwaitInLoop,
24
+ 'no-unreachable': noUnreachable,
17
25
  },
18
26
  configs: {} as any,
19
27
  };
@@ -92,4 +100,40 @@ plugin.configs.strict = [
92
100
  },
93
101
  ];
94
102
 
103
+ // For eslint-plugin-react users, listed after react's configurations: its
104
+ // `jsx-curly-brace-presence` unwraps strings that TSRX text reads as syntax, so
105
+ // `.tsrx` files get the TSRX version. A rule that is off needs no plugin.
106
+ plugin.configs.react = [
107
+ {
108
+ name: 'tsrx/react-tsrx-files',
109
+ files: ['**/*.tsrx'],
110
+ plugins: {
111
+ tsrx: plugin,
112
+ },
113
+ rules: {
114
+ 'tsrx/jsx-curly-brace-presence': 'error',
115
+ 'react/jsx-curly-brace-presence': 'off',
116
+ },
117
+ },
118
+ ];
119
+
120
+ // For `js.configs.recommended` users, listed after it: the TSRX versions of the
121
+ // core rules it turns on. A config can't read the severity another gives the
122
+ // core rule, so each is an error, as `js.configs.recommended` has it.
123
+ plugin.configs.js = [
124
+ {
125
+ name: 'tsrx/js-tsrx-files',
126
+ files: ['**/*.tsrx'],
127
+ plugins: {
128
+ tsrx: plugin,
129
+ },
130
+ rules: {
131
+ 'no-unused-vars': 'off',
132
+ 'tsrx/no-unused-vars': 'error',
133
+ 'no-unreachable': 'off',
134
+ 'tsrx/no-unreachable': 'error',
135
+ },
136
+ },
137
+ ];
138
+
95
139
  export default plugin;