diff --git a/compiler/forget/packages/eslint-plugin-react-forget/__tests__/ReactForgetDiagnostics-test.ts b/compiler/forget/packages/eslint-plugin-react-forget/__tests__/ReactForgetDiagnostics-test.ts index 2f4b73cb10..cac6559e29 100644 --- a/compiler/forget/packages/eslint-plugin-react-forget/__tests__/ReactForgetDiagnostics-test.ts +++ b/compiler/forget/packages/eslint-plugin-react-forget/__tests__/ReactForgetDiagnostics-test.ts @@ -30,8 +30,6 @@ const tests: ForgetTestCases = { } `, }, - ], - invalid: [ { name: "Unsupported syntax", code: normalizeIndent` @@ -40,8 +38,31 @@ const tests: ForgetTestCases = { return y * x; } `, + }, + ], + invalid: [ + { + name: "[Invariant] Defined after use", + code: normalizeIndent` + function Component(props) { + let y = function () { + m(x); + }; + + let x = { a }; + m(x); + return y; + } + `, errors: [ - "[ReactForget] Todo: (BuildHIR::lowerStatement) Handle var kinds in VariableDeclaration (3:3)", + { + message: + "[ReactForget] Invariant: EnterSSA: Expected identifier to be defined before being used. Identifier x$2 is undefined (7:7)", + line: 7, + column: 3, + endColumn: 17, + endLine: 7, + }, ], }, ], diff --git a/compiler/forget/packages/eslint-plugin-react-forget/src/rules/ReactForgetDiagnostics.ts b/compiler/forget/packages/eslint-plugin-react-forget/src/rules/ReactForgetDiagnostics.ts index a3bf506f86..a0007379c2 100644 --- a/compiler/forget/packages/eslint-plugin-react-forget/src/rules/ReactForgetDiagnostics.ts +++ b/compiler/forget/packages/eslint-plugin-react-forget/src/rules/ReactForgetDiagnostics.ts @@ -34,7 +34,7 @@ const rule: Rule.RuleModule = { Program(prog) { try { compileProgram(prog, { - opts: parsePluginOptions(null), // use defaults for now + opts: parsePluginOptions({ panicOnBailout: false }), filename: context.filename, comments: babelAST.comments ?? [], });