Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(eslint-plugin): [prefer-nullish-coalescing] support if statement assignment (??=) and fix several minor bugs #10861

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

OlivierZal
Copy link
Contributor

@OlivierZal OlivierZal commented Feb 21, 2025

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @OlivierZal!

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 21, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 513b085
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/67e02a4849254e0008c6f2ef
😎 Deploy Preview https://deploy-preview-10861--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: 99 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (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.

@OlivierZal OlivierZal marked this pull request as draft February 21, 2025 09:19
Copy link

nx-cloud bot commented Feb 21, 2025

View your CI Pipeline Execution ↗ for commit 513b085.

Command Status Duration Result
nx run-many --target=build --exclude website --... ✅ Succeeded 1s View ↗
nx run-many --target=clean ✅ Succeeded 11s View ↗

☁️ Nx Cloud last updated this comment at 2025-03-24 13:01:58 UTC

Copy link

codecov bot commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.00%. Comparing base (8474474) to head (513b085).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10861      +/-   ##
==========================================
+ Coverage   87.97%   88.00%   +0.03%     
==========================================
  Files         470      470              
  Lines       16709    16763      +54     
  Branches     4710     4735      +25     
==========================================
+ Hits        14699    14753      +54     
  Misses       1664     1664              
  Partials      346      346              
Flag Coverage Δ
unittest 88.00% <100.00%> (+0.03%) ⬆️

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

Files with missing lines Coverage Δ
...eslint-plugin/src/rules/consistent-type-exports.ts 88.78% <100.00%> (-0.21%) ⬇️
...ckages/eslint-plugin/src/rules/no-unsafe-return.ts 97.18% <100.00%> (-0.04%) ⬇️
...lint-plugin/src/rules/prefer-nullish-coalescing.ts 96.68% <100.00%> (+1.02%) ⬆️
🚀 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.

@OlivierZal OlivierZal force-pushed the prefer-nullish-coalescing-10829 branch 3 times, most recently from 25f4ea7 to 46330a5 Compare February 22, 2025 22:49
@OlivierZal OlivierZal marked this pull request as ready for review February 22, 2025 22:51
@OlivierZal OlivierZal force-pushed the prefer-nullish-coalescing-10829 branch from 505fd3e to 1299a38 Compare February 23, 2025 22:13
@OlivierZal OlivierZal force-pushed the prefer-nullish-coalescing-10829 branch 2 times, most recently from 144036b to 1299a38 Compare February 24, 2025 18:21
@OlivierZal OlivierZal force-pushed the prefer-nullish-coalescing-10829 branch from 1299a38 to fcc9bea Compare February 24, 2025 18:24
@OlivierZal OlivierZal force-pushed the prefer-nullish-coalescing-10829 branch from 46cbf12 to 849bf03 Compare February 25, 2025 17:53
@OlivierZal OlivierZal marked this pull request as draft February 25, 2025 17:56
@OlivierZal OlivierZal force-pushed the prefer-nullish-coalescing-10829 branch from 4a72913 to 60091c8 Compare February 25, 2025 18:10
@OlivierZal OlivierZal force-pushed the prefer-nullish-coalescing-10829 branch from 96c95a8 to 16150a2 Compare February 25, 2025 22:38
@OlivierZal OlivierZal marked this pull request as ready for review February 25, 2025 22:40
@OlivierZal
Copy link
Contributor Author

OlivierZal commented Feb 25, 2025

Ready for review: new feature in the playground

While moving / refactoring the nodesInsideTestNode loop, and adding tests:

In the playground:

main branch playground

PR branch playground

Cc @kirkwaiblinger

@OlivierZal OlivierZal force-pushed the prefer-nullish-coalescing-10829 branch from 24210d9 to f69b588 Compare February 26, 2025 09:43
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Mar 19, 2025
Copy link
Member

Choose a reason for hiding this comment

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

I think it looks good enough for me! IMO we're just going for a best effort on comment placement.

Thanks!

@kirkwaiblinger kirkwaiblinger added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Mar 22, 2025
@OlivierZal
Copy link
Contributor Author

OlivierZal commented Mar 23, 2025

@JoshuaKGoldberg, the latest commit doesn't seem related to PR's failure (which was ok one commit before).

Merging main didn’t help.

@JoshuaKGoldberg
Copy link
Member

Yeah 😬 #10992 - we can ignore those failures.

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.

I regret not thinking more on comments earlier, thanks Kirk for the catch. After playing around with a bunch more cases there are only a couple more comment locations I could break. Getting there! 🚀

@JoshuaKGoldberg JoshuaKGoldberg added awaiting response Issues waiting for a reply from the OP or another party and removed 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge labels Mar 24, 2025
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Mar 24, 2025
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.

Super, thanks the thorough PR & discussion! 🔥

@JoshuaKGoldberg JoshuaKGoldberg merged commit 7151489 into typescript-eslint:main Mar 24, 2025
58 of 60 checks passed
@DarkDrek
Copy link

Hi is there an option to disable this only for assignments and keep the general lint for the other types?

@kirkwaiblinger
Copy link
Member

@DarkDrek see conversation at #10995

@typescript-eslint typescript-eslint locked and limited conversation to collaborators Mar 26, 2025
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.

Enhancement: [prefer-nullish-coalescing] should support if statement assignment (??=)
4 participants