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

Warning when use inteprolation #640

Closed
FabianoLothor opened this issue Sep 27, 2019 · 4 comments
Closed

Warning when use inteprolation #640

FabianoLothor opened this issue Sep 27, 2019 · 4 comments

Comments

@FabianoLothor
Copy link

FabianoLothor commented Sep 27, 2019

Describe the bug
Warning in console because interpolation

To Reproduce
Add a message using interpolation in schema.

My code:

// mySchema
{
...,
myVar: yup.string().max(5, 'Max ${max}'),
...
}

Expected behavior
None warnings.

Platform (please complete the following information):

  • Browser Chrome
  • Version 0.27.0

Additional context
image

I already add "no-template-curly-in-string": "off", in .eslintrc.json, but the problem still occuring.

Please, change this interpolation ${max} to {{max}} or something better.

@jquense
Copy link
Owner

jquense commented Sep 28, 2019

You can use a function and actual templates if you want to avoid this syntax

@jquense jquense closed this as completed Sep 28, 2019
@jordyvandomselaar
Copy link

@jquense Would you mind showing an example how we could do this?

@amarsyla
Copy link

amarsyla commented Oct 14, 2020

@jordyvandomselaar

yup.string().max(5, ({ max }) => `Max ${max}`),

@jordyvandomselaar
Copy link

Thank you very much @amarsyla!

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

No branches or pull requests

4 participants