The Wayback Machine - https://web.archive.org/web/20200617211216/https://github.com/vuejs/vue/issues/11090
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

$http.delete shows warning "avoid using JavaScript unary operator as property name" #11090

Open
frOracle opened this issue Feb 7, 2020 · 4 comments · May be fixed by #11143
Open

$http.delete shows warning "avoid using JavaScript unary operator as property name" #11090

frOracle opened this issue Feb 7, 2020 · 4 comments · May be fixed by #11143

Comments

@frOracle
Copy link

@frOracle frOracle commented Feb 7, 2020

Version

2.6.11

Reproduction link

https://codepen.io/frOracle/pen/vYOEEVW

Steps to reproduce

use $http.delete in @click

What is expected?

$http.delete is a function, not unary operator

What is actually happening?

a warning "avoid using JavaScript unary operator as property name"


Related #5464

@posva posva changed the title $http.delete with warning "avoid using JavaScript unary operator as property name" $http.delete shows warning "avoid using JavaScript unary operator as property name" Feb 7, 2020
@posva posva removed the bug label Feb 7, 2020
@posva
Copy link
Member

@posva posva commented Feb 7, 2020

I think the point of this was to avoid problems by using keys in object with names like delete (looking at the commit where the file was changed to emit this error will probably have more info). Depending on that, we could avoid it on the expression if it's prefixed by an object.
It's still a warning, so it doesn't break the app.
The workaround is using $http['delete'], which is quite verbose

For anybody willing to give this a try: I marked this as a good first issue but it might be harder than I think because it depends on the logic that exists regarding the warning

@simwipado
Copy link

@simwipado simwipado commented Feb 8, 2020

created PR #11092 for this #issue

tyschroed added a commit to tyschroed/vue that referenced this issue Feb 25, 2020
Update error-detector to look for `.` prefix, indicating function is associated with an object

fix vuejs#11090
tyschroed added a commit to tyschroed/vue that referenced this issue Feb 25, 2020
@aryavb
Copy link

@aryavb aryavb commented May 23, 2020

PR #11409

@d33p4k-coder
Copy link

@d33p4k-coder d33p4k-coder commented Jun 5, 2020

because you can't use delete keyword as variable name.. these are reserve keywords but if you still want to use it then try brackets like this : ['delete'] : value

@posva posva removed the good first issue label Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.