Repository: astral-sh/ruff
File: crates/ruff/src/args.rs (Rust)

Code before:
    files: Vec<PathBuf>,
    /// The direction of the import map. By default, generates a dependency map, i.e., a map from
    /// file to files that it depends on. Use `--direction dependents` to generate a map from file
    /// to files that depend on it.
    #[clap(long, value_enum, default_value_t)]
    direction: Direction,
    /// Attempt to detect imports from string literals.
    #[clap(long)]
    detect_string_imports: bool,
    /// The minimum number of dots in a string import to consider it a valid import.
    #[clap(long)]
    min_dots: Option<usize>,
    /// Enable preview mode. Use `--no-preview` to disable.
    #[arg(long, overrides_with("no_preview"))]
    preview: bool,
    #[clap(long, overrides_with("preview"), hide = true)]
    no_preview: bool,
    /// The minimum Python version that should be supported.
    #[arg(long, value_enum)]
    target_version: Option<PythonVersion>,
    /// Path to a virtual environment to use for resolving additional dependencies
    #[arg(long)]
    python: Option<PathBuf>,
    /// Exclude imports that are only used for type checking (i.e., imports within `if TYPE_CHECKING:` blocks)
    #[arg(long)]
    exclude_type_checking_imports: bool,
}

// The `Parser` derive is for ruff_dev, for ruff `Args` would be sufficient
#[derive(Clone, Debug, clap::Parser)]
#[expect(clippy::struct_excessive_bools)]
pub struct CheckCommand {
    /// List of files or directories to check.
    #[clap(help = "List of files or directories to check [default: .]")]
    pub files: Vec<PathBuf>,
    /// Apply fixes to resolve lint violations.
    /// Use `--no-fix` to disable or `--unsafe-fixes` to include unsafe fixes.
    #[arg(long, overrides_with("no_fix"))]
    fix: bool,
    #[clap(long, overrides_with("fix"), hide = true)]
    no_fix: bool,
    /// Include fixes that may not retain the original intent of the code.
    /// Use `--no-unsafe-fixes` to disable.
    #[arg(long, overrides_with("no_unsafe_fixes"))]
    unsafe_fixes: bool,
    #[arg(long, overrides_with("unsafe_fixes"), hide = true)]
    no_unsafe_fixes: bool,
    /// Show an enumeration of all fixed lint violations.
    /// Use `--no-show-fixes` to disable.
    #[arg(long, overrides_with("no_show_fixes"))]
    show_fixes: bool,

Review comment (suggestion):
I think I'd name this `type_checking_only_imports` or just `type_checking_imports` where `true` includes them and `false` skips them (should default to `true`).


We should also add this as a configuration optiont to https://github.com/astral-sh/ruff/blob/6e4b15b6ca72285a2f509076f3871adca90e923a/crates/ruff_workspace/src/options.rs#L3816

Code after:
    #[clap(help = "List of files or directories to include [default: .]")]
    files: Vec<PathBuf>,
    /// The direction of the import map. By default, generates a dependency map, i.e., a map from
    /// file to files that it depends on. Use `--direction dependents` to generate a map from file
    /// to files that depend on it.
    #[clap(long, value_enum, default_value_t)]
    direction: Direction,
    /// Attempt to detect imports from string literals.
    #[clap(long)]
    detect_string_imports: bool,
    /// The minimum number of dots in a string import to consider it a valid import.
    #[clap(long)]
    min_dots: Option<usize>,
    /// Enable preview mode. Use `--no-preview` to disable.
    #[arg(long, overrides_with("no_preview"))]
    preview: bool,
    #[clap(long, overrides_with("preview"), hide = true)]
    no_preview: bool,
    /// The minimum Python version that should be supported.
    #[arg(long, value_enum)]
    target_version: Option<PythonVersion>,
    /// Path to a virtual environment to use for resolving additional dependencies
    #[arg(long)]
    python: Option<PathBuf>,
    /// Include imports that are only used for type checking (i.e., imports within `if TYPE_CHECKING:` blocks).
    /// Use `--no-type-checking-imports` to exclude imports that are only used for type checking.
    #[arg(long, overrides_with("no_type_checking_imports"))]
    type_checking_imports: bool,
    #[arg(long, overrides_with("type_checking_imports"), hide = true)]
    no_type_checking_imports: bool,
}

// The `Parser` derive is for ruff_dev, for ruff `Args` would be sufficient
#[derive(Clone, Debug, clap::Parser)]
#[expect(clippy::struct_excessive_bools)]
pub struct CheckCommand {
    /// List of files or directories to check.
    #[clap(help = "List of files or directories to check [default: .]")]
    pub files: Vec<PathBuf>,
    /// Apply fixes to resolve lint violations.
    /// Use `--no-fix` to disable or `--unsafe-fixes` to include unsafe fixes.
    #[arg(long, overrides_with("no_fix"))]
    fix: bool,
    #[clap(long, overrides_with("fix"), hide = true)]
    no_fix: bool,
    /// Include fixes that may not retain the original intent of the code.
    /// Use `--no-unsafe-fixes` to disable.
    #[arg(long, overrides_with("no_unsafe_fixes"))]
    unsafe_fixes: bool,
    #[arg(long, overrides_with("unsafe_fixes"), hide = true)]
    no_unsafe_fixes: bool,