{"record":{"id":"40cf696afa5472f5","repo":"oxc-project/oxc","slug":"tslint-comment-detected-tslint-comment","errorCode":null,"errorMessage":"tslint comment detected: \"{tslint_comment}\"","messagePattern":"tslint comment detected: \"(.+?)\"","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/typescript/ban_tslint_comment.rs","lineNumber":8,"sourceCode":"use oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{context::LintContext, rule::Rule};\n\nfn ban_tslint_comment_diagnostic(tslint_comment: &str, span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"tslint comment detected: \\\"{tslint_comment}\\\"\")).with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct BanTslintComment;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// This rule disallows `tslint:<rule-flag>` comments.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Useful when migrating from TSLint to ESLint. Once TSLint has been\n    /// removed, this rule helps locate TSLint annotations\n    ///\n    /// ### Examples\n    ///\n    /// Examples of **incorrect** code for this rule:","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/typescript/ban_tslint_comment.rs#L1-L26","documentation":"Warning from typescript/ban-tslint-comment via ban_tslint_comment_diagnostic() (crates/oxc_linter/src/rules/typescript/ban_tslint_comment.rs:8). It flags any 'tslint:<flag>' comment (disable, enable, disable-next-line, ...). TSLint is deprecated, so these comments are inert leftovers that modern tooling cannot honor.","triggerScenarios":"Any comment in the scanned file matching tslint: — e.g. '// tslint:disable-next-line: no-console' or '// tslint:enable' — regardless of whether an ESLint-compatible equivalent exists; the span labels the comment text.","commonSituations":"Migrating an Angular/pre-2019 project from TSLint to ESLint/oxlint where codemods missed file headers or rarely-touched files; copying old snippet code that still carries tslint pragmas.","solutions":["Delete the tslint comment if the suppression is no longer needed","Replace it with the ESLint/oxlint equivalent: '// eslint-disable-next-line <rule> -- reason' when suppression is still required","Run a repo-wide codemod (e.g. 'rg -l \"tslint:\" | xargs sed -i \"/tslint:/d\"' reviewed per file) so stragglers cannot reappear","Enable ban-tslint-comment as error in CI so migrated files fail the build"],"exampleFix":"// before\n// tslint:disable-next-line: no-console\nconsole.log('debug');\n\n// after\nconsole.log('debug'); // eslint-disable-next-line no-console -- temporary debug trace","handlingStrategy":"validation","validationCode":"if (/\\/\\/\\s*tslint:(disable|enable|next-line)/.test(source)) {\n  fail('file still contains tslint: comments');\n}","typeGuard":"function isTslintComment(comment: string): boolean {\n  return /tslint:(disable|enable|disable-next-line|no-disable)/.test(comment);\n}","tryCatchPattern":null,"preventionTips":["Run the tslint-to-eslint codemod and verify with 'rg tslint:' before deleting the old config","Keep ban-tslint-comment enabled in CI so remnants fail fast","Never copy pragma comments from pre-2019 snippets without review"],"tags":["typescript","oxlint","lint","tslint","migration","legacy-comment"],"backgroundTag":"tslint-migration-cleanup","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"}