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: Expo Router type generation for whitespace filenames #23662

Merged
merged 5 commits into from Jul 21, 2023

Conversation

marklawlor
Copy link
Contributor

Why

Expo Router type generation normalised whitespace when we should preserve it. This keeps the types inline with edge case usage.

/(my group, my other group )/my page.tsx is a valid filename.

It should be typed as

/(my group)/my page
/(my other group)/my page
/my page

How

Removed the URL normalisation and changed the group regex's to preserve white space. Group names are now trimmed

Test Plan

Updated unit tests

Checklist

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Jul 20, 2023
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Jul 20, 2023
@EvanBacon EvanBacon merged commit 02bb162 into main Jul 21, 2023
6 checks passed
@EvanBacon EvanBacon deleted the marklawlor/cli/typed-routes/spaces-in-filenames branch July 21, 2023 19:27
EvanBacon added a commit that referenced this pull request Jul 21, 2023
Expo Router type generation normalised whitespace when we should
preserve it. This keeps the types inline with edge case usage.

`/(my group,      my other group    )/my page.tsx` is a valid filename.

It should be typed as

```
/(my group)/my page
/(my other group)/my page
/my page
```

Removed the URL normalisation and changed the group regex's to preserve
white space. Group names are now trimmed

Updated unit tests

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

Co-authored-by: evanbacon <bacon@expo.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants