Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(eslint-plugin): [no-useless-default-assignment] add rule#11720

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ulrichstark wants to merge20 commits intotypescript-eslint:main
base:main
Choose a base branch
Loading
fromulrichstark:feat(eslint-plugin)---no-useless-default-assignment]-add-rule

Conversation

@ulrichstark
Copy link
Contributor

@ulrichstarkulrichstark commentedOct 25, 2025
edited
Loading

PR Checklist

Overview

Reports useless default values.

functionBar({ foo=''}:{foo:string}){returnfoo;}const{ foo=''}={foo:'bar'};const[foo='']=['bar'];[1,2,3].map((a=42)=>a+1);

zanminkian reacted with thumbs up emoji
@typescript-eslint
Copy link
Contributor

Thanks for the PR,@ulrichstark!

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 onhttps://opencollective.com/typescript-eslint.

@netlify
Copy link

netlifybot commentedOct 25, 2025
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commit7d7a636
🔍 Latest deploy loghttps://app.netlify.com/projects/typescript-eslint/deploys/690bbbe2444f3100086121a3
😎 Deploy Previewhttps://deploy-preview-11720--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: 97 (🟢 up 1 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (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 yourNetlify project configuration.

@nx-cloud
Copy link

nx-cloudbot commentedOct 25, 2025
edited
Loading

View yourCI Pipeline Execution ↗ for commit7d7a636

CommandStatusDurationResult
nx test eslint-plugin --coverage=false✅ Succeeded5m 15sView ↗
nx run-many -t lint✅ Succeeded3m 18sView ↗
nx run-many -t typecheck✅ Succeeded2m 4sView ↗
nx test typescript-estree --coverage=false✅ Succeeded2sView ↗
nx test eslint-plugin-internal --coverage=false✅ Succeeded3sView ↗
nx run integration-tests:test✅ Succeeded4sView ↗
nx run types:build✅ Succeeded5sView ↗
nx run generate-configs✅ Succeeded6sView ↗
Additional runs (29)✅ Succeeded...View ↗

☁️Nx Cloud last updated this comment at2025-11-05 21:16:24 UTC

@codecov
Copy link

codecovbot commentedOct 25, 2025
edited
Loading

Codecov Report

❌ Patch coverage is95.67308% with9 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.68%. Comparing base (ea2ee6b) to head (7d7a636).

Files with missing linesPatch %Lines
...-plugin/src/rules/no-useless-default-assignment.ts95.50%9 Missing⚠️
Additional details and impacted files
@@            Coverage Diff             @@##             main   #11720      +/-   ##==========================================+ Coverage   90.66%   90.68%   +0.01%==========================================  Files         518      519       +1       Lines       52435    52643     +208       Branches     8686     8732      +46     ==========================================+ Hits        47541    47740     +199- Misses       4880     4889       +9  Partials       14       14
FlagCoverage Δ
unittest90.68% <95.67%> (+0.01%)⬆️

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

Files with missing linesCoverage Δ
packages/eslint-plugin/src/configs/eslintrc/all.ts100.00% <100.00%> (ø)
...lugin/src/configs/eslintrc/disable-type-checked.ts100.00% <100.00%> (ø)
...n/src/configs/eslintrc/strict-type-checked-only.ts100.00% <100.00%> (ø)
...plugin/src/configs/eslintrc/strict-type-checked.ts100.00% <100.00%> (ø)
packages/eslint-plugin/src/configs/flat/all.ts100.00% <100.00%> (ø)
...nt-plugin/src/configs/flat/disable-type-checked.ts100.00% <100.00%> (ø)
...lugin/src/configs/flat/strict-type-checked-only.ts100.00% <100.00%> (ø)
...int-plugin/src/configs/flat/strict-type-checked.ts100.00% <100.00%> (ø)
...-plugin/src/rules/no-useless-default-assignment.ts95.50% <95.50%> (ø)
🚀 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.

@ulrichstarkulrichstark marked this pull request as draftOctober 25, 2025 22:13
@ulrichstarkulrichstark marked this pull request as ready for reviewOctober 25, 2025 22:59
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

A great start, I love how readable this implementation is! 👏 nicely done.

Requesting changes mostly on getting test coverage up and covering edge cases. I suspect you'll have to tweak the implementation a little to deal with tuples. Cheers!

ulrichstark reacted with heart emoji
default:
returnnull;
}
}

Choose a reason for hiding this comment

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

[Non-Actionable] I'm surprised a utility doesn't already exist for this - but I couldn't find one.

  • getStaticValue: doesn't handle identifiers
  • getStringIfConstant: doesn't handle identifiers (it's a small wrapper aroundgetStaticStringValue)
  • getStaticStringValue: didn't handle identifiers properly

Not requesting changes, just noting - maybe I missed one?

@JoshuaKGoldbergJoshuaKGoldberg added the awaiting responseIssues waiting for a reply from the OP or another party labelNov 3, 2025
@ulrichstark
Copy link
ContributorAuthor

Thanks Josh for your review! I already made all low effort changes. Do you also want me to turn the suggestion into a fix? I think it's safe in every case the project is properly typed.

@JoshuaKGoldberg
Copy link
Member

Yes let's do that 🚀

ulrichstark reacted with rocket emoji

@ulrichstark
Copy link
ContributorAuthor

Feedback implemented, turned suggestion into fix, improved examples in docs and increased test coverage. I'm ready!

@github-actionsgithub-actionsbot removed the awaiting responseIssues waiting for a reply from the OP or another party labelNov 5, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@JoshuaKGoldbergJoshuaKGoldbergAwaiting requested review from JoshuaKGoldberg

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Rule proposal: Detect useless default in function parameters and object destructuring

2 participants

@ulrichstark@JoshuaKGoldberg

[8]ページ先頭

©2009-2025 Movatter.jp