Skip to content

refactor: add no-unnecessary-type-assertion rule and remove redundant assertions#13741

Merged
EurFelux merged 4 commits intomainfrom
eurfelux/refactor/no-unnecessary-type-assertion
Mar 25, 2026
Merged

refactor: add no-unnecessary-type-assertion rule and remove redundant assertions#13741
EurFelux merged 4 commits intomainfrom
eurfelux/refactor/no-unnecessary-type-assertion

Conversation

@EurFelux
Copy link
Copy Markdown
Collaborator

What this PR does

Before this PR:
The typescript/no-unnecessary-type-assertion rule was not enabled in oxlint, allowing redundant as X type assertions throughout the codebase.

After this PR:

  • Enabled typescript/no-unnecessary-type-assertion as error in .oxlintrc.json
  • Removed all unnecessary type assertions across 99 files (auto-fixed)

Why we need it and why it was done in this way

Unnecessary type assertions add noise and can mask real type issues. Enabling this lint rule keeps the codebase cleaner and ensures TypeScript's type inference is trusted where it's already correct.

The following tradeoffs were made: None

The following alternatives were considered: None

Breaking changes

None

Special notes for your reviewer

All changes were auto-fixed by the linter. The only manual change is the rule addition in .oxlintrc.json.

Checklist

Release note

NONE

@EurFelux EurFelux marked this pull request as draft March 23, 2026 12:26
@EurFelux
Copy link
Copy Markdown
Collaborator Author

EurFelux commented Mar 23, 2026

Note

This issue/comment/review was translated by Claude.

There are quite a few false positives, let's put this aside for now.


Original Content

False Positive 有点多,先放放

@EurFelux

This comment was marked as resolved.

@EurFelux

This comment was marked as resolved.

@EurFelux EurFelux force-pushed the eurfelux/refactor/no-unnecessary-type-assertion branch from 66af36c to 7a636a2 Compare March 24, 2026 10:07
@EurFelux EurFelux force-pushed the eurfelux/refactor/no-unnecessary-type-assertion branch from 7a636a2 to a673f9a Compare March 24, 2026 10:09
@EurFelux EurFelux marked this pull request as ready for review March 24, 2026 10:09
@EurFelux EurFelux force-pushed the eurfelux/refactor/no-unnecessary-type-assertion branch from a673f9a to b846b16 Compare March 24, 2026 10:12
@EurFelux EurFelux marked this pull request as draft March 24, 2026 10:15
@EurFelux EurFelux force-pushed the eurfelux/refactor/no-unnecessary-type-assertion branch from b846b16 to 66d3840 Compare March 24, 2026 10:22
@EurFelux EurFelux marked this pull request as ready for review March 24, 2026 10:22
@EurFelux EurFelux merged commit 937c2e8 into main Mar 25, 2026
12 checks passed
@EurFelux EurFelux deleted the eurfelux/refactor/no-unnecessary-type-assertion branch March 25, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants