From 321575e48fa3aa6c7a2af7c96bfc85417b4ec4de Mon Sep 17 00:00:00 2001 From: GiGaGon <107241144+MeGaGiGaGon@users.noreply.github.com> Date: Wed, 2 Jul 2025 14:31:15 -0700 Subject: [PATCH] [`flake8-pyi`] Make example error out-of-the-box (`PYI042`) (#19101) ## Summary Part of #18972 This PR makes [snake-case-type-alias (PYI042)](https://docs.astral.sh/ruff/rules/snake-case-type-alias/#snake-case-type-alias-pyi042)'s example error out-of-the-box [Old example](https://play.ruff.rs/8fafec81-2228-4ffe-81e8-1989b724cb47) ```py type_alias_name: TypeAlias = int ``` [New example](https://play.ruff.rs/b396746c-e6d2-423c-bc13-01a533bb0747) ```py from typing import TypeAlias type_alias_name: TypeAlias = int ``` Imports were also added to the "use instead" section. ## Test Plan N/A, no functionality/tests affected --- .../src/rules/flake8_pyi/rules/type_alias_naming.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/ruff_linter/src/rules/flake8_pyi/rules/type_alias_naming.rs b/crates/ruff_linter/src/rules/flake8_pyi/rules/type_alias_naming.rs index 1333356a22..7a2aba860b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/rules/type_alias_naming.rs +++ b/crates/ruff_linter/src/rules/flake8_pyi/rules/type_alias_naming.rs @@ -14,11 +14,15 @@ use crate::checkers::ast::Checker; /// /// ## Example /// ```pyi +/// from typing import TypeAlias +/// /// type_alias_name: TypeAlias = int /// ``` /// /// Use instead: /// ```pyi +/// from typing import TypeAlias +/// /// TypeAliasName: TypeAlias = int /// ``` #[derive(ViolationMetadata)]