-
Notifications
You must be signed in to change notification settings - Fork 149
Deprecated unquoted strings #379
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
Deprecated unquoted strings #379
Conversation
|
Mhhh these tests should not pass. We should force |
|
@msaraiva & @lnr0626 due to the parser we will have to raise a warning from the parser, or modify the way it handles Because of this piece of code in the parser: surface/lib/surface/compiler/parser.ex Lines 229 to 231 in 2a17bda
There is no way to differentiate We could emit a warning from the parser, but we do not have access to a For example, we could replace the above function with: defp translate_attr({name, nil, meta}) do
{name, {:attribute_expr, "true", to_meta(meta)}, to_meta(meta)}
endand keep the current implementation. It means that WDYT? Do you have any alternatives? |
msaraiva
left a comment
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.
@Malian what about passing an extra field in the attribute's metadata to differentiate them? Since the attribute's metadata is available in attr_value, you could check that info.
1cd48f4 to
9f1db64
Compare
@msaraiva It is a solution, but it implies that we have to modify the surface/lib/surface/compiler/helpers.ex Lines 101 to 113 in f3a6d22
We could add a field that handles all extra meta, but It is maybe an overkill addition at this stage, isn't it? An alternative could be to catch this extra metadata one function above in the surface/lib/surface/compiler.ex Lines 607 to 611 in f3a6d22
|
Agreed. We shouldn't care. Those deprecations are temporary so if they work as expected, it's fine. 👍 |
* surface-next: Remove `phx_` prefix from props (surface-ui#384) Remove code for embedded interpolation inside strings Introduce <#unless> (surface-ui#376) Introduce the concept of root properties (surface-ui#382) Warn on invalid prop/data defaults (surface-ui#374) Deprecated unquoted strings (surface-ui#379) Convert embedded interpolation (surface-ui#380) Introduce <#raw> and deprecate <#Raw> (surface-ui#377)
Related to #340
My first attempt was to add handle this in theparserbut I believe it is not the role of the parser and it. I was able to move this warning to theTypeHandleror directly to theCompiler. From my point of view, it makes more sense to handle it in the compiler, so I decided to catch it in theattr_valuefunction when theattr_valueis not a string. If it is not a string, even if the type is:string, it means that the value as been converted before to something else, boolean or integer.Ok, this will teach me not to run all the tests before pushing...