Content-Length: 361283 | pFad | http://github.com/typescript-eslint/typescript-eslint/pull/11325

50 chore(eslint-plugin): switch auto-generated test cases to hand-written in prefer-nullish-coalescing.test.ts by Vinccool96 · Pull Request #11325 · typescript-eslint/typescript-eslint · GitHub
Skip to content

chore(eslint-plugin): switch auto-generated test cases to hand-written in prefer-nullish-coalescing.test.ts #11325

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Vinccool96
Copy link
Contributor

PR Checklist

Overview

  • Change dynamic test cases using spread and map to handwritten ones
  • Seven (7) existing recurring cases have been removed
  • No further recurring cases exist
  • It's now almost the same length as the repo's lockfile (19278 vs 20905 lines), it will need to be split up ASAP, but where?

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @Vinccool96!

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 Jun 20, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 9677a0c
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/6855b2a7717bf20008dd2535
😎 Deploy Preview https://deploy-preview-11325--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: 84 (🔴 down 14 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (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.

Copy link

nx-cloud bot commented Jun 20, 2025

View your CI Pipeline Execution ↗ for commit 9677a0c.

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

☁️ Nx Cloud last updated this comment at 2025-06-20 19:23:39 UTC

@Vinccool96
Copy link
Contributor Author

image

Copy link

Uh oh! @Vinccool96, at least one image you shared is missing helpful alt text. Check #11325 (comment) to fix the following violations:

  • Images should have meaningful alternative text (alt text) at line 1

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

@JoshuaKGoldberg
Copy link
Member

No further recurring cases exist
It's now almost the same length as the repo's lockfile (19278 vs 20905 lines), it will need to be split up ASAP, but where?

Those two statements are mutually exclusive 😄. Even if no cases are === equal, having >19k lines means there are definitely overlaps. I skimmed through the code and can see:

  • Many many permutations of all the primitives in a union (string | boolean | undefined, string | number | undefined, ...)
  • Many many permutations of chaining logic (a ?? b, (a ?? b) || c, (a || b) || c, ...)
  • Many many permutations of property accesses (this.n, x.z, ...)
  • Combinations of all of the above across different depths of nested properties (2, 3, 4, ...)

I think a large percentage of the file -perhaps a majority- could be deduplicated without reducing logical coverage of the rule.

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 for getting this started! I don't think we can work with a ~19-20k file test though. This is the kind of explosive duplication the backing issue is trying to avoid. Can you reduce the number of redundant test cases please?

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Jun 23, 2025
@Vinccool96
Copy link
Contributor Author

Vinccool96 commented Jun 23, 2025

Sure. But do you have a trick on how to spot redundant test cases, and how to know I'm not removing something useful?

@JoshuaKGoldberg
Copy link
Member

I've got no quick tricks to mention 😞. In general, each test case should try to test some unique piece of logic. So if you're looking at a test, try to ask: "what piece(s) of logic / potential breakage(s) is this checking?" If every answer is already comprehensively covered by earlier tests, then the later test can probably be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting response Issues waiting for a reply from the OP or another party
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repo: [prefer-nullish-coalescing.test.ts] Switch auto-generated test cases to hand-written
2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/typescript-eslint/typescript-eslint/pull/11325

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy