{"record":{"id":"ebe7fdfbb04dacb1","repo":"oxc-project/oxc","slug":"unexpected-term-comment-display","errorCode":null,"errorMessage":"Unexpected '{term}' comment: {display}","messagePattern":"Unexpected '(.+?)' comment: (.+?)","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/eslint/no_warning_comments.rs","lineNumber":40,"sourceCode":"\n    for word in comment.split_whitespace() {\n        let tmp = if comment_to_display.is_empty() {\n            word.to_string()\n        } else {\n            format!(\"{comment_to_display} {word}\")\n        };\n\n        if tmp.len() <= CHAR_LIMIT {\n            comment_to_display = tmp;\n        } else {\n            truncated = true;\n            break;\n        }\n    }\n\n    let display = if truncated { format!(\"{comment_to_display}...\") } else { comment_to_display };\n\n    OxcDiagnostic::warn(format!(\"Unexpected '{term}' comment: {display}\"))\n        .with_help(\"Remove or rephrase this comment\")\n        .with_label(span)\n}\n\n#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema)]\n#[serde(default, deny_unknown_fields)]\nstruct NoWarningCommentsConfig {\n    /// An array of terms to match. The matching is case-insensitive.\n    terms: Vec<String>,\n    /// Where to check for the terms.\n    location: Location,\n    /// An array of characters to ignore at the start of comments when `location` is `\"start\"`.\n    ///\n    /// Useful for ignoring common comment decorations like `*` in JSDoc-style comments.\n    decoration: FxHashSet<String>,\n    /// Compiled matchers built from the user-facing configuration.\n    #[serde(skip)]\n    #[schemars(skip)]","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/no_warning_comments.rs#L22-L58","documentation":"Diagnostic from the `no-warning-comments` rule. The rule (pedantic category) flags comments containing configured terms such as TODO/FIXME/XXX so unfinished work does not ship silently. The message shows the matched term and the comment text truncated to 40 characters (CHAR_LIMIT) with a trailing '...'. Config: `terms` (case-insensitive array), `location` ('start' = after decoration, or 'anywhere'), and `decoration` characters to skip (e.g. `*` in JSDoc).","triggerScenarios":"Any comment matching a configured term at the configured location: `// TODO: implement` with location 'start', or `/* see FIXME below */` with location 'anywhere'. Terms compile to regex patterns; JSDoc-style `* TODO:` matches once `*` is listed in decoration.","commonSituations":"CI gates that forbid TODOs before release; teams enabling pedantic presets during a release freeze; legacy repos with hundreds of TODOs suddenly failing lint after adopting oxlint.","solutions":["Do the work or remove the comment if it is stale.","Rephrase so the term is not at the matched location (e.g. 'Note: pending implementation').","Track the item in your issue tracker instead of the codebase.","Tune config: narrow `terms`, set `location: \"start\"`, or add decorations so benign matches stop firing; use disable comments for intentional TODOs."],"exampleFix":"// before\n// TODO: implement retry logic\nfunction fetch() {}\n\n// after\n// Retry logic tracked in ISSUE-482\nfunction fetch() {}","handlingStrategy":"validation","validationCode":"const TERMS = ['todo', 'fixme', 'xxx']; // mirror your oxlint config\nfunction hasWarningComment(commentText, location) {\n  const t = commentText.toLowerCase();\n  return TERMS.some(term => location === 'anywhere' ? t.includes(term) : t.trimStart().startsWith(term));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Move TODO/FIXME items into your issue tracker linked by ID.","Configure `terms` and `location` narrowly so intentional notes do not fire.","Add `decoration` entries (e.g. '*') for JSDoc blocks you want skipped."],"tags":["lint","eslint","oxlint","comments","todo","code-hygiene"],"backgroundTag":"no-warning-comments","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"}