{"record":{"id":"37487138441b4226","repo":"oxc-project/oxc","slug":"unexpected-newline-between-numerator-and-division","errorCode":null,"errorMessage":"Unexpected newline between numerator and division operator","messagePattern":"Unexpected newline between numerator and division operator","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/eslint/no_unexpected_multiline.rs","lineNumber":48,"sourceCode":"        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}\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// In most cases, semicolons are not required in JavaScript in order for code to be parsed\n    /// and executed as expected. Typically this occurs because semicolons are automatically\n    /// inserted based on a fixed set of rules. This rule exists to detect those cases where a semicolon\n    /// is NOT inserted automatically, and may be parsed differently than expected.\n    ///","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/no_unexpected_multiline.rs#L30-L66","documentation":"The `Division` variant of `no-unexpected-multiline`: the next line starts with `/`, which the parser reads as a division operator against the previous line's value instead of a regex literal or comment. The label attaches to the slash span (\"this is parsed as division, which may be unintentional\") and the help says to insert `;` before the slash.","triggerScenarios":"`const n = count\\n/regex/.test(s)` or `const x = a\\n/ 2 * b` — a statement ending in an expression, newline, then a line starting with `/`. The division parse either throws a syntax error or silently computes nonsense.","commonSituations":"Semicolon-less code where a regex test or a continuation of arithmetic starts a line; splitting long arithmetic expressions across lines right at the operator.","solutions":["End the previous statement with `;`.","Keep the operator at the end of the previous line instead of the start of the next (`a +`\\n`b`, not `a`\\n`+ b`).","Use a formatter with semicolons enabled."],"exampleFix":"// before\nconst ratio = total\n/2\n\n// after\nconst ratio = total / 2;","handlingStrategy":"validation","validationCode":"# heuristic: lines starting with '/' after an expression line\nrg -n -U '[\\w)\\]]\\s*\\n/' src/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Put binary operators at the end of the previous line, never at line start.","Terminate statements with ';' so '/' cannot be parsed as division.","Run a formatter; hand-wrapped arithmetic is where this bites."],"tags":["eslint","oxlint","no-unexpected-multiline","asi","semicolons","division","regex-literal"],"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"}