oxc-project/oxc · error · OxcDiagnostic

Unexpected multi string.

Error message

Unexpected multi string.

What it means

Lint diagnostic from eslint/no-multi-str: a string literal contains a line continuation (backslash + newline) spanning multiple lines. Multiline string literals hide the line breaks from readers and are invalid in strict-mode-adjacent tooling.

Source

Thrown at crates/oxc_linter/src/rules/eslint/no_multi_str.rs:9

use oxc_ast::AstKind;
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;

use crate::{AstNode, context::LintContext, rule::Rule};

fn no_multi_str_diagnostic(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Unexpected multi string.")
        .with_help("Multiline strings are not allowed. Use template literals or string concatenation instead.")
        .with_label(span)
}

#[derive(Debug, Default, Clone)]
pub struct NoMultiStr;

declare_oxc_lint!(
    /// ### What it does
    ///
    /// Disallow multiline strings.
    ///
    /// ### Why is this bad?
    ///
    /// Some consider this to be a bad practice as it was an undocumented feature of JavaScript
    /// that was only formalized later.
    ///
    /// ### Examples

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Use a template literal with real newlines
  2. Use string concatenation or \n escapes across multiple statements
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/eslint/no_multi_str.rs:9 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/b1bc0267bac47b2e. Report an issue: GitHub.