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

chore: finish enabling no-unnecessary-condition internally #8004

Conversation

JoshuaKGoldberg
Copy link
Member

PR Checklist

Overview

Follows #7837 et al. in fixing up existing @typescript-eslint/no-unnecessary-condition violations. Also enables the lint rule overall.

@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 Nov 29, 2023

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 4ecd40f
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/6567285b6e0f660008865dfe
😎 Deploy Preview https://deploy-preview-8004--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: 94 (🟢 up 6 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.

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review November 29, 2023 00:36
@@ -109,6 +109,7 @@ export default createRule<Options, MessageIds>({
ExportNamedDeclaration(node: TSESTree.ExportNamedDeclaration): void {
// Coerce the source into a string for use as a lookup entry.
const source = getSourceFromExport(node) ?? 'undefined';
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
Copy link
Member

Choose a reason for hiding this comment

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

This is the old issue we've got filed right where TS is giving the wrong type for logical assignment operators?

If yes - Oof we should prioritise this #6762

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah :/

@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
Copy link
Member

Choose a reason for hiding this comment

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

was there a bunch of errors here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, 9 of them. Mostly around type safety checks on user-provided parameters. E.g. config == null:

    if (typeof config !== 'object' || config == null) {
      throw new TypeError(
        'RuleTester.setDefaultConfig: config must be an object',
      );
    }

@JoshuaKGoldberg JoshuaKGoldberg merged commit 96abf18 into typescript-eslint:main Nov 29, 2023
58 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the lint-enable-no-unnecessary-condition branch November 29, 2023 23:14
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants