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

chore: add no-unsafe-optional-chaining as it became part of recommanded settings #15202

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

peter-sanderson
Copy link
Contributor

@peter-sanderson peter-sanderson commented Nov 4, 2024

https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining became part of recommended settings

Prep, for #15144

@@ -124,7 +124,7 @@ export const Dropdown = forwardRef(
return;
}

const { width, height } = menuRef.current?.getBoundingClientRect();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its checked above, !menuRef.current => early return, the ? not needed

const { inlineSize: elementWidth, blockSize: elementHeight } =
entries[0].borderBoxSize?.[0];
const borderBoxSize = entries[0].borderBoxSize?.[0];
if (!borderBoxSize) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This probably never happens, but I wasn't sure

Copy link
Contributor

Choose a reason for hiding this comment

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

Can't tell from documentation :/ But in any case, it's not worse than previous code, which throws error if !borderBoxSize

@peter-sanderson peter-sanderson force-pushed the no-unsafe-optional-chaining branch from 6932fdd to 6f7e37c Compare November 4, 2024 16:17
Copy link
Contributor

@Lemonexe Lemonexe left a comment

Choose a reason for hiding this comment

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

LGTM

@peter-sanderson peter-sanderson merged commit e4c191e into develop Nov 5, 2024
35 checks passed
@peter-sanderson peter-sanderson deleted the no-unsafe-optional-chaining branch November 5, 2024 11:50
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.

2 participants