{"record":{"id":"59bb078d5e64701b","repo":"oxc-project/oxc","slug":"unescaped-can-be-escaped-with-escaped","errorCode":null,"errorMessage":"`{unescaped}` can be escaped with {escaped}","messagePattern":"`(.+?)` can be escaped with (.+?)","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/react/no_unescaped_entities.rs","lineNumber":17,"sourceCode":"use oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{\n    AstNode,\n    context::{ContextHost, LintContext},\n    rule::Rule,\n};\n\nstatic ESCAPED_DOUBLE_QUOTE: &str = \"&quot; or &ldquo; or &#34; or &rdquo;\";\nstatic ESCAPED_SINGLE_QUOTE: &str = \"&apos; or &lsquo; or &#39; or &rsquo;\";\n\nfn no_unescaped_entities_diagnostic(span: Span, unescaped: char) -> OxcDiagnostic {\n    let escaped = if unescaped == '\"' { ESCAPED_DOUBLE_QUOTE } else { ESCAPED_SINGLE_QUOTE };\n    OxcDiagnostic::warn(format!(\"`{unescaped}` can be escaped with {escaped}\")).with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NoUnescapedEntities;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// This rule prevents characters that you may have meant as JSX escape characters from being accidentally injected as a text node in JSX statements.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// JSX escape characters are used to inject characters into JSX statements that would otherwise be interpreted as code.\n    ///\n    /// ### Example\n    /// Incorrect\n    ///\n    /// ```jsx","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/react/no_unescaped_entities.rs#L1-L35","documentation":"Raised by react/no_unescaped_entities when raw quote or apostrophe characters appear in JSX text. At the throw site the character (the message shows which) will be rendered literally and can trigger lint/HTML issues or Smart Quotes problems; the message names the matching HTML entity escape(s) — `&quot;` family for double quotes, `&apos;` family for single quotes. run() scans JSXText children for `\"` and `'` and reports each occurrence's span.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/react/no_unescaped_entities.rs:17 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Escape the character: use &quot; / &ldquo; / &#34; for double quotes and &apos; / &lsquo; / &#39; for single quotes.","Wrap the text in {\"...\"} or {'...'} instead."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}