-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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 #17612][V4] Throw explicit error when a nonexistent method is invoked #17616
Conversation
@@ -169,7 +169,7 @@ | |||
"prefer-const": 0, | |||
"prefer-reflect": 0, | |||
"prefer-spread": 2, | |||
"prefer-template": 2, | |||
"prefer-template": 0, // not replace content in string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this line because template string not working with QUnit test, so all my test cases failed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave this at 2
. I'll figure out how to exempt the tests from this particular ESLint rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use this in js files : /*eslint prefer-template: 0*/
so it would be ok
What do you think about this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good
Travis dislike my commit 😢 |
GitHub isn't showing it for some reason, but looks like the forced rebuild succeeded: https://travis-ci.org/twbs/bootstrap/jobs/80598464 |
Oh that's it thank you |
@Johann-S What failure did you encounter when you used template strings? |
When I ran my test case the template wasn't working. In my JS src I wrote : And in my test case I check But |
Template strings are enclosed in backticks, not single quotes. |
Thank you very much ! I wasn't aware of that. I made a few changes : removed build passed : https://travis-ci.org/twbs/bootstrap/builds/80774970 |
@@ -390,10 +390,12 @@ const Carousel = (($) => { | |||
|
|||
if (typeof config === 'number') { | |||
data.to(config) | |||
|
|||
} else if (action) { | |||
} else if (typeof action === 'string') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why'd you change the condition here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because action
is always a string.
But if you prefer I can restore the old condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's okay.
Thanks for all the revising. I'll be happy to merge this once the |
Thank you for your review and feedbacks you helped me a lot ! 👍 |
let method = data[config] | ||
if (method === undefined) { | ||
throw new Error(`No method named "${config}"`) | ||
} | ||
data[config](relatedTarget) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use method
here instead of data[config]
The problem is when I replace For exemple if I change this in Tooltip file I have 43 tests failed with the same error message : Because the Any thoughts about this @cvrebert ? if (data[config] === undefined) {
throw new Error(`No method named "${config}"`)
}
data[config]() |
Ah, right, JS doesn't hold onto
@Johann-S Yeah, do that. |
Done ! |
Fix #17612: Throw explicit error when a nonexistent method is invoked
Thank you for your patience! |
You're welcome and thank you for your help and feedbacks 👍 |
Hi
it's a fix for #17612