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

Skip to content

Conversation

@ronami
Copy link
Member

@ronami ronami commented Oct 5, 2025

PR Checklist

Overview

Waiting for resolution on #3503 (comment) before opening for review.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @ronami!

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.

@netlify
Copy link

netlify bot commented Oct 5, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 3b98173
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/68e2d986cc985600081ffddd
😎 Deploy Preview https://deploy-preview-11682--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: 87 (🟢 up 9 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 your Netlify project configuration.

@nx-cloud
Copy link

nx-cloud bot commented Oct 5, 2025

View your CI Pipeline Execution ↗ for commit 3b98173

Command Status Duration Result
nx test eslint-plugin --coverage=false ✅ Succeeded 5m 10s View ↗
nx run-many -t lint ✅ Succeeded 3m 15s View ↗
nx run-many -t typecheck ✅ Succeeded 2m 4s View ↗
nx test eslint-plugin-internal --coverage=false ✅ Succeeded 5s View ↗
nx run types:build ✅ Succeeded 5s View ↗
nx run integration-tests:test ✅ Succeeded 3s View ↗
nx test typescript-estree --coverage=false ✅ Succeeded 2s View ↗
nx run generate-configs ✅ Succeeded 6s View ↗
Additional runs (29) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-10-05 20:59:43 UTC

@ronami ronami changed the title feat(eslint-plugin): [unbound-method] Report property signatures with function types feat(eslint-plugin): [unbound-method] report property signatures with function types Oct 5, 2025
'function foo({ unbound }: { unbound: () => void } = { unbound: () => {} }) {}',
`
function foo(
{ unbound }: { unbound: (this: void) => void } = { unbound: () => {} },
Copy link
Member Author

Choose a reason for hiding this comment

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

To my understanding, this previously valid test is in fact invalid without a this: void parameter type.

{
line: 5,
messageId: 'unbound',
messageId: 'unboundWithoutThisAnnotation',
Copy link
Member Author

@ronami ronami Oct 5, 2025

Choose a reason for hiding this comment

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

This is interesting, it seems the rule iterates on union types and reports the first violation:

for (const intersectionPart of tsutils
.unionConstituents(services.getTypeAtLocation(node))
.flatMap(unionPart =>
tsutils.intersectionConstituents(unionPart),
)) {
const reported = checkIfMethodAndReport(
property.key,
intersectionPart.getProperty(property.key.name),
);
if (reported) {
break;
}
}

In this case, the union starts with { unbound: () => string }, with Foo being second. Currently, { unbound: () => string } doesn't report, which causes the report to come from Foo.

This PR made it so { unbound: () => string } does trigger a report, which changes the error message accordingly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Somewhat related: #11683.

@codecov
Copy link

codecov bot commented Oct 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.74%. Comparing base (cdd6384) to head (3b98173).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11682   +/-   ##
=======================================
  Coverage   90.74%   90.74%           
=======================================
  Files         516      516           
  Lines       51989    51996    +7     
  Branches     8588     8591    +3     
=======================================
+ Hits        47176    47183    +7     
  Misses       4799     4799           
  Partials       14       14           
Flag Coverage Δ
unittest 90.74% <100.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
packages/eslint-plugin/src/rules/unbound-method.ts 99.10% <100.00%> (+0.02%) ⬆️

... and 1 file with indirect coverage changes

🚀 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[unbound-method] Should prevent conforming to a bound-style interface method with an unbound method

1 participant