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(template): prevent error when a folder in components start with a… #218

Closed
wants to merge 1 commit into from
Closed

fix(template): prevent error when a folder in components start with a… #218

wants to merge 1 commit into from

Conversation

AMoreaux
Copy link

@AMoreaux AMoreaux commented Aug 6, 2021

When you use a file architecture that includes a folder with a number like that :
image

The compiler break due to an invalid js object:
image

I suggest wrapping object keys in quotes to prevent that.

Copy link
Member

atinux commented Aug 10, 2021

I think that we could also define a pattern such as {number}.{component_name}, ex: 01.atoms to ignore the first part and let the user use the number to keep an order.

What do you think @pi0 ?

@pi0
Copy link
Member

pi0 commented Aug 10, 2021

Since numbers at beginning currently are unsupported, we can add this as a feature 👍 (but only if releasing same time as fix since otherwise will be a breaking change)

Thanks for PR @AMoreaux. It was pending to also apply same fix to loader and index.js template but since import names with number are invalid, i think going with @atinux idea. (This PR still makes sense BTW for other cases like dot between component name and unicode)

@AMoreaux
Copy link
Author

Thanks for your answers. I like the proposition of @atinux but the risk with this is a use case with two folders named: 01.atoms and 02.atoms.
The object keys can't have the same name. We could use a revision number for each component, but I can't evaluate the side effect of this change.

@pi0
Copy link
Member

pi0 commented Aug 11, 2021

Good points. If a collision happens, we can show a warning about the same component names.

@pi0
Copy link
Member

pi0 commented Aug 11, 2021

Just merged #222 that fixes an issue by removing the prefix. Currently, we cannot use this escape method since using esm exports is not possible to have an identifier with a number. I hope it makes sense @AMoreaux.

@pi0 pi0 closed this Aug 11, 2021
@AMoreaux
Copy link
Author

It's perfect. Thank you 🙂

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.

3 participants