Skip to content

Conversation

@ulrichstark
Copy link
Contributor

PR Checklist

Overview

It now also reports cases like:

const v: number = 5;
const x = v as any as number;

And fixes it to:

const v: number = 5;
const x = v;

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @ulrichstark!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@netlify
Copy link

netlify bot commented Nov 24, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 03776db
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/6939b5ac5f4d050008210d20
😎 Deploy Preview https://deploy-preview-11789--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (🟢 up 1 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link

nx-cloud bot commented Nov 24, 2025

View your CI Pipeline Execution ↗ for commit 03776db

Command Status Duration Result
nx run-many -t lint ✅ Succeeded 3m 5s View ↗
nx run-many -t typecheck ✅ Succeeded 1m 54s View ↗
nx run integration-tests:test ✅ Succeeded 5s View ↗
nx test eslint-plugin-internal --coverage=false ✅ Succeeded 3s View ↗
nx test eslint-plugin --coverage=false ✅ Succeeded 3s View ↗
nx test typescript-estree --coverage=false ✅ Succeeded 1s View ↗
nx run types:build ✅ Succeeded 2s View ↗
nx run generate-configs ✅ Succeeded 6s View ↗
Additional runs (29) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-12-10 18:08:33 UTC

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 93.08756% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.57%. Comparing base (dd96947) to head (03776db).

Files with missing lines Patch % Lines
packages/typescript-estree/src/convert.ts 0.00% 10 Missing ⚠️
...-plugin/src/rules/no-unnecessary-type-assertion.ts 98.97% 2 Missing ⚠️
...-plugin/src/rules/explicit-member-accessibility.ts 0.00% 1 Missing ⚠️
...es/eslint-plugin/src/rules/parameter-properties.ts 0.00% 1 Missing ⚠️
...s/eslint-plugin/src/util/collectUnusedVariables.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11789      +/-   ##
==========================================
+ Coverage   90.53%   90.57%   +0.03%     
==========================================
  Files         523      523              
  Lines       53096    53244     +148     
  Branches     8838     8887      +49     
==========================================
+ Hits        48073    48225     +152     
+ Misses       5010     5006       -4     
  Partials       13       13              
Flag Coverage Δ
unittest 90.57% <93.08%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/eslint-plugin/src/rules/no-deprecated.ts 96.66% <100.00%> (ø)
...ges/eslint-plugin/src/rules/no-misused-promises.ts 99.12% <100.00%> (ø)
...es/no-unnecessary-parameter-property-assignment.ts 98.93% <100.00%> (ø)
.../eslint-plugin/src/rules/triple-slash-reference.ts 100.00% <100.00%> (ø)
...c/util/class-scope-analyzer/extractComputedName.ts 71.64% <100.00%> (ø)
packages/rule-tester/src/RuleTester.ts 73.90% <100.00%> (ø)
packages/typescript-estree/src/node-utils.ts 70.05% <100.00%> (ø)
...-plugin/src/rules/explicit-member-accessibility.ts 99.05% <0.00%> (ø)
...es/eslint-plugin/src/rules/parameter-properties.ts 98.42% <0.00%> (ø)
...s/eslint-plugin/src/util/collectUnusedVariables.ts 96.56% <0.00%> (ø)
... and 2 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ulrichstark
Copy link
Contributor Author

This was a pretty tricky change to get right. Coverage is at 100%, it reported multiple cases while dogfooding, I turned the false positives into test cases and fixed the true positives. Let the review iterations begin!

@ulrichstark ulrichstark marked this pull request as ready for review November 26, 2025 21:20
@ulrichstark
Copy link
Contributor Author

At least two missing cases that I need to fix:

declare function fn(param: number);
fn(42 as unknown as number);
declare function fn(param: number);
fn(42 as any as number);

@ulrichstark ulrichstark marked this pull request as draft December 10, 2025 09:47
@ulrichstark ulrichstark force-pushed the feat(eslint-plugin)---no-unnecessary-type-assertion]-report-more-cases-based-on-assignability branch from 2bce6c0 to 1e6a961 Compare December 10, 2025 17:49
…sertion]-report-more-cases-based-on-assignability
@ulrichstark ulrichstark marked this pull request as ready for review December 10, 2025 18:18
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.

Rule proposal: no as any when type is already expected type

1 participant