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

fix(eslint-plugin): [prefer-optional-chain] handle MemberExpression in final chain position#11835

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
mdm317 wants to merge3 commits intotypescript-eslint:main
base:main
Choose a base branch
Loading
frommdm317:fix-11822-prefer-optional-chain-memberexpression

Conversation

@mdm317
Copy link
Contributor

PR Checklist

Problem

BinaryExpression nodes where both left and right are MemberExpression are not checked,
a === null || a.b !== foo.three; // bug: should be flagged/fixable, is not
and CallExpression nodes whose callee is a MemberExpression are not treated as MemberExpression.
a === null || a.b !== a.c();

Fix

  • IntroducedMemberBasedExpression, which covers botha.b anda.b().
  • Addedunknown to theyoda enum

Logic foryoda: unknown

  1. ForBinaryExpression nodes where both sides areMemberBasedExpression, setyoda tounknown.
    • e.g.,a.b != a.c,a.b != c.d
  2. Whenyoda isunknown and both sides are subsets of theprevious chain, skip the transformation inanalyzeChain.

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@mdm317!

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 commentedDec 10, 2025
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commit2838efc
🔍 Latest deploy loghttps://app.netlify.com/projects/typescript-eslint/deploys/69396cf79b4d87000864b910
😎 Deploy Previewhttps://deploy-preview-11835--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: 85 (🔴 down 12 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 commentedDec 10, 2025
edited
Loading

View yourCI Pipeline Execution ↗ for commit2838efc

CommandStatusDurationResult
nx test eslint-plugin --coverage=false✅ Succeeded5m 12sView ↗
nx run-many -t lint✅ Succeeded3m 17sView ↗
nx run-many -t typecheck✅ Succeeded2m 9sView ↗
nx test typescript-estree --coverage=false✅ Succeeded20sView ↗
nx test eslint-plugin-internal --coverage=false✅ Succeeded10sView ↗
nx run types:build✅ Succeeded2sView ↗
nx run generate-configs✅ Succeeded8sView ↗
nx run integration-tests:test✅ Succeeded3sView ↗
Additional runs (29)✅ Succeeded...View ↗

☁️Nx Cloud last updated this comment at2025-12-10 13:04:03 UTC

@codecov
Copy link

codecovbot commentedDec 10, 2025
edited
Loading

Codecov Report

❌ Patch coverage is96.33028% with4 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.55%. Comparing base (dd96947) to head (2838efc).
⚠️ Report is 7 commits behind head on main.

Files with missing linesPatch %Lines
packages/typescript-estree/src/convert.ts0.00%3 Missing⚠️
packages/type-utils/src/predicates.ts0.00%1 Missing⚠️
Additional details and impacted files
@@            Coverage Diff             @@##             main   #11835      +/-   ##==========================================+ Coverage   90.53%   90.55%   +0.01%==========================================  Files         523      523                Lines       53096    53140      +44       Branches     8838     8846       +8     ==========================================+ Hits        48073    48122      +49+ Misses       5010     5005       -5  Partials       13       13
FlagCoverage Δ
unittest90.55% <96.33%> (+0.01%)⬆️

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

Files with missing linesCoverage Δ
...lugin/src/rules/consistent-generic-constructors.ts97.46% <100.00%> (-0.02%)⬇️
...s/eslint-plugin/src/rules/no-dupe-class-members.ts100.00% <100.00%> (ø)
...ges/eslint-plugin/src/rules/no-misused-promises.ts99.12% <100.00%> (-0.01%)⬇️
packages/eslint-plugin/src/rules/no-redeclare.ts98.57% <100.00%> (-0.01%)⬇️
packages/eslint-plugin/src/rules/no-type-alias.ts100.00% <100.00%> (ø)
...slint-plugin/src/rules/prefer-namespace-keyword.ts100.00% <100.00%> (ø)
...lint-plugin/src/rules/prefer-nullish-coalescing.ts98.27% <100.00%> (-0.01%)⬇️
.../rules/prefer-optional-chain-utils/analyzeChain.ts100.00% <100.00%> (ø)
...efer-optional-chain-utils/gatherLogicalOperands.ts100.00% <100.00%> (ø)
...ages/eslint-plugin/src/rules/unified-signatures.ts94.26% <100.00%> (-0.07%)⬇️
... and6 more
🚀 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.

@mdm317mdm317 marked this pull request as ready for reviewDecember 10, 2025 13:09
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bug: @typescript-eslint/prefer-optional-chain produces incorrect autofix

1 participant

@mdm317

[8]ページ先頭

©2009-2025 Movatter.jp