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 formatting error on optional call expression and member chain #15920

Merged
merged 3 commits into from Jan 14, 2024

Conversation

sosukesuzuki
Copy link
Member

@sosukesuzuki sosukesuzuki commented Jan 14, 2024

Description

Fixes #15916

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@sosukesuzuki
Copy link
Member Author

@fisker I think #15916 is a high priority bug, so we will merge it without review. Please leave a review later.

@sosukesuzuki sosukesuzuki merged commit cb8004f into prettier:main Jan 14, 2024
28 checks passed
@sosukesuzuki sosukesuzuki deleted the 15916 branch January 14, 2024 02:50
isSimpleCallArgument(node.object, depth) &&
isSimpleCallArgument(node.property, depth)
isSimpleCallArgument(getChainProp(node, "object"), depth) &&
isSimpleCallArgument(getChainProp(node, "property"), depth)
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

We can add if (node.type === "ChainExpression") { node = node.expression } to isSimpleCallArgument like other functions do.

Copy link
Sponsor Member

@fisker fisker Jan 14, 2024

Choose a reason for hiding this comment

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

Or add to L801, TSNonNullExpression is also a wrapper.

@fisker fisker mentioned this pull request Jan 15, 2024
4 tasks
medikoo pushed a commit to medikoo/prettier-elastic that referenced this pull request Feb 17, 2024
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.

TypeError: Cannot read properties of undefined (reading 'type')
2 participants