Skip to content

refactor: enable noUncheckedIndexedAccess#18797

Closed
sapphi-red wants to merge 6 commits into
vitejs:mainfrom
sapphi-red:refactor/enable-noUncheckedIndexedAccess
Closed

refactor: enable noUncheckedIndexedAccess#18797
sapphi-red wants to merge 6 commits into
vitejs:mainfrom
sapphi-red:refactor/enable-noUncheckedIndexedAccess

Conversation

@sapphi-red
Copy link
Copy Markdown
Member

@sapphi-red sapphi-red commented Nov 27, 2024

Description

Enabled noUncheckedIndexedAccess to reduce errors for #18798

This would make the code safer but it's tedious in some cases like for (const key in obj) { obj[key] }.

@sapphi-red sapphi-red added the p1-chore Doesn't change code behavior (priority) label Nov 27, 2024
@sapphi-red sapphi-red marked this pull request as ready for review November 27, 2024 06:37
@sapphi-red sapphi-red marked this pull request as draft November 27, 2024 07:14
@sapphi-red sapphi-red marked this pull request as ready for review November 27, 2024 07:34
@bluwy
Copy link
Copy Markdown
Member

bluwy commented Dec 4, 2024

On surface I like that it encourages safer code, but it feels like it's making the code a bit more verbose in some cases. For example, it not interpreting regex access well and the const..in patterns affects the code readability for me. So I'm a bit conflicted in this change, but happy to hear what others think about this.

@sapphi-red
Copy link
Copy Markdown
Member Author

Pushed a commit that adds String::split / String::matchAll / RegExp::exec overload. This should reduce the verbosity a lot. We still need to pass the type argument but it's easier than as StrictRegExpArray<>.

I'm fine with closing this PR if others prefer not to enable it 👍

@patak-cat
Copy link
Copy Markdown
Member

I also don't know if the extra inconvenience is worthy here. I would vote to don't do merge this one at this point.

@sapphi-red
Copy link
Copy Markdown
Member Author

Then, I'll close this one and #18798. I'll make a PR that extracts the fixes found in #18798 👍

@sapphi-red sapphi-red closed this Dec 5, 2024
@sapphi-red sapphi-red deleted the refactor/enable-noUncheckedIndexedAccess branch December 5, 2024 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p1-chore Doesn't change code behavior (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants