From f74b0b5c0cb59ca5fb3fae1b6876388c34b52701 Mon Sep 17 00:00:00 2001 From: Daniel Osmond Date: Fri, 27 Feb 2026 16:05:24 -0700 Subject: [PATCH 1/3] Add missing with_help and with_note to diagnostics --- .../typescript/consistent_type_assertions.rs | 25 +- ...typescript_consistent_type_assertions.snap | 223 ++++++++++++++++-- 2 files changed, 222 insertions(+), 26 deletions(-) diff --git a/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs b/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs index 81af92bfeb2d8..112afde66f1f0 100644 --- a/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs +++ b/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs @@ -19,23 +19,38 @@ use crate::{ }; fn use_angle_bracket_diagnostic(cast: &str, span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn(format!("Use `<{cast}>` instead of `as {cast}`.")).with_label(span) + OxcDiagnostic::warn(format!("Use `<{cast}>` instead of `as {cast}`.")) + .with_help(format!("Replace `as {cast}` with `<{cast}>`. For example, change `value as {cast}` to `<{cast}>value`.")) + .with_note("This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it.") + .with_label(span) } fn use_as_diagnostic(cast: &str, span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn(format!("Use `as {cast}` instead of `<{cast}>`.")).with_label(span) + OxcDiagnostic::warn(format!("Use `as {cast}` instead of `<{cast}>`.")) + .with_help(format!("Replace `<{cast}>` with `as {cast}`. For example, change `<{cast}>value` to `value as {cast}`. Note: you may need to add parentheses around the expression if it's used in certain contexts.")) + .with_note("This rule enforces consistent type assertion syntax across the codebase.") + .with_label(span) } fn never_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Do not use any type assertions.").with_label(span) + OxcDiagnostic::warn("Do not use any type assertions.") + .with_help("Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`.") + .with_note("Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate.") + .with_label(span) } fn unexpected_object_type_assertion_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Always prefer `const x: T = { ... }`.").with_label(span) + OxcDiagnostic::warn("Always prefer `const x: T = { ... }`.") + .with_help("Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape.") + .with_note("Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type.") + .with_label(span) } fn unexpected_array_type_assertion_diagnostic(span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn("Always prefer `const x: T[] = [ ... ]`.").with_label(span) + OxcDiagnostic::warn("Always prefer `const x: T[] = [ ... ]`.") + .with_help("Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type.") + .with_note("Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type.") + .with_label(span) } #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, JsonSchema)] diff --git a/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap b/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap index 71d24307a2fe3..7cdcd57706dec 100644 --- a/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap +++ b/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap @@ -7,379 +7,488 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = new Generic() as Foo; · ───────────────────────── ╰──── + help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as A`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = b as A; · ────── ╰──── + help: Replace `as A` with ``. For example, change `value as A` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as readonly number[]`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = [1] as readonly number[]; · ──────────────────────── ╰──── + help: Replace `as readonly number[]` with ``. For example, change `value as readonly number[]` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as a | b`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = 'string' as a | b; · ───────────────── ╰──── + help: Replace `as a | b` with ``. For example, change `value as a | b` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as A`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = !'string' as A; · ────────────── ╰──── + help: Replace `as A` with ``. For example, change `value as A` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as A`. ╭─[consistent_type_assertions.ts:1:12] 1 │ const x = (a as A) + b; · ────── ╰──── + help: Replace `as A` with ``. For example, change `value as A` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = new Generic() as Foo; · ──────────────────────────── ╰──── + help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:16] 1 │ const x = new (Generic as Foo)(); · ────────────────────── ╰──── + help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:16] 1 │ const x = new (Generic as Foo)('string'); · ────────────────────── ╰──── + help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:17] 1 │ const x = () => ({ bar: 5 }) as Foo; · ─────────────────── ╰──── + help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:17] 1 │ const x = () => bar as Foo; · ────────── ╰──── + help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = bar`${'baz'}` as Foo; · ──────────────────────────── ╰──── + help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as const`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = { key: 'value' } as const; · ───────────────────────── ╰──── + help: Replace `as const` with ``. For example, change `value as const` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = new Generic(); · ─────────────────────── ╰──── - help: Replace `new Generic()` with `new Generic() as Foo`. + help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as A` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = b; · ──── ╰──── - help: Replace `b` with `b as A`. + help: Replace `` with `as A`. For example, change `value` to `value as A`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as readonly number[]` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = [1]; · ────────────────────── ╰──── - help: Replace `[1]` with `[1] as readonly number[]`. + help: Replace `` with `as readonly number[]`. For example, change `value` to `value as readonly number[]`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as a | b` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = 'string'; · ─────────────── ╰──── - help: Replace `'string'` with `'string' as a | b`. + help: Replace `` with `as a | b`. For example, change `value` to `value as a | b`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as A` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = !'string'; · ──────────── ╰──── - help: Replace `!'string'` with `!'string' as A`. + help: Replace `` with `as A`. For example, change `value` to `value as A`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as A` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = a + b; · ──── ╰──── - help: Replace `a` with `(a as A)`. + help: Replace `` with `as A`. For example, change `value` to `value as A`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = new Generic(); · ────────────────────────── ╰──── - help: Replace `new Generic()` with `new Generic() as Foo`. + help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:16] 1 │ const x = new (Generic)(); · ──────────────────── ╰──── - help: Replace `Generic` with `(Generic) as Foo`. + help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:16] 1 │ const x = new (Generic)('string'); · ──────────────────── ╰──── - help: Replace `Generic` with `(Generic) as Foo`. + help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:17] 1 │ const x = () => { bar: 5 }; · ─────────────── ╰──── - help: Replace `{ bar: 5 }` with `({ bar: 5 } as Foo)`. + help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:17] 1 │ const x = () => bar; · ──────── ╰──── - help: Replace `bar` with `(bar as Foo)`. + help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = bar`${'baz'}`; · ────────────────────────── ╰──── - help: Replace `bar`${'baz'}`` with `bar`${'baz'}` as Foo`. + help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as const` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = { key: 'value' }; · ─────────────────────── ╰──── - help: Replace `{ key: 'value' }` with `{ key: 'value' } as const`. + help: Replace `` with `as const`. For example, change `value` to `value as const`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = new Generic() as Foo; · ───────────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = b as A; · ────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = [1] as readonly number[]; · ──────────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = 'string' as a | b; · ───────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = !'string' as A; · ────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:12] 1 │ const x = (a as A) + b; · ────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = new Generic() as Foo; · ──────────────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:16] 1 │ const x = new (Generic as Foo)(); · ────────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:16] 1 │ const x = new (Generic as Foo)('string'); · ────────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:17] 1 │ const x = () => ({ bar: 5 }) as Foo; · ─────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:17] 1 │ const x = () => bar as Foo; · ────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = bar`${'baz'}` as Foo; · ──────────────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = new Generic(); · ─────────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = b; · ──── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = [1]; · ────────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = 'string'; · ─────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = !'string'; · ──────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = a + b; · ──── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = new Generic(); · ────────────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:16] 1 │ const x = new (Generic)(); · ──────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:16] 1 │ const x = new (Generic)('string'); · ──────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:17] 1 │ const x = () => { bar: 5 }; · ─────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:17] 1 │ const x = () => bar; · ──────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = bar`${'baz'}`; · ────────────────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = {} as Foo; · ────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = {} as a | b; · ─────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:12] 1 │ const x = ({} as A) + b; · ─────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = >{}; · ──────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = {}; · ───────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = {} + b; · ───── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = {} as Foo; · ────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = {} as a | b; · ─────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:12] 1 │ const x = ({} as A) + b; · ─────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:7] 1 │ print({ bar: 5 } as Foo); · ───────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ new print({ bar: 5 } as Foo); · ───────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:3:21] @@ -388,66 +497,88 @@ source: crates/oxc_linter/src/tester.rs · ───────────────── 4 │ } ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:16] 1 │ function b(x = {} as Foo.Bar) {} · ───────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:16] 1 │ function c(x = {} as Foo) {} · ───────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:9] 1 │ print?.({ bar: 5 } as Foo); · ───────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:13] 1 │ print?.call({ bar: 5 } as Foo); · ───────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:9] 1 │ print`${{ bar: 5 } as Foo}`; · ───────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = >{}; · ──────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = {}; · ───────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = {} + b; · ───── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:7] 1 │ print({ bar: 5 }); · ─────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:11] 1 │ new print({ bar: 5 }); · ─────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:3:21] @@ -456,52 +587,64 @@ source: crates/oxc_linter/src/tester.rs · ─────────────── 4 │ } ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:9] 1 │ print?.({ bar: 5 }); · ─────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:13] 1 │ print?.call({ bar: 5 }); · ─────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T = { ... }`. ╭─[consistent_type_assertions.ts:1:9] 1 │ print`${{ bar: 5 }}`; · ─────────────── ╰──── + help: Replace the object literal type assertion with a type annotation. For example, change `const x = { a: 1 } as Type` to `const x: Type = { a: 1 }`. Alternatively, use `const x = { a: 1 } satisfies Type` if you want TypeScript to infer the exact shape. + note: Type assertions on object literals can hide errors where the object doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the object matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const a = (b, c); · ─────────── ╰──── - help: Replace `(b, c)` with `(b, c) as any`. + help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const f = (() => {}); · ─────────────── ╰──── - help: Replace `(() => {})` with `(() => {}) as any`. + help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const f = function () {}; · ─────────────────── ╰──── - help: Replace `function () {}` with `function () {} as any`. + help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const f = (async () => {}); · ───────────────────── ╰──── - help: Replace `(async () => {})` with `(async () => {}) as any`. + help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:3:25] @@ -510,7 +653,8 @@ source: crates/oxc_linter/src/tester.rs · ────────────── 4 │ } ╰──── - help: Replace `(yield a)` with `(yield a) as any`. + help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:3:24] @@ -519,69 +663,88 @@ source: crates/oxc_linter/src/tester.rs · ────────────── 4 │ ╰──── - help: Replace `(x <<= y)` with `(x <<= y) as any`. + help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:1:17] 1 │ const ternary = (true ? x : y); · ─────────────────── ╰──── - help: Replace `(true ? x : y)` with `(true ? x : y) as any`. + help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = [] as string[]; · ────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = []; · ──────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as string[]`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = [] as string[]; · ────────────── ╰──── + help: Replace `as string[]` with ``. For example, change `value as string[]` to `value`. + note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `as string[]` instead of ``. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = []; · ──────────── ╰──── - help: Replace `[]` with `[] as string[]`. + help: Replace `` with `as string[]`. For example, change `value` to `value as string[]`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = [] as string[]; · ────────────── ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:11] 1 │ const x = []; · ──────────── ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:7] 1 │ print([5] as Foo); · ────────── ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:11] 1 │ new print([5] as Foo); · ────────── ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:16] 1 │ function b(x = [5] as Foo.Bar) {} · ────────────── ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:3:21] @@ -590,30 +753,40 @@ source: crates/oxc_linter/src/tester.rs · ────────── 4 │ } ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:9] 1 │ print`${[5] as Foo}`; · ────────── ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:19] 1 │ const foo = () => [5] as Foo; · ────────── ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:11] 1 │ new print([5]); · ──────── ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:16] 1 │ function b(x = [5]) {} · ──────────── ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:3:21] @@ -622,21 +795,29 @@ source: crates/oxc_linter/src/tester.rs · ──────── 4 │ } ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:9] 1 │ print`${[5]}`; · ──────── ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:13] 1 │ const foo = [5]; · ──────── ╰──── + help: Replace the array literal type assertion with a type annotation. For example, change `const x = [1, 2] as Type[]` to `const x: Type[] = [1, 2]`. Alternatively, use `const x = [1, 2] satisfies Type[]` if you want TypeScript to infer the exact array type. + note: Type assertions on array literals can hide errors where the array doesn't actually match the asserted type. Using type annotations or `satisfies` ensures TypeScript verifies that the array matches the expected type. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:25] 1 │ const foo = ; · ───────────────── ╰──── + help: Remove the type assertion and use a type annotation instead. For example, change `const x = value as Type` to `const x: Type = value`. Alternatively, use the `satisfies` operator: `const x = value satisfies Type`. + note: Type assertions bypass TypeScript's type checking and can hide type errors. Using type annotations or the `satisfies` operator provides better type safety while still allowing TypeScript to infer types where appropriate. From 4e14973d46611d6c6b3d17d92157963ed500bba1 Mon Sep 17 00:00:00 2001 From: Cameron Clark Date: Sat, 28 Feb 2026 12:42:00 +0000 Subject: [PATCH 2/3] remove needless help msg --- .../typescript/consistent_type_assertions.rs | 1 - ...typescript_consistent_type_assertions.snap | 42 +++++++++---------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs b/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs index 112afde66f1f0..b701e1479a561 100644 --- a/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs +++ b/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs @@ -27,7 +27,6 @@ fn use_angle_bracket_diagnostic(cast: &str, span: Span) -> OxcDiagnostic { fn use_as_diagnostic(cast: &str, span: Span) -> OxcDiagnostic { OxcDiagnostic::warn(format!("Use `as {cast}` instead of `<{cast}>`.")) - .with_help(format!("Replace `<{cast}>` with `as {cast}`. For example, change `<{cast}>value` to `value as {cast}`. Note: you may need to add parentheses around the expression if it's used in certain contexts.")) .with_note("This rule enforces consistent type assertion syntax across the codebase.") .with_label(span) } diff --git a/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap b/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap index 7cdcd57706dec..0a1549ef0d791 100644 --- a/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap +++ b/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap @@ -111,7 +111,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = new Generic(); · ─────────────────────── ╰──── - help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `new Generic()` with `new Generic() as Foo`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as A` instead of ``. @@ -119,7 +119,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = b; · ──── ╰──── - help: Replace `` with `as A`. For example, change `value` to `value as A`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `b` with `b as A`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as readonly number[]` instead of ``. @@ -127,7 +127,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = [1]; · ────────────────────── ╰──── - help: Replace `` with `as readonly number[]`. For example, change `value` to `value as readonly number[]`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `[1]` with `[1] as readonly number[]`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as a | b` instead of ``. @@ -135,7 +135,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = 'string'; · ─────────────── ╰──── - help: Replace `` with `as a | b`. For example, change `value` to `value as a | b`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `'string'` with `'string' as a | b`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as A` instead of ``. @@ -143,7 +143,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = !'string'; · ──────────── ╰──── - help: Replace `` with `as A`. For example, change `value` to `value as A`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `!'string'` with `!'string' as A`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as A` instead of ``. @@ -151,7 +151,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = a + b; · ──── ╰──── - help: Replace `` with `as A`. For example, change `value` to `value as A`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `a` with `(a as A)`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. @@ -159,7 +159,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = new Generic(); · ────────────────────────── ╰──── - help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `new Generic()` with `new Generic() as Foo`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. @@ -167,7 +167,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = new (Generic)(); · ──────────────────── ╰──── - help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `Generic` with `(Generic) as Foo`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. @@ -175,7 +175,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = new (Generic)('string'); · ──────────────────── ╰──── - help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `Generic` with `(Generic) as Foo`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. @@ -183,7 +183,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = () => { bar: 5 }; · ─────────────── ╰──── - help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `{ bar: 5 }` with `({ bar: 5 } as Foo)`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. @@ -191,7 +191,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = () => bar; · ──────── ╰──── - help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `bar` with `(bar as Foo)`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. @@ -199,7 +199,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = bar`${'baz'}`; · ────────────────────────── ╰──── - help: Replace `` with `as Foo`. For example, change `value` to `value as Foo`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `bar`${'baz'}`` with `bar`${'baz'}` as Foo`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as const` instead of ``. @@ -207,7 +207,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = { key: 'value' }; · ─────────────────────── ╰──── - help: Replace `` with `as const`. For example, change `value` to `value as const`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `{ key: 'value' }` with `{ key: 'value' } as const`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. @@ -619,7 +619,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const a = (b, c); · ─────────── ╰──── - help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `(b, c)` with `(b, c) as any`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. @@ -627,7 +627,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const f = (() => {}); · ─────────────── ╰──── - help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `(() => {})` with `(() => {}) as any`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. @@ -635,7 +635,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const f = function () {}; · ─────────────────── ╰──── - help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `function () {}` with `function () {} as any`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. @@ -643,7 +643,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const f = (async () => {}); · ───────────────────── ╰──── - help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `(async () => {})` with `(async () => {}) as any`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. @@ -653,7 +653,7 @@ source: crates/oxc_linter/src/tester.rs · ────────────── 4 │ } ╰──── - help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `(yield a)` with `(yield a) as any`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. @@ -663,7 +663,7 @@ source: crates/oxc_linter/src/tester.rs · ────────────── 4 │ ╰──── - help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `(x <<= y)` with `(x <<= y) as any`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. @@ -671,7 +671,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const ternary = (true ? x : y); · ─────────────────── ╰──── - help: Replace `` with `as any`. For example, change `value` to `value as any`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `(true ? x : y)` with `(true ? x : y) as any`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. @@ -703,7 +703,7 @@ source: crates/oxc_linter/src/tester.rs 1 │ const x = []; · ──────────── ╰──── - help: Replace `` with `as string[]`. For example, change `value` to `value as string[]`. Note: you may need to add parentheses around the expression if it's used in certain contexts. + help: Replace `[]` with `[] as string[]`. note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. From 785eb76d7faeefc962e6bf56baf9634b955b1455 Mon Sep 17 00:00:00 2001 From: Cameron Clark Date: Sat, 28 Feb 2026 12:43:47 +0000 Subject: [PATCH 3/3] remove superfluous notes --- .../typescript/consistent_type_assertions.rs | 5 +-- ...typescript_consistent_type_assertions.snap | 35 ------------------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs b/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs index b701e1479a561..505ae0ed87060 100644 --- a/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs +++ b/crates/oxc_linter/src/rules/typescript/consistent_type_assertions.rs @@ -21,14 +21,11 @@ use crate::{ fn use_angle_bracket_diagnostic(cast: &str, span: Span) -> OxcDiagnostic { OxcDiagnostic::warn(format!("Use `<{cast}>` instead of `as {cast}`.")) .with_help(format!("Replace `as {cast}` with `<{cast}>`. For example, change `value as {cast}` to `<{cast}>value`.")) - .with_note("This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it.") .with_label(span) } fn use_as_diagnostic(cast: &str, span: Span) -> OxcDiagnostic { - OxcDiagnostic::warn(format!("Use `as {cast}` instead of `<{cast}>`.")) - .with_note("This rule enforces consistent type assertion syntax across the codebase.") - .with_label(span) + OxcDiagnostic::warn(format!("Use `as {cast}` instead of `<{cast}>`.")).with_label(span) } fn never_diagnostic(span: Span) -> OxcDiagnostic { diff --git a/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap b/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap index 0a1549ef0d791..e5f104c5000ad 100644 --- a/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap +++ b/crates/oxc_linter/src/snapshots/typescript_consistent_type_assertions.snap @@ -8,7 +8,6 @@ source: crates/oxc_linter/src/tester.rs · ───────────────────────── ╰──── help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as A`. ╭─[consistent_type_assertions.ts:1:11] @@ -16,7 +15,6 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace `as A` with ``. For example, change `value as A` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as readonly number[]`. ╭─[consistent_type_assertions.ts:1:11] @@ -24,7 +22,6 @@ source: crates/oxc_linter/src/tester.rs · ──────────────────────── ╰──── help: Replace `as readonly number[]` with ``. For example, change `value as readonly number[]` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as a | b`. ╭─[consistent_type_assertions.ts:1:11] @@ -32,7 +29,6 @@ source: crates/oxc_linter/src/tester.rs · ───────────────── ╰──── help: Replace `as a | b` with ``. For example, change `value as a | b` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as A`. ╭─[consistent_type_assertions.ts:1:11] @@ -40,7 +36,6 @@ source: crates/oxc_linter/src/tester.rs · ────────────── ╰──── help: Replace `as A` with ``. For example, change `value as A` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as A`. ╭─[consistent_type_assertions.ts:1:12] @@ -48,7 +43,6 @@ source: crates/oxc_linter/src/tester.rs · ────── ╰──── help: Replace `as A` with ``. For example, change `value as A` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:11] @@ -56,7 +50,6 @@ source: crates/oxc_linter/src/tester.rs · ──────────────────────────── ╰──── help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:16] @@ -64,7 +57,6 @@ source: crates/oxc_linter/src/tester.rs · ────────────────────── ╰──── help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:16] @@ -72,7 +64,6 @@ source: crates/oxc_linter/src/tester.rs · ────────────────────── ╰──── help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:17] @@ -80,7 +71,6 @@ source: crates/oxc_linter/src/tester.rs · ─────────────────── ╰──── help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:17] @@ -88,7 +78,6 @@ source: crates/oxc_linter/src/tester.rs · ────────── ╰──── help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as Foo`. ╭─[consistent_type_assertions.ts:1:11] @@ -96,7 +85,6 @@ source: crates/oxc_linter/src/tester.rs · ──────────────────────────── ╰──── help: Replace `as Foo` with ``. For example, change `value as Foo` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `` instead of `as const`. ╭─[consistent_type_assertions.ts:1:11] @@ -104,7 +92,6 @@ source: crates/oxc_linter/src/tester.rs · ───────────────────────── ╰──── help: Replace `as const` with ``. For example, change `value as const` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -112,7 +99,6 @@ source: crates/oxc_linter/src/tester.rs · ─────────────────────── ╰──── help: Replace `new Generic()` with `new Generic() as Foo`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as A` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -120,7 +106,6 @@ source: crates/oxc_linter/src/tester.rs · ──── ╰──── help: Replace `b` with `b as A`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as readonly number[]` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -128,7 +113,6 @@ source: crates/oxc_linter/src/tester.rs · ────────────────────── ╰──── help: Replace `[1]` with `[1] as readonly number[]`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as a | b` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -136,7 +120,6 @@ source: crates/oxc_linter/src/tester.rs · ─────────────── ╰──── help: Replace `'string'` with `'string' as a | b`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as A` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -144,7 +127,6 @@ source: crates/oxc_linter/src/tester.rs · ──────────── ╰──── help: Replace `!'string'` with `!'string' as A`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as A` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -152,7 +134,6 @@ source: crates/oxc_linter/src/tester.rs · ──── ╰──── help: Replace `a` with `(a as A)`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -160,7 +141,6 @@ source: crates/oxc_linter/src/tester.rs · ────────────────────────── ╰──── help: Replace `new Generic()` with `new Generic() as Foo`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:16] @@ -168,7 +148,6 @@ source: crates/oxc_linter/src/tester.rs · ──────────────────── ╰──── help: Replace `Generic` with `(Generic) as Foo`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:16] @@ -176,7 +155,6 @@ source: crates/oxc_linter/src/tester.rs · ──────────────────── ╰──── help: Replace `Generic` with `(Generic) as Foo`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:17] @@ -184,7 +162,6 @@ source: crates/oxc_linter/src/tester.rs · ─────────────── ╰──── help: Replace `{ bar: 5 }` with `({ bar: 5 } as Foo)`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:17] @@ -192,7 +169,6 @@ source: crates/oxc_linter/src/tester.rs · ──────── ╰──── help: Replace `bar` with `(bar as Foo)`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as Foo` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -200,7 +176,6 @@ source: crates/oxc_linter/src/tester.rs · ────────────────────────── ╰──── help: Replace `bar`${'baz'}`` with `bar`${'baz'}` as Foo`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as const` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -208,7 +183,6 @@ source: crates/oxc_linter/src/tester.rs · ─────────────────────── ╰──── help: Replace `{ key: 'value' }` with `{ key: 'value' } as const`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] @@ -620,7 +594,6 @@ source: crates/oxc_linter/src/tester.rs · ─────────── ╰──── help: Replace `(b, c)` with `(b, c) as any`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -628,7 +601,6 @@ source: crates/oxc_linter/src/tester.rs · ─────────────── ╰──── help: Replace `(() => {})` with `(() => {}) as any`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -636,7 +608,6 @@ source: crates/oxc_linter/src/tester.rs · ─────────────────── ╰──── help: Replace `function () {}` with `function () {} as any`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -644,7 +615,6 @@ source: crates/oxc_linter/src/tester.rs · ───────────────────── ╰──── help: Replace `(async () => {})` with `(async () => {}) as any`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:3:25] @@ -654,7 +624,6 @@ source: crates/oxc_linter/src/tester.rs 4 │ } ╰──── help: Replace `(yield a)` with `(yield a) as any`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:3:24] @@ -664,7 +633,6 @@ source: crates/oxc_linter/src/tester.rs 4 │ ╰──── help: Replace `(x <<= y)` with `(x <<= y) as any`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Use `as any` instead of ``. ╭─[consistent_type_assertions.ts:1:17] @@ -672,7 +640,6 @@ source: crates/oxc_linter/src/tester.rs · ─────────────────── ╰──── help: Replace `(true ? x : y)` with `(true ? x : y) as any`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Do not use any type assertions. ╭─[consistent_type_assertions.ts:1:11] @@ -696,7 +663,6 @@ source: crates/oxc_linter/src/tester.rs · ────────────── ╰──── help: Replace `as string[]` with ``. For example, change `value as string[]` to `value`. - note: This rule enforces consistent type assertion syntax across the codebase. Angle-bracket syntax (`value`) is preferred when this rule is configured to use it. ⚠ typescript-eslint(consistent-type-assertions): Use `as string[]` instead of ``. ╭─[consistent_type_assertions.ts:1:11] @@ -704,7 +670,6 @@ source: crates/oxc_linter/src/tester.rs · ──────────── ╰──── help: Replace `[]` with `[] as string[]`. - note: This rule enforces consistent type assertion syntax across the codebase. ⚠ typescript-eslint(consistent-type-assertions): Always prefer `const x: T[] = [ ... ]`. ╭─[consistent_type_assertions.ts:1:11]