Skip to content

chore: enable no-confusing-void-expression internally #8375

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

Conversation

JoshuaKGoldberg
Copy link
Member

PR Checklist

Overview

Enables the rule internally and runs its --fix to correct all violations. The fixed style isn't always quite what I'd want, but I figured anything we definitively don't like should probably be enforced with separate lint rules:

  • Using for..of instead of .forEach
  • Not having {}s around a switch case unnecessarily

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @JoshuaKGoldberg!

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 Feb 4, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit f8b2f4e
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/65d60d6898874d00085e7815
😎 Deploy Preview https://deploy-preview-8375--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 8 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.

Copy link

nx-cloud bot commented Feb 4, 2024

Copy link

codecov bot commented Feb 4, 2024

Codecov Report

Attention: Patch coverage is 95.23810% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 87.79%. Comparing base (f36f682) to head (f8b2f4e).
Report is 19 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8375      +/-   ##
==========================================
+ Coverage   86.94%   87.79%   +0.84%     
==========================================
  Files         252      398     +146     
  Lines       12251    13902    +1651     
  Branches     3861     4067     +206     
==========================================
+ Hits        10652    12205    +1553     
- Misses       1332     1400      +68     
- Partials      267      297      +30     
Flag Coverage Δ
unittest 87.79% <95.23%> (+0.84%) ⬆️

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

Files Coverage Δ
...gin-internal/src/rules/no-poorly-typed-ts-props.ts 95.65% <100.00%> (+0.19%) ⬆️
...lugin-internal/src/rules/plugin-test-formatting.ts 79.88% <100.00%> (+0.69%) ⬆️
...plugin-internal/src/rules/prefer-ast-types-enum.ts 100.00% <ø> (ø)
packages/eslint-plugin/src/rules/ban-types.ts 100.00% <100.00%> (ø)
...-plugin/src/rules/explicit-function-return-type.ts 97.87% <100.00%> (ø)
...plugin/src/rules/explicit-module-boundary-types.ts 92.90% <100.00%> (+0.48%) ⬆️
...kages/eslint-plugin/src/rules/func-call-spacing.ts 96.77% <100.00%> (+0.10%) ⬆️
packages/eslint-plugin/src/rules/indent.ts 87.80% <100.00%> (ø)
...es/eslint-plugin/src/rules/lines-around-comment.ts 100.00% <100.00%> (ø)
...ackages/eslint-plugin/src/rules/member-ordering.ts 97.98% <100.00%> (ø)
... and 16 more

... and 142 files with indirect coverage changes

@JoshuaKGoldberg JoshuaKGoldberg added the blocked by another PR PRs which are ready to go but waiting on another PR label Feb 5, 2024
@JoshuaKGoldberg
Copy link
Member Author

JoshuaKGoldberg commented Feb 5, 2024

I'll wait to merge these changes until the flat config work lands.

Edit: ✔️

@JoshuaKGoldberg JoshuaKGoldberg removed the blocked by another PR PRs which are ready to go but waiting on another PR label Feb 21, 2024
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

Looking at the changes - TBH I don't really like this rule.
I don't think any of these changes improve clarity or readability of code.

The biggest issue I see is that if the function is implicitly typed or explicitly marked as returning void the rule still requires you to change things.

For example this code should pass the rule, IMO:

function returnsVoid(): void {}

function test1(): void {
  return returnsVoid(); // should be fine
}
const test2 = (): void => returnsVoid(); // should be fine

Because there's nothing confusing about that code - the expressions are all typed as void and the functions are typed as void.

Also changes like () => expr => () => { expr } actively reduce readability, IMO, esp when considering the above.

So I'm personally a bit 👎 on this.

@JoshuaKGoldberg
Copy link
Member Author

👍 Blocked on #8538.

@JoshuaKGoldberg JoshuaKGoldberg added the blocked by another issue Issues which are not ready because another issue needs to be resolved first label Feb 23, 2024
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft February 23, 2024 12:49
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked by another issue Issues which are not ready because another issue needs to be resolved first
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants