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

fix(eslint-plugin): [unbound-method] check method definition in object literal using longhand form #8637

Conversation

kirkwaiblinger
Copy link
Member

@kirkwaiblinger kirkwaiblinger commented Mar 10, 2024

PR Checklist

Overview

Just added the same validation to the long form method syntax as already exists for the short form, i.e.

{
   // this
   f: function() {},
   // is now scrutinized the same as 
   g() {}
}

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @kirkwaiblinger!

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 Mar 10, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 2d2bdfc
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/65ed2810840e3700070f5558
😎 Deploy Preview https://deploy-preview-8637--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: 90 (no change 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.

@kirkwaiblinger kirkwaiblinger marked this pull request as ready for review March 10, 2024 02:35
Copy link

codecov bot commented Mar 10, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 87.23%. Comparing base (858c9a6) to head (2d2bdfc).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8637      +/-   ##
==========================================
+ Coverage   87.21%   87.23%   +0.02%     
==========================================
  Files         251      251              
  Lines       12305    12309       +4     
  Branches     3880     3881       +1     
==========================================
+ Hits        10732    10738       +6     
+ Misses       1303     1301       -2     
  Partials      270      270              
Flag Coverage Δ
unittest 87.23% <92.85%> (+0.02%) ⬆️

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

Files Coverage Δ
packages/eslint-plugin/src/rules/unbound-method.ts 95.29% <92.85%> (+2.70%) ⬆️

};
const f = o.f;
`,
`
Copy link
Member Author

Choose a reason for hiding this comment

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

the window tests are not related to the bug, just things i came up with while trying to figure out how to satisfy codecov.

@@ -229,37 +237,56 @@ function checkMethod(
(valueDeclaration as ts.PropertyDeclaration).initializer?.kind ===
ts.SyntaxKind.FunctionExpression,
};
case ts.SyntaxKind.PropertyAssignment: {
Copy link
Member Author

Choose a reason for hiding this comment

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

this is the only logic change

Copy link
Member

@auvred auvred left a comment

Choose a reason for hiding this comment

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

LGTM! 🔥

@JoshuaKGoldberg JoshuaKGoldberg merged commit 609a000 into typescript-eslint:main Mar 13, 2024
59 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
@kirkwaiblinger kirkwaiblinger deleted the unbound-method-function-properties branch March 29, 2024 13:32
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.

Bug: [unbound-method] should flag on method in object literal defined using longhand form
3 participants