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

Melody compiler should warn for mounts with no keys (no 'as') #8

Closed
jamesb3ll opened this issue Dec 6, 2017 · 4 comments
Closed

Melody compiler should warn for mounts with no keys (no 'as') #8

jamesb3ll opened this issue Dec 6, 2017 · 4 comments

Comments

@jamesb3ll
Copy link

The compiler should warn if a mount has no key:
{% mount 'component.js' %}
Should be:
{% mount 'component.js' as 'key' %}

Especially in for-loops mounts should have keys.

Also update the documentation and emphasise on this.

@ayusharma
Copy link
Collaborator

@jamesb3ll @pago Should all mount decelerations without as key parameters have warning or should it only be in for-loops ?

I think, we can check this here

if (tokens.nextIf(Types.SYMBOL, 'as')) {

@efegurkan
Copy link
Contributor

Hey, @ayusharma

It should be for all of them AFAIK. It can be problematic in case of for loops, we are planning to enforce it.

@ayusharma
Copy link
Collaborator

we are planning to enforce it.

It's better to throw an error in that condition.

Please let me know the error format.

I am thinking of this.

parser.warn({
              title: "Missing 'as' key with mount.",
              pos: tokens.la(0).pos,
              advice: "There should be an 'as' argumnet with a 'key' in mount statement."
            });

ayusharma added a commit to ayusharma/melody that referenced this issue Aug 14, 2018
ayusharma added a commit to ayusharma/melody that referenced this issue Aug 15, 2018
ayusharma added a commit to ayusharma/melody that referenced this issue Aug 15, 2018
ayusharma added a commit to ayusharma/melody that referenced this issue Aug 16, 2018
ayusharma added a commit to ayusharma/melody that referenced this issue Aug 16, 2018
ayusharma added a commit to ayusharma/melody that referenced this issue Aug 17, 2018
ayusharma added a commit to ayusharma/melody that referenced this issue Sep 4, 2018
ayusharma added a commit to ayusharma/melody that referenced this issue Sep 4, 2018
ayusharma added a commit to ayusharma/melody that referenced this issue Sep 4, 2018
ayusharma added a commit to ayusharma/melody that referenced this issue Sep 13, 2018
ayusharma added a commit to ayusharma/melody-web that referenced this issue Sep 15, 2018
@pago
Copy link
Contributor

pago commented Jan 13, 2019

Has been fixed by @ayusharma and will be part of Melody 1.2.0

@pago pago closed this as completed Jan 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants