{"record":{"id":"94c98107ff45dadf","repo":"oxc-project/oxc","slug":"unexpected-newline-between-template-tag-and-templa","errorCode":null,"errorMessage":"Unexpected newline between template tag and template literal","messagePattern":"Unexpected newline between template tag and template literal","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/eslint/no_unexpected_multiline.rs","lineNumber":39,"sourceCode":"        DiagnosticKind::FunctionCall { open_paren_span } => OxcDiagnostic::warn(\n            \"Unexpected newline between function name and open parenthesis of function call\",\n        )\n        .with_label(\n            open_paren_span.label(\"this is parsed as a function call, which may be unintentional\"),\n        )\n        .with_help(\n            \"If you did not intend to make a function call, insert ';' before the parenthesis\",\n        ),\n        DiagnosticKind::PropertyAccess { open_bracket_span } => OxcDiagnostic::warn(\n            \"Unexpected newline between object and open bracket of property access\",\n        )\n        .with_label(\n            open_bracket_span\n                .label(\"this is parsed as a property access, which may be unintentional\"),\n        )\n        .with_help(\"If you did not intend to access a property, insert ';' before the bracket\"),\n        DiagnosticKind::TaggedTemplate { backtick_span } => {\n            OxcDiagnostic::warn(\n                \"Unexpected newline between template tag and template literal\",\n            )\n            .with_label(backtick_span.label(\n                \"this is parsed as a tagged template, which may be unintentional\",\n            ))\n            .with_help(\"If you did not intend for this to be a tagged template, insert ';' before the backtick\")\n        }\n        DiagnosticKind::Division { slash_span } => {\n            OxcDiagnostic::warn(\n                \"Unexpected newline between numerator and division operator\",\n            )\n            .with_label(\n                slash_span.label(\"this is parsed as division, which may be unintentional\"),\n            )\n            .with_help(\"If you did not intend to divide, insert ';' before the slash\")\n        }\n    }\n}","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/no_unexpected_multiline.rs#L21-L57","documentation":"The `TaggedTemplate` variant of `no-unexpected-multiline`: the next line starts with a backtick, so the previous expression is parsed as a tag function for that template literal. The label attaches to the backtick span (\"this is parsed as a tagged template, which may be unintentional\") and the help recommends inserting `;` before the backtick.","triggerScenarios":"`const greeting = name\\n`hello ${name}`` — a statement ending in an expression, newline, then a line starting with a backtick template. Happens when template literals are introduced into semicolon-less files.","commonSituations":"Migrating string concatenation to template literals in a semicolon-less codebase; copy-pasting a template literal to the start of a line after an expression statement.","solutions":["Add `;` to the end of the previous statement.","Or keep the backtick on the same line as its intended tag/expression.","Adopt semicolons via formatter to eliminate the whole class."],"exampleFix":"// before\nconst who = getUser()\n`Hello ${who}`\n\n// after\nconst who = getUser();\n`Hello ${who}`;","handlingStrategy":"validation","validationCode":"# heuristic: lines starting with a backtick after an expression line\nrg -n -U '[\\w)\\]]\\s*\\n`' src/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Insert ';' before lines beginning with a template literal.","Keep the tag on the same line as its template.","Enable no-unexpected-multiline in CI if you omit semicolons."],"tags":["eslint","oxlint","no-unexpected-multiline","asi","semicolons","template-literals"],"backgroundTag":"automatic-semicolon-insertion","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}