[ty] Enable unused-type-ignore-comment by default (#22474)

This commit is contained in:
Micha Reiser
2026-01-09 11:58:43 +01:00
committed by GitHub
parent ba5dd5837c
commit e61657ff3c
10 changed files with 52 additions and 31 deletions

View File

@@ -24,10 +24,10 @@ use crate::{Db, declare_lint, lint::LintId};
declare_lint! {
/// ## What it does
/// Checks for `type: ignore` or `ty: ignore` directives that are no longer applicable.
/// Checks for `ty: ignore` or `type: ignore` directives that are no longer applicable.
///
/// ## Why is this bad?
/// A `type: ignore` directive that no longer matches any diagnostic violations is likely
/// A `ty: ignore` directive that no longer matches any diagnostic violations is likely
/// included by mistake, and should be removed to avoid confusion.
///
/// ## Examples
@@ -40,10 +40,14 @@ declare_lint! {
/// ```py
/// a = 20 / 2
/// ```
///
/// ## Options
/// Set [`analysis.respect-type-ignore-comments`](https://docs.astral.sh/ty/reference/configuration/#respect-type-ignore-comments)
/// to `false` to prevent this rule from reporting unused `type: ignore` comments.
pub static UNUSED_IGNORE_COMMENT = {
summary: "detects unused `type: ignore` comments",
summary: "detects unused `ty: ignore` and `type: ignore` comments",
status: LintStatus::stable("0.0.1-alpha.1"),
default_level: Level::Ignore,
default_level: Level::Warn,
}
}