Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eslint-plugin): [no-unused-expressions] false negatives when using assertions #8668

Conversation

up201304504
Copy link
Contributor

PR Checklist

Overview

The no-unused-expressions rule was producing false negatives when assertions are used within TypeScript code:

  • TSAsExpression
  • TSNonNullExpression
  • TSTypeAssertion

This pull request resolves the identified bug by correcting the behavior of the no-unused-expressions rule. The changes made in this PR have been validated in the TypeScript playground:

fixed_false_negatives_unused_expressions

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @up201304504!

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.

Copy link

netlify bot commented Mar 13, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit dc3a949
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/65f5d3c510fa310008f7cdcb
😎 Deploy Preview https://deploy-preview-8668--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: 89 (🔴 down 4 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (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 site configuration.

@up201304504 up201304504 changed the title fix(eslint-plugin) : [no-unused-expressions] False negatives when using assertions fix(eslint-plugin): [no-unused-expressions] False negatives when using assertions Mar 13, 2024
@up201304504 up201304504 changed the title fix(eslint-plugin): [no-unused-expressions] False negatives when using assertions fix(eslint-plugin): [no-unused-expressions] false negatives when using assertions Mar 13, 2024
Copy link

codecov bot commented Mar 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.24%. Comparing base (994812b) to head (dc3a949).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8668      +/-   ##
==========================================
- Coverage   88.02%   87.24%   -0.79%     
==========================================
  Files         401      251     -150     
  Lines       13934    12336    -1598     
  Branches     4087     3882     -205     
==========================================
- Hits        12265    10762    -1503     
+ Misses       1370     1305      -65     
+ Partials      299      269      -30     
Flag Coverage Δ
unittest 87.24% <100.00%> (-0.79%) ⬇️

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

Files Coverage Δ
...s/eslint-plugin/src/rules/no-unused-expressions.ts 95.65% <100.00%> (+0.41%) ⬆️

... and 150 files with indirect coverage changes

Copy link
Member

@auvred auvred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice start! 🚀

The code changes look good to me. I'm requesting one change in tests.

@auvred auvred added the awaiting response Issues waiting for a reply from the OP or another party label Mar 14, 2024
Copy link
Member

@auvred auvred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 LGTM! Thanks for working on this!

@auvred auvred added 1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready and removed awaiting response Issues waiting for a reply from the OP or another party labels Mar 16, 2024
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 thanks!

The word 'FIRE' animated to have flames suddenly coming out of it. The 'F' is an orange-ish molten rock pattern.

@JoshuaKGoldberg JoshuaKGoldberg merged commit fb18de9 into typescript-eslint:main Mar 17, 2024
56 of 59 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: [no-unused-expressions] False negatives when using assertions.
4 participants